/*!--------------------------------------------------------
 * 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 */

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;
    return g = { next: verb(0), "throw": verb(1), "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 = {}, 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;
};

export function __importStar(mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __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;
    }
    function next() {
        while (env.stack.length) {
            var rec = env.stack.pop();
            try {
                var result = rec.dispose && rec.dispose.call(rec.value);
                if (rec.async) return Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
            }
            catch (e) {
                fail(e);
            }
        }
        if (env.hasError) throw env.error;
    }
    return next();
}

export default {
    __extends: __extends,
    __assign: __assign,
    __rest: __rest,
    __decorate: __decorate,
    __param: __param,
    __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,
};

var kN=Object.defineProperty;var z$=Object.getOwnPropertyDescriptor;var PN=r=>{throw TypeError(r)};var q$=(r,t)=>{for(var e in t)kN(r,e,{get:t[e],enumerable:!0})};var _=(r,t,e,n)=>{for(var o=n>1?void 0:n?z$(t,e):t,i=r.length-1,s;i>=0;i--)(s=r[i])&&(o=(n?s(t,e,o):s(o))||o);return n&&o&&kN(t,e,o),o},C=(r,t)=>(e,n)=>t(e,n,r);var wP=(r,t,e)=>t.has(r)||PN("Cannot "+e);var gn=(r,t,e)=>(wP(r,t,"read from private field"),e?e.call(r):t.get(r)),Ku=(r,t,e)=>t.has(r)?PN("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(r):t.set(r,e),oh=(r,t,e,n)=>(wP(r,t,"write to private field"),n?n.call(r,e):t.set(r,e),e),rh=(r,t,e)=>(wP(r,t,"access private method"),e);import dY from"minimist";import*as T$ from"net";function ju(r,t){let e=Object.create(null);for(let n of r){let o=t(n),i=e[o];i||(i=e[o]=[]),i.push(n)}return e}function kP(r,t){let e=[],n=[];for(let o of r)t.has(o)||e.push(o);for(let o of t)r.has(o)||n.push(o);return{removed:e,added:n}}var DN,RN,_N=class{constructor(t,e){this.toKey=e;this._map=new Map;this[DN]="SetWithKey";for(let n of t)this.add(n)}get size(){return this._map.size}add(t){let e=this.toKey(t);return this._map.set(e,t),this}delete(t){return this._map.delete(this.toKey(t))}has(t){return this._map.has(this.toKey(t))}*entries(){for(let t of this._map.values())yield[t,t]}keys(){return this.values()}*values(){for(let t of this._map.values())yield t}clear(){this._map.clear()}forEach(t,e){this._map.forEach(n=>t.call(e,n,n,this))}[(RN=Symbol.iterator,DN=Symbol.toStringTag,RN)](){return this.values()}};var PP=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(t){setTimeout(()=>{throw t.stack?ho.isErrorNoTelemetry(t)?new ho(t.message+`

`+t.stack):new Error(t.message+`

`+t.stack):t},0)}}addListener(t){return this.listeners.push(t),()=>{this._removeListener(t)}}emit(t){this.listeners.forEach(e=>{e(t)})}_removeListener(t){this.listeners.splice(this.listeners.indexOf(t),1)}setUnexpectedErrorHandler(t){this.unexpectedErrorHandler=t}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(t){this.unexpectedErrorHandler(t),this.emit(t)}onUnexpectedExternalError(t){this.unexpectedErrorHandler(t)}},Gu=new PP;function ih(r){Gu.setUnexpectedErrorHandler(r)}function AN(r){if(!r||typeof r!="object")return!1;let t=r;return t.code==="EPIPE"&&t.syscall?.toUpperCase()==="WRITE"}function Xa(r){Gu.onUnexpectedError(r)}function ze(r){Qt(r)||Gu.onUnexpectedError(r)}function qd(r){Qt(r)||Gu.onUnexpectedExternalError(r)}function Yi(r){if(r instanceof Error){let{name:t,message:e,cause:n}=r,o=r.stacktrace||r.stack;return{$isError:!0,name:t,message:e,stack:o,noTelemetry:ho.isErrorNoTelemetry(r),cause:n?Yi(n):void 0,code:r.code}}return r}function _P(r){let t;return r.noTelemetry?t=new ho:(t=new Error,t.name=r.name),t.message=r.message,t.stack=r.stack,r.code&&(t.code=r.code),r.cause&&(t.cause=_P(r.cause)),t}var Hy="Canceled";function Qt(r){return r instanceof Be?!0:r instanceof Error&&r.name===Hy&&r.message===Hy}var Be=class extends Error{constructor(){super(Hy),this.name=this.message}},$d=class r extends Error{static{this._name="PendingMigrationError"}static is(t){return t instanceof r||t instanceof Error&&t.name===r._name}constructor(t){super(t),this.name=r._name}};function Ys(){let r=new Error(Hy);return r.name=r.message,r}function Fe(r){return r?new Error(`Illegal argument: ${r}`):new Error("Illegal argument")}function Qu(r){return r?new Error(`Illegal state: ${r}`):new Error("Illegal state")}var ui=class extends TypeError{constructor(t){super(t?`${t} is read-only and cannot be changed`:"Cannot change read-only property")}};function Xi(r){return r?r.message?r.message:r.stack?r.stack.split(`
`)[0]:String(r):"Error"}var Wy=class extends Error{constructor(t){super("NotImplemented"),t&&(this.message=t)}},zd=class extends Error{constructor(t){super("NotSupported"),t&&(this.message=t)}};var ho=class r extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof r)return t;let e=new r;return e.message=t.message,e.stack=t.stack,e}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},Pt=class r extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,r.prototype)}};function el(r,t){let e=this,n=!1,o;return function(){if(n)return o;if(n=!0,t)try{o=r.apply(e,arguments)}finally{t()}else o=r.apply(e,arguments);return o}}function LN(r,t,e=r.length-1){let n=j$(r,t,e);if(n!==-1)return r[n]}function j$(r,t,e=r.length-1){for(let n=e;n>=0;n--){let o=r[n];if(t(o,n))return n}return-1}function G$(r,t,e=0,n=r.length){let o=e,i=n;for(;o<i;){let s=Math.floor((o+i)/2);t(r[s])?o=s+1:i=s}return o-1}function ON(r,t,e=0,n=r.length){let o=e,i=n;for(;o<i;){let s=Math.floor((o+i)/2);t(r[s])?i=s:o=s+1}return o}var MN=class r{constructor(t){this._array=t;this._findLastMonotonousLastIdx=0}static{this.assertInvariants=!1}findLastMonotonous(t){if(r.assertInvariants){if(this._prevFindLastPredicate){for(let n of this._array)if(this._prevFindLastPredicate(n)&&!t(n))throw new Error("MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.")}this._prevFindLastPredicate=t}let e=G$(this._array,t,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=e+1,e===-1?void 0:this._array[e]}};function rn(r,t,e=(n,o)=>n===o){if(r===t)return!0;if(!r||!t||r.length!==t.length)return!1;for(let n=0,o=r.length;n<o;n++)if(!e(r[n],t[n]))return!1;return!0}function UN(r,t){let e=[],n;for(let o of r.slice(0).sort(t))!n||t(n[0],o)!==0?(n=[o],e.push(n)):n.push(o);return e}function DP(r,t,e){let n=[];function o(a,l,d){if(l===0&&d.length===0)return;let c=n[n.length-1];c&&c.start+c.deleteCount===a?(c.deleteCount+=l,c.toInsert.push(...d)):n.push({start:a,deleteCount:l,toInsert:d})}let i=0,s=0;for(;;){if(i===r.length){o(i,0,t.slice(s));break}if(s===t.length){o(i,r.length-i,[]);break}let a=r[i],l=t[s],d=e(a,l);d===0?(i+=1,s+=1):d<0?(o(i,1,[]),i+=1):d>0&&(o(i,0,[l]),s+=1)}return n}function FN(r,t,e){let n=DP(r,t,e),o=[],i=[];for(let s of n)o.push(...r.slice(s.start,s.start+s.deleteCount)),i.push(...s.toInsert);return{removed:o,added:i}}function HN(r,t,e,n,o){return e===0?Promise.resolve([]):new Promise((i,s)=>{(async()=>{let a=r.length,l=r.slice(0,e).sort(t);for(let d=e,c=Math.min(e+n,a);d<a;d=c,c=Math.min(c+n,a)){if(d>e&&await new Promise(u=>setTimeout(u)),o&&o.isCancellationRequested)throw new Be;Q$(r,t,l,d,c)}return l})().then(i,s)})}function Q$(r,t,e,n,o){for(let i=e.length;n<o;n++){let s=r[n];if(t(s,e[i-1])<0){e.pop();let a=ON(e,l=>t(s,l)<0);e.splice(a,0,s)}}}function tt(r){return r.filter(t=>!!t)}function WN(r){let t=0;for(let e=0;e<r.length;e++)r[e]&&(r[t]=r[e],t+=1);r.length=t}function sh(r){return!Array.isArray(r)||r.length===0}function tl(r){return Array.isArray(r)&&r.length>0}function Br(r,t=e=>e){let e=new Set;return r.filter(n=>{let o=t(n);return e.has(o)?!1:(e.add(o),!0)})}function RP(r,t){return r.push(t),()=>J$(r,t)}function J$(r,t){let e=r.indexOf(t);if(e>-1)return r.splice(e,1),t}function AP(r,t){let e;if(typeof t=="number"){let n=t;e=()=>{let o=Math.sin(n++)*179426549;return o-Math.floor(o)}}else e=Math.random;for(let n=r.length-1;n>0;n-=1){let o=Math.floor(e()*(n+1)),i=r[n];r[n]=r[o],r[o]=i}}function Kd(r,t){return Array.isArray(r)?r.map(t):t(r)}function Dn(r){return Array.isArray(r)?r:[r]}var VN;(a=>{function r(l){return l<0}a.isLessThan=r;function t(l){return l<=0}a.isLessThanOrEqual=t;function e(l){return l>0}a.isGreaterThan=e;function n(l){return l===0}a.isNeitherLessOrGreaterThan=n,a.greaterThan=1,a.lessThan=-1,a.neitherLessOrGreaterThan=0})(VN||={});function BN(r,t){return(e,n)=>t(r(e),r(n))}var $N=(r,t)=>r-t;var NN=class r{constructor(t){this.iterate=t}static{this.empty=new r(t=>{})}forEach(t){this.iterate(e=>(t(e),!0))}toArray(){let t=[];return this.iterate(e=>(t.push(e),!0)),t}filter(t){return new r(e=>this.iterate(n=>t(n)?e(n):!0))}map(t){return new r(e=>this.iterate(n=>e(t(n))))}some(t){let e=!1;return this.iterate(n=>(e=t(n),!e)),e}findFirst(t){let e;return this.iterate(n=>t(n)?(e=n,!1):!0),e}findLast(t){let e;return this.iterate(n=>(t(n)&&(e=n),!0)),e}findLastMaxBy(t){let e,n=!0;return this.iterate(o=>((n||VN.isGreaterThan(t(o,e)))&&(n=!1,e=o),!0)),e}};function NP(r,t,e){let n=r.get(t);return n===void 0&&(n=e,r.set(t,n)),n}var MP=class{constructor(t,e){this.uri=t;this.value=e}};function Y$(r){return Array.isArray(r)}var zN,Ke=class r{constructor(t,e){this[zN]="ResourceMap";if(t instanceof r)this.map=new Map(t.map),this.toKey=e??r.defaultToKey;else if(Y$(t)){this.map=new Map,this.toKey=e??r.defaultToKey;for(let[n,o]of t)this.set(n,o)}else this.map=new Map,this.toKey=t??r.defaultToKey}static{this.defaultToKey=t=>t.toString()}set(t,e){return this.map.set(this.toKey(t),new MP(t,e)),this}get(t){return this.map.get(this.toKey(t))?.value}has(t){return this.map.has(this.toKey(t))}get size(){return this.map.size}clear(){this.map.clear()}delete(t){return this.map.delete(this.toKey(t))}forEach(t,e){typeof e<"u"&&(t=t.bind(e));for(let[n,o]of this.map)t(o.value,o.uri,this)}*values(){for(let t of this.map.values())yield t.value}*keys(){for(let t of this.map.values())yield t.uri}*entries(){for(let t of this.map.values())yield[t.uri,t.value]}*[(zN=Symbol.toStringTag,Symbol.iterator)](){for(let[,t]of this.map)yield[t.uri,t.value]}},qN,kr=class{constructor(t,e){this[qN]="ResourceSet";!t||typeof t=="function"?this._map=new Ke(t):(this._map=new Ke(e),t.forEach(this.add,this))}get size(){return this._map.size}add(t){return this._map.set(t,t),this}clear(){this._map.clear()}delete(t){return this._map.delete(t)}forEach(t,e){this._map.forEach((n,o)=>t.call(e,o,o,this))}has(t){return this._map.has(t)}entries(){return this._map.entries()}keys(){return this._map.keys()}values(){return this._map.keys()}[(qN=Symbol.toStringTag,Symbol.iterator)](){return this.keys()}};var KN,LP=class{constructor(){this[KN]="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(t){return this._map.has(t)}get(t,e=0){let n=this._map.get(t);if(n)return e!==0&&this.touch(n,e),n.value}set(t,e,n=0){let o=this._map.get(t);if(o)o.value=e,n!==0&&this.touch(o,n);else{switch(o={key:t,value:e,next:void 0,previous:void 0},n){case 0:this.addItemLast(o);break;case 1:this.addItemFirst(o);break;case 2:this.addItemLast(o);break;default:this.addItemLast(o);break}this._map.set(t,o),this._size++}return this}delete(t){return!!this.remove(t)}remove(t){let e=this._map.get(t);if(e)return this._map.delete(t),this.removeItem(e),this._size--,e.value}shift(){if(!this._head&&!this._tail)return;if(!this._head||!this._tail)throw new Error("Invalid list");let t=this._head;return this._map.delete(t.key),this.removeItem(t),this._size--,t.value}forEach(t,e){let n=this._state,o=this._head;for(;o;){if(e?t.bind(e)(o.value,o.key,this):t(o.value,o.key,this),this._state!==n)throw new Error("LinkedMap got modified during iteration.");o=o.next}}keys(){let t=this,e=this._state,n=this._head,o={[Symbol.iterator](){return o},next(){if(t._state!==e)throw new Error("LinkedMap got modified during iteration.");if(n){let i={value:n.key,done:!1};return n=n.next,i}else return{value:void 0,done:!0}}};return o}values(){let t=this,e=this._state,n=this._head,o={[Symbol.iterator](){return o},next(){if(t._state!==e)throw new Error("LinkedMap got modified during iteration.");if(n){let i={value:n.value,done:!1};return n=n.next,i}else return{value:void 0,done:!0}}};return o}entries(){let t=this,e=this._state,n=this._head,o={[Symbol.iterator](){return o},next(){if(t._state!==e)throw new Error("LinkedMap got modified during iteration.");if(n){let i={value:[n.key,n.value],done:!1};return n=n.next,i}else return{value:void 0,done:!0}}};return o}[(KN=Symbol.toStringTag,Symbol.iterator)](){return this.entries()}trimOld(t){if(t>=this.size)return;if(t===0){this.clear();return}let e=this._head,n=this.size;for(;e&&n>t;)this._map.delete(e.key),e=e.next,n--;this._head=e,this._size=n,e&&(e.previous=void 0),this._state++}trimNew(t){if(t>=this.size)return;if(t===0){this.clear();return}let e=this._tail,n=this.size;for(;e&&n>t;)this._map.delete(e.key),e=e.previous,n--;this._tail=e,this._size=n,e&&(e.next=void 0),this._state++}addItemFirst(t){if(!this._head&&!this._tail)this._tail=t;else if(this._head)t.next=this._head,this._head.previous=t;else throw new Error("Invalid list");this._head=t,this._state++}addItemLast(t){if(!this._head&&!this._tail)this._head=t;else if(this._tail)t.previous=this._tail,this._tail.next=t;else throw new Error("Invalid list");this._tail=t,this._state++}removeItem(t){if(t===this._head&&t===this._tail)this._head=void 0,this._tail=void 0;else if(t===this._head){if(!t.next)throw new Error("Invalid list");t.next.previous=void 0,this._head=t.next}else if(t===this._tail){if(!t.previous)throw new Error("Invalid list");t.previous.next=void 0,this._tail=t.previous}else{let e=t.next,n=t.previous;if(!e||!n)throw new Error("Invalid list");e.previous=n,n.next=e}t.next=void 0,t.previous=void 0,this._state++}touch(t,e){if(!this._head||!this._tail)throw new Error("Invalid list");if(!(e!==1&&e!==2)){if(e===1){if(t===this._head)return;let n=t.next,o=t.previous;t===this._tail?(o.next=void 0,this._tail=o):(n.previous=o,o.next=n),t.previous=void 0,t.next=this._head,this._head.previous=t,this._head=t,this._state++}else if(e===2){if(t===this._tail)return;let n=t.next,o=t.previous;t===this._head?(n.previous=void 0,this._head=n):(n.previous=o,o.next=n),t.next=void 0,t.previous=this._tail,this._tail.next=t,this._tail=t,this._state++}}}toJSON(){let t=[];return this.forEach((e,n)=>{t.push([n,e])}),t}fromJSON(t){this.clear();for(let[e,n]of t)this.set(e,n)}},OP=class extends LP{constructor(t,e=1){super(),this._limit=t,this._ratio=Math.min(Math.max(0,e),1)}get limit(){return this._limit}set limit(t){this._limit=t,this.checkTrim()}get ratio(){return this._ratio}set ratio(t){this._ratio=Math.min(Math.max(0,t),1),this.checkTrim()}get(t,e=2){return super.get(t,e)}peek(t){return super.get(t,0)}set(t,e){return super.set(t,e,2),this}checkTrim(){this.size>this._limit&&this.trim(Math.round(this._limit*this._ratio))}},$r=class extends OP{constructor(t,e=1){super(t,e)}trim(t){this.trimOld(t)}set(t,e){return super.set(t,e),this.checkTrim(),this}};var Vy=class{constructor(t){this._m1=new Map;this._m2=new Map;if(t)for(let[e,n]of t)this.set(e,n)}clear(){this._m1.clear(),this._m2.clear()}set(t,e){this._m1.set(t,e),this._m2.set(e,t)}get(t){return this._m1.get(t)}getKey(t){return this._m2.get(t)}delete(t){let e=this._m1.get(t);return e===void 0?!1:(this._m1.delete(t),this._m2.delete(e),!0)}forEach(t,e){this._m1.forEach((n,o)=>{t.call(e,n,o,this)})}keys(){return this._m1.keys()}values(){return this._m1.values()}},Ju=class{constructor(){this.map=new Map}add(t,e){let n=this.map.get(t);n||(n=new Set,this.map.set(t,n)),n.add(e)}delete(t,e){let n=this.map.get(t);n&&(n.delete(e),n.size===0&&this.map.delete(t))}forEach(t,e){let n=this.map.get(t);n&&n.forEach(e)}get(t){let e=this.map.get(t);return e||new Set}};function qn(r,t){if(!r)throw new Error(t?`Assertion failed (${t})`:"Assertion Failed")}function Yu(r,t="Unreachable"){throw new Error(t)}function Xu(r,t="unexpected state"){if(!r)throw typeof t=="string"?new Pt(`Assertion Failed: ${t}`):t}function ah(r){if(!r()){debugger;r(),ze(new Pt("Assertion Failed"))}}function De(r){return typeof r=="string"}function GN(r){return X$(r,De)}function X$(r,t){return Array.isArray(r)&&r.every(t)}function it(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)&&!(r instanceof RegExp)&&!(r instanceof Date)}function QN(r){let t=Object.getPrototypeOf(Uint8Array);return typeof r=="object"&&r instanceof t}function Un(r){return typeof r=="number"&&!isNaN(r)}function JN(r){return!!r&&typeof r[Symbol.iterator]=="function"}function By(r){return r===!0||r===!1}function Zu(r){return typeof r>"u"}function vo(r){return!Ot(r)}function Ot(r){return Zu(r)||r===null}function ep(r,t){if(!r)throw new Error(t?`Unexpected type, expected '${t}'`:"Unexpected type")}function pi(r){return Xu(r!=null,"Argument is `undefined` or `null`."),r}var Z$=Object.prototype.hasOwnProperty;function tp(r){if(!it(r))return!1;for(let t in r)if(Z$.call(r,t))return!1;return!0}function $y(r){return typeof r=="function"}function YN(r,t){let e=Math.min(r.length,t.length);for(let n=0;n<e;n++)UP(r[n],t[n])}function UP(r,t){if(De(t)){if(typeof r!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if($y(t)){try{if(r instanceof t)return}catch{}if(!Ot(r)&&r.constructor===t||t.length===1&&t.call(void 0,r)===!0)return;throw new Error("argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true")}}function so(r,t){for(let e in t)if(!(e in r))return!1;return!0}var Nt;(N=>{function r(B){return!!B&&typeof B=="object"&&typeof B[Symbol.iterator]=="function"}N.is=r;let t=Object.freeze([]);function e(){return t}N.empty=e;function*n(B){yield B}N.single=n;function o(B){return r(B)?B:n(B)}N.wrap=o;function i(B){return B??t}N.from=i;function*s(B){for(let G=B.length-1;G>=0;G--)yield B[G]}N.reverse=s;function a(B){return!B||B[Symbol.iterator]().next().done===!0}N.isEmpty=a;function l(B){return B[Symbol.iterator]().next().value}N.first=l;function d(B,G){let J=0;for(let Y of B)if(G(Y,J++))return!0;return!1}N.some=d;function c(B,G){let J=0;for(let Y of B)if(!G(Y,J++))return!1;return!0}N.every=c;function u(B,G){for(let J of B)if(G(J))return J}N.find=u;function*m(B,G){for(let J of B)G(J)&&(yield J)}N.filter=m;function*g(B,G){let J=0;for(let Y of B)yield G(Y,J++)}N.map=g;function*h(B,G){let J=0;for(let Y of B)yield*G(Y,J++)}N.flatMap=h;function*f(...B){for(let G of B)JN(G)?yield*G:yield G}N.concat=f;function I(B,G,J){let Y=J;for(let re of B)Y=G(Y,re);return Y}N.reduce=I;function S(B){let G=0;for(let J of B)G++;return G}N.length=S;function*T(B,G,J=B.length){for(G<-B.length&&(G=0),G<0&&(G+=B.length),J<0?J+=B.length:J>B.length&&(J=B.length);G<J;G++)yield B[G]}N.slice=T;function P(B,G=Number.POSITIVE_INFINITY){let J=[];if(G===0)return[J,B];let Y=B[Symbol.iterator]();for(let re=0;re<G;re++){let Pe=Y.next();if(Pe.done)return[J,N.empty()];J.push(Pe.value)}return[J,{[Symbol.iterator](){return Y}}]}N.consume=P;async function L(B){let G=[];for await(let J of B)G.push(J);return G}N.asyncToArray=L;async function q(B){let G=[];for await(let J of B)G=G.concat(J);return G}N.asyncToArrayFlat=q})(Nt||={});var ez=!1,jd=null;var XN=class r{constructor(){this.livingDisposables=new Map}static{this.idx=0}getDisposableData(t){let e=this.livingDisposables.get(t);return e||(e={parent:null,source:null,isSingleton:!1,value:t,idx:r.idx++},this.livingDisposables.set(t,e)),e}trackDisposable(t){let e=this.getDisposableData(t);e.source||(e.source=new Error().stack)}setParent(t,e){let n=this.getDisposableData(t);n.parent=e}markAsDisposed(t){this.livingDisposables.delete(t)}markAsSingleton(t){this.getDisposableData(t).isSingleton=!0}getRootParent(t,e){let n=e.get(t);if(n)return n;let o=t.parent?this.getRootParent(this.getDisposableData(t.parent),e):t;return e.set(t,o),o}getTrackedDisposables(){let t=new Map;return[...this.livingDisposables.entries()].filter(([,n])=>n.source!==null&&!this.getRootParent(n,t).isSingleton).flatMap(([n])=>n)}computeLeakingDisposables(t=10,e){let n;if(e)n=e;else{let l=new Map,d=[...this.livingDisposables.values()].filter(u=>u.source!==null&&!this.getRootParent(u,l).isSingleton);if(d.length===0)return;let c=new Set(d.map(u=>u.value));if(n=d.filter(u=>!(u.parent&&c.has(u.parent))),n.length===0)throw new Error("There are cyclic diposable chains!")}if(!n)return;function o(l){function d(u,m){for(;u.length>0&&m.some(g=>typeof g=="string"?g===u[0]:u[0].match(g));)u.shift()}let c=l.source.split(`
`).map(u=>u.trim().replace("at ","")).filter(u=>u!=="");return d(c,["Error",/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),c.reverse()}let i=new Ju;for(let l of n){let d=o(l);for(let c=0;c<=d.length;c++)i.add(d.slice(0,c).join(`
`),l)}n.sort(BN(l=>l.idx,$N));let s="",a=0;for(let l of n.slice(0,t)){a++;let d=o(l),c=[];for(let u=0;u<d.length;u++){let m=d[u];m=`(shared with ${i.get(d.slice(0,u+1).join(`
`)).size}/${n.length} leaks) at ${m}`;let h=i.get(d.slice(0,u).join(`
`)),f=ju([...h].map(I=>o(I)[u]),I=>I);delete f[d[u]];for(let[I,S]of Object.entries(f))S&&c.unshift(`    - stacktraces of ${S.length} other leaks continue with ${I}`);c.unshift(m)}s+=`


==================== Leaking disposable ${a}/${n.length}: ${l.value.constructor.name} ====================
${c.join(`
`)}
============================================================

`}return n.length>t&&(s+=`


... and ${n.length-t} more leaking disposables

`),{leaks:n,details:s}}};function tz(r){jd=r}if(ez){let r="__is_disposable_tracked__";tz(new class{trackDisposable(t){let e=new Error("Potentially leaked disposable").stack;setTimeout(()=>{t[r]||console.log(e)},3e3)}setParent(t,e){if(t&&t!==O.None)try{t[r]=!0}catch{}}markAsDisposed(t){if(t&&t!==O.None)try{t[r]=!0}catch{}}markAsSingleton(t){}})}function ol(r){return jd?.trackDisposable(r),r}function rl(r){jd?.markAsDisposed(r)}function Gd(r,t){jd?.setParent(r,t)}function nz(r,t){if(jd)for(let e of r)jd.setParent(e,t)}function lh(r){return jd?.markAsSingleton(r),r}function qy(r){return typeof r=="object"&&r!==null&&typeof r.dispose=="function"&&r.dispose.length===0}function Cn(r){if(Nt.is(r)){let t=[];for(let e of r)if(e)try{e.dispose()}catch(n){t.push(n)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(r)?[]:r}else if(r)return r.dispose(),r}function np(...r){let t=K(()=>Cn(r));return nz(r,t),t}var FP=class{constructor(t){this._isDisposed=!1,this._fn=t,ol(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,rl(this),this._fn()}}};function K(r){return new FP(r)}var $=class r{constructor(){this._toDispose=new Set;this._isDisposed=!1;ol(this)}static{this.DISABLE_DISPOSED_WARNING=!1}dispose(){this._isDisposed||(rl(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{Cn(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t||t===O.None)return t;if(t===this)throw new Error("Cannot register a disposable on itself!");return Gd(t,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(t),t}delete(t){if(t){if(t===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.delete(t)&&Gd(t,null)}assertNotDisposed(){this._isDisposed&&ze(new Pt("Object disposed"))}},O=class{constructor(){this._store=new $;ol(this),Gd(this._store,this)}static{this.None=Object.freeze({dispose(){}})}dispose(){rl(this),this._store.dispose()}_register(t){if(t===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(t)}},sn=class{constructor(){this._isDisposed=!1;ol(this)}get value(){return this._isDisposed?void 0:this._value}set value(t){this._isDisposed||t===this._value||(this._value?.dispose(),t&&Gd(t,this),this._value=t)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,rl(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let t=this._value;return this._value=void 0,t&&Gd(t,null),t}};var Fn=class{constructor(t=new Map){this._isDisposed=!1;this._store=t,ol(this)}dispose(){rl(this),this._isDisposed=!0,this.clearAndDisposeAll()}clearAndDisposeAll(){if(this._store.size)try{Cn(this._store.values())}finally{this._store.clear()}}has(t){return this._store.has(t)}get size(){return this._store.size}get(t){return this._store.get(t)}set(t,e,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(t)?.dispose(),this._store.set(t,e),Gd(e,this)}deleteAndDispose(t){this._store.get(t)?.dispose(),this._store.delete(t)}deleteAndLeak(t){let e=this._store.get(t);return e&&Gd(e,null),this._store.delete(t),e}keys(){return this._store.keys()}values(){return this._store.values()}[Symbol.iterator](){return this._store[Symbol.iterator]()}};function ZN(r,t){return r.then(e=>(t.isDisposed?e.dispose():t.add(e),e))}var zy=class extends Fn{constructor(){super(new Ke)}};var dn=class r{static{this.Undefined=new r(void 0)}constructor(t){this.element=t,this.next=r.Undefined,this.prev=r.Undefined}},ao=class{constructor(){this._first=dn.Undefined;this._last=dn.Undefined;this._size=0}get size(){return this._size}isEmpty(){return this._first===dn.Undefined}clear(){let t=this._first;for(;t!==dn.Undefined;){let e=t.next;t.prev=dn.Undefined,t.next=dn.Undefined,t=e}this._first=dn.Undefined,this._last=dn.Undefined,this._size=0}unshift(t){return this._insert(t,!1)}push(t){return this._insert(t,!0)}_insert(t,e){let n=new dn(t);if(this._first===dn.Undefined)this._first=n,this._last=n;else if(e){let i=this._last;this._last=n,n.prev=i,i.next=n}else{let i=this._first;this._first=n,n.next=i,i.prev=n}this._size+=1;let o=!1;return()=>{o||(o=!0,this._remove(n))}}shift(){if(this._first!==dn.Undefined){let t=this._first.element;return this._remove(this._first),t}}pop(){if(this._last!==dn.Undefined){let t=this._last.element;return this._remove(this._last),t}}peek(){if(this._last!==dn.Undefined)return this._last.element}_remove(t){if(t.prev!==dn.Undefined&&t.next!==dn.Undefined){let e=t.prev;e.next=t.next,t.next.prev=e}else t.prev===dn.Undefined&&t.next===dn.Undefined?(this._first=dn.Undefined,this._last=dn.Undefined):t.next===dn.Undefined?(this._last=this._last.prev,this._last.next=dn.Undefined):t.prev===dn.Undefined&&(this._first=this._first.next,this._first.prev=dn.Undefined);this._size-=1}*[Symbol.iterator](){let t=this._first;for(;t!==dn.Undefined;)yield t.element,t=t.next}};function oz(){return globalThis._VSCODE_NLS_MESSAGES}function HP(){return globalThis._VSCODE_NLS_LANGUAGE}var rz=HP()==="pseudo"||typeof document<"u"&&document.location&&typeof document.location.hash=="string"&&document.location.hash.indexOf("pseudo=true")>=0;function Ky(r,t){let e;return t.length===0?e=r:e=r.replace(/\{(\d+)\}/g,(n,o)=>{let i=o[0],s=t[i],a=n;return typeof s=="string"?a=s:(typeof s=="number"||typeof s=="boolean"||s===void 0||s===null)&&(a=String(s)),a}),rz&&(e="\uFF3B"+e.replace(/[aouei]/g,"$&$&")+"\uFF3D"),e}function p(r,t,...e){return Ky(typeof r=="number"?eU(r,t):t,e)}function eU(r,t){let e=oz()?.[r];if(typeof e!="string"){if(typeof t=="string")return t;throw new Error(`!!! NLS MISSING: ${r} !!!`)}return e}function Qd(r,t,...e){let n;typeof r=="number"?n=eU(r,t):n=t;let o=Ky(n,e);return{value:o,original:t===n?o:Ky(t,e)}}var es="en",ch=!1,uh=!1,dh=!1,iz=!1,rU=!1,WP=!1,sz=!1,VP=!1,iU=!1,sU=!1,jy,Gy=es,tU=es,az,Xs,Zs=globalThis,ar;typeof Zs.vscode<"u"&&typeof Zs.vscode.process<"u"?ar=Zs.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(ar=process);var aU=typeof ar?.versions?.electron=="string",lz=aU&&ar?.type==="renderer";if(typeof ar=="object"){ch=ar.platform==="win32",uh=ar.platform==="darwin",dh=ar.platform==="linux",iz=dh&&!!ar.env.SNAP&&!!ar.env.SNAP_REVISION,sz=aU,iU=!!ar.env.CI||!!ar.env.BUILD_ARTIFACTSTAGINGDIRECTORY||!!ar.env.GITHUB_WORKSPACE,jy=es,Gy=es;let r=ar.env.VSCODE_NLS_CONFIG;if(r)try{let t=JSON.parse(r);jy=t.userLocale,tU=t.osLocale,Gy=t.resolvedLanguage||es,az=t.languagePack?.translationsConfigFile}catch{}rU=!0}else typeof navigator=="object"&&!lz?(Xs=navigator.userAgent,ch=Xs.indexOf("Windows")>=0,uh=Xs.indexOf("Macintosh")>=0,VP=(Xs.indexOf("Macintosh")>=0||Xs.indexOf("iPad")>=0||Xs.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,dh=Xs.indexOf("Linux")>=0,sU=Xs?.indexOf("Mobi")>=0,WP=!0,Gy=HP()||es,jy=navigator.language.toLowerCase(),tU=jy):console.error("Unable to resolve platform.");function BP(r){switch(r){case 0:return"Web";case 1:return"Mac";case 2:return"Linux";case 3:return"Windows"}}var Qy=0;uh?Qy=1:ch?Qy=3:dh&&(Qy=2);var Ie=ch,pt=uh,Qe=dh;var Jy=rU;var Pr=WP,dz=WP&&typeof Zs.importScripts=="function",lU=dz?Zs.origin:void 0,dU=VP,cU=sU,sl=iU,Yy=Qy,ts=Xs,il=Gy,cz;(n=>{function r(){return il}n.value=r;function t(){return il.length===2?il==="en":il.length>=3?il[0]==="e"&&il[1]==="n"&&il[2]==="-":!1}n.isDefaultVariant=t;function e(){return il==="en"}n.isDefault=e})(cz||={});var uz=typeof Zs.postMessage=="function"&&!Zs.importScripts,Xy=(()=>{if(uz){let r=[];Zs.addEventListener("message",e=>{if(e.data&&e.data.vscodeScheduleAsyncWork)for(let n=0,o=r.length;n<o;n++){let i=r[n];if(i.id===e.data.vscodeScheduleAsyncWork){r.splice(n,1),i.callback();return}}});let t=0;return e=>{let n=++t;r.push({id:n,callback:e}),Zs.postMessage({vscodeScheduleAsyncWork:n},"*")}}return r=>setTimeout(r)})();var lr=uh||VP?2:ch?1:3,nU=!0,oU=!1;function Zy(){if(!oU){oU=!0;let r=new Uint8Array(2);r[0]=1,r[1]=2,nU=new Uint16Array(r.buffer)[0]===513}return nU}var ph=!!(ts&&ts.indexOf("Chrome")>=0),uU=!!(ts&&ts.indexOf("Firefox")>=0),pU=!!(!ph&&ts&&ts.indexOf("Safari")>=0),eI=!!(ts&&ts.indexOf("Edg/")>=0),UY=!!(ts&&ts.indexOf("Android")>=0);var Jd,$P=globalThis.vscode;if(typeof $P<"u"&&typeof $P.process<"u"){let r=$P.process;Jd={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"?Jd={get platform(){return process.platform},get arch(){return process.arch},get env(){return process.env},cwd(){return process.env.VSCODE_CWD||process.cwd()}}:Jd={get platform(){return Ie?"win32":pt?"darwin":"linux"},get arch(){},get env(){return{}},cwd(){return"/"}};var mi=Jd.cwd,Do=Jd.env,zP=Jd.platform,pz=Jd.arch;var mz=globalThis.performance.now.bind(globalThis.performance),an=class r{static create(t){return new r(t)}constructor(t){this._now=t===!1?Date.now:mz,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 mU=!1,gz=!1,fz=100,gU=6e4;function fU(){return!!Do.VSCODE_DEV}var he;(rt=>{rt.None=()=>O.None;function t(ne){if(gz){let{onDidAddListener:ee}=ne,te=rp.create(),X=0;ne.onDidAddListener=()=>{++X===2&&(console.warn("snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here"),te.print()),ee?.()}}}function e(ne,ee,te){return g(ne,()=>{},0,void 0,ee??!0,void 0,te)}rt.defer=e;function n(ne){return(ee,te=null,X)=>{let de=!1,ge;return ge=ne(Le=>{if(!de)return ge?ge.dispose():de=!0,ee.call(te,Le)},null,X),de&&ge.dispose(),ge}}rt.once=n;function o(ne,ee){return rt.once(rt.filter(ne,ee))}rt.onceIf=o;function i(ne,ee,te){return u((X,de=null,ge)=>ne(Le=>X.call(de,ee(Le)),null,ge),te)}rt.map=i;function s(ne,ee,te){return u((X,de=null,ge)=>ne(Le=>{ee(Le),X.call(de,Le)},null,ge),te)}rt.forEach=s;function a(ne,ee,te){return u((X,de=null,ge)=>ne(Le=>ee(Le)&&X.call(de,Le),null,ge),te)}rt.filter=a;function l(ne){return ne}rt.signal=l;function d(...ne){return(ee,te=null,X)=>{let de=np(...ne.map(ge=>ge(Le=>ee.call(te,Le))));return m(de,X)}}rt.any=d;function c(ne,ee,te,X){let de=te;return i(ne,ge=>(de=ee(de,ge),de),X)}rt.reduce=c;function u(ne,ee){let te,X={onWillAddFirstListener(){te=ne(de.fire,de)},onDidRemoveLastListener(){te?.dispose()}};ee||t(X);let de=new E(X);return ee?.add(de),de.event}function m(ne,ee){return ee instanceof Array?ee.push(ne):ee&&ee.add(ne),ne}function g(ne,ee,te=100,X=!1,de=!1,ge,Le){let gt,Ue,wt,Ht=0,je,_n={leakWarningThreshold:ge,onWillAddFirstListener(){gt=ne(Qi=>{Ht++,Ue=ee(Ue,Qi),X&&!wt&&(_o.fire(Ue),Ue=void 0),je=()=>{let Qa=Ue;Ue=void 0,wt=void 0,(!X||Ht>1)&&_o.fire(Qa),Ht=0},typeof te=="number"?(wt&&clearTimeout(wt),wt=setTimeout(je,te)):wt===void 0&&(wt=null,queueMicrotask(je))})},onWillRemoveListener(){de&&Ht>0&&je?.()},onDidRemoveLastListener(){je=void 0,gt.dispose()}};Le||t(_n);let _o=new E(_n);return Le?.add(_o),_o.event}rt.debounce=g;function h(ne,ee=0,te,X){return rt.debounce(ne,(de,ge)=>de?(de.push(ge),de):[ge],ee,void 0,te??!0,void 0,X)}rt.accumulate=h;function f(ne,ee,te=100,X=!0,de=!0,ge,Le){let gt,Ue,wt,Ht=0,je={leakWarningThreshold:ge,onWillAddFirstListener(){gt=ne(_o=>{Ht++,Ue=ee(Ue,_o),wt===void 0&&(X&&(_n.fire(Ue),Ue=void 0,Ht=0),typeof te=="number"?wt=setTimeout(()=>{de&&Ht>0&&_n.fire(Ue),Ue=void 0,wt=void 0,Ht=0},te):(wt=0,queueMicrotask(()=>{de&&Ht>0&&_n.fire(Ue),Ue=void 0,wt=void 0,Ht=0})))})},onDidRemoveLastListener(){gt.dispose()}};Le||t(je);let _n=new E(je);return Le?.add(_n),_n.event}rt.throttle=f;function I(ne,ee=(X,de)=>X===de,te){let X=!0,de;return a(ne,ge=>{let Le=X||!ee(ge,de);return X=!1,de=ge,Le},te)}rt.latch=I;function S(ne,ee,te){return[rt.filter(ne,ee,te),rt.filter(ne,X=>!ee(X),te)]}rt.split=S;function T(ne,ee,te=!1,X=[],de){let ge=X.slice(),Le;fU()&&(Le={stack:rp.create(),timerId:setTimeout(()=>{ge&&ge.length>0&&Le&&!Le.warned&&(Le.warned=!0,console.warn(`[Event.buffer][${ee}] potential LEAK detected: ${ge.length} events buffered for ${gU/1e3}s without being consumed. Buffered here:`),Le.stack.print())},gU),warned:!1},de&&de.add(K(()=>clearTimeout(Le.timerId))));let gt=()=>{Le&&clearTimeout(Le.timerId)},Ue=ne(je=>{ge?(ge.push(je),fU()&&Le&&!Le.warned&&ge.length>=fz&&(Le.warned=!0,console.warn(`[Event.buffer][${ee}] potential LEAK detected: ${ge.length} events buffered without being consumed. Buffered here:`),Le.stack.print())):Ht.fire(je)});de&&de.add(Ue);let wt=()=>{ge?.forEach(je=>Ht.fire(je)),ge=null,gt()},Ht=new E({onWillAddFirstListener(){Ue||(Ue=ne(je=>Ht.fire(je)),de&&de.add(Ue))},onDidAddFirstListener(){ge&&(te?setTimeout(wt):wt())},onDidRemoveLastListener(){Ue&&Ue.dispose(),Ue=null,gt()}});return de&&de.add(Ht),Ht.event}rt.buffer=T;function P(ne,ee){return(X,de,ge)=>{let Le=ee(new q);return ne(function(gt){let Ue=Le.evaluate(gt);Ue!==L&&X.call(de,Ue)},void 0,ge)}}rt.chain=P;let L=Symbol("HaltChainable");class q{constructor(){this.steps=[]}map(ee){return this.steps.push(ee),this}forEach(ee){return this.steps.push(te=>(ee(te),te)),this}filter(ee){return this.steps.push(te=>ee(te)?te:L),this}reduce(ee,te){let X=te;return this.steps.push(de=>(X=ee(X,de),X)),this}latch(ee=(te,X)=>te===X){let te=!0,X;return this.steps.push(de=>{let ge=te||!ee(de,X);return te=!1,X=de,ge?de:L}),this}evaluate(ee){for(let te of this.steps)if(ee=te(ee),ee===L)break;return ee}}function N(ne,ee,te=X=>X){let X=(...gt)=>Le.fire(te(...gt)),de=()=>ne.on(ee,X),ge=()=>ne.removeListener(ee,X),Le=new E({onWillAddFirstListener:de,onDidRemoveLastListener:ge});return Le.event}rt.fromNodeEventEmitter=N;function B(ne,ee,te=X=>X){let X=(...gt)=>Le.fire(te(...gt)),de=()=>ne.addEventListener(ee,X),ge=()=>ne.removeEventListener(ee,X),Le=new E({onWillAddFirstListener:de,onDidRemoveLastListener:ge});return Le.event}rt.fromDOMEventEmitter=B;function G(ne,ee){let te,X,de=new Promise(ge=>{X=n(ne)(ge),JP(X,ee),te=()=>{vU(X,ee)}});return de.cancel=te,ee&&de.finally(()=>vU(X,ee)),de}rt.toPromise=G;function J(ne,ee){return ne(te=>ee.fire(te))}rt.forward=J;function Y(ne,ee,te){return ee(te),ne(X=>ee(X))}rt.runAndSubscribe=Y;class re{constructor(ee,te){this._observable=ee;this._counter=0;this._hasChanged=!1;let X={onWillAddFirstListener:()=>{ee.addObserver(this),this._observable.reportChanges()},onDidRemoveLastListener:()=>{ee.removeObserver(this)}};te||t(X),this.emitter=new E(X),te&&te.add(this.emitter)}beginUpdate(ee){this._counter++}handlePossibleChange(ee){}handleChange(ee,te){this._hasChanged=!0}endUpdate(ee){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function Pe(ne,ee){return new re(ne,ee).emitter.event}rt.fromObservable=Pe;function ot(ne){return(ee,te,X)=>{let de=0,ge=!1,Le={beginUpdate(){de++},endUpdate(){de--,de===0&&(ne.reportChanges(),ge&&(ge=!1,ee.call(te)))},handlePossibleChange(){},handleChange(){ge=!0}};ne.addObserver(Le),ne.reportChanges();let gt={dispose(){ne.removeObserver(Le)}};return JP(gt,X),gt}}rt.fromObservableLight=ot})(he||={});var qP=class r{constructor(t){this.listenerCount=0;this.invocationCount=0;this.elapsedOverall=0;this.durations=[];this.name=`${t}_${r._idPool++}`,r.all.add(this)}static{this.all=new Set}static{this._idPool=0}start(t){this._stopWatch=new an,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}},hU=-1;var KP=class r{constructor(t,e,n=(r._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t;this.threshold=e;this.name=n;this._warnCountdown=0}static{this._idPool=1}dispose(){this._stacks?.clear()}check(t,e){let n=this.threshold;if(n<=0||e<n)return;this._stacks||(this._stacks=new Map);let o=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,o+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=n*.5;let[i,s]=this.getMostFrequentStack(),a=`[${this.name}] potential listener LEAK detected, having ${e} listeners already. MOST frequent listener (${s}):`;console.warn(a),console.warn(i);let l=s/e>.3?"dominated":"popular",d=new jP(l,a,i);this._errorHandler(d)}return()=>{let i=this._stacks.get(t.value)||0;this._stacks.set(t.value,i-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,e=0;for(let[n,o]of this._stacks)(!t||e<o)&&(t=[n,o],e=o);return t}},rp=class r{constructor(t){this.value=t}static create(){let t=new Error;return new r(t.stack??"")}print(){console.warn(this.value.split(`
`).slice(2).join(`
`))}},jP=class extends Error{constructor(t,e,n){super(`potential listener LEAK detected, ${t}`),this.name="ListenerLeakError",this.details=e,this.stack=n}},GP=class extends Error{constructor(t,e,n){super(`potential listener LEAK detected, ${t} (REFUSED to add)`),this.name="ListenerRefusalError",this.details=e,this.stack=n}},hz=0,op=class{constructor(t){this.value=t;this.id=hz++}},vz=2,bU=(r,t)=>{if(r instanceof op)t(r);else for(let e=0;e<r.length;e++){let n=r[e];n&&t(n)}},E=class{constructor(t){this._size=0;this._options=t,this._leakageMon=hU>0||this._options?.leakWarningThreshold?new KP(t?.onListenerError??ze,this._options?.leakWarningThreshold??hU):void 0,this._perfMon=this._options?._profName?new qP(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){if(!this._disposed){if(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners){if(mU){let t=this._listeners;queueMicrotask(()=>{bU(t,e=>e.stack?.print())})}this._listeners=void 0,this._size=0}this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose()}}get event(){return this._event??=(t,e,n)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let l=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(l);let d=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],c=d[1]/this._size>.3?"dominated":"popular",u=new GP(c,`${l}. HINT: Stack shows most frequent listener (${d[1]}-times)`,d[0]);return(this._options?.onListenerError||ze)(u),O.None}if(this._disposed)return O.None;e&&(t=t.bind(e));let o=new op(t),i,s;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(o.stack=rp.create(),i=this._leakageMon.check(o.stack,this._size+1)),mU&&(o.stack=s??rp.create()),this._listeners?this._listeners instanceof op?(this._deliveryQueue??=new QP,this._listeners=[this._listeners,o]):this._listeners.push(o):(this._options?.onWillAddFirstListener?.(this),this._listeners=o,this._options?.onDidAddFirstListener?.(this)),this._options?.onDidAddListener?.(this),this._size++;let a=K(()=>{i?.(),this._removeListener(o)});return JP(a,n),a},this._event}_removeListener(t){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 e=this._listeners,n=e.indexOf(t);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--,e[n]=void 0;let o=this._deliveryQueue.current===this;if(this._size*vz<=e.length){let i=0;for(let s=0;s<e.length;s++)e[s]?e[i++]=e[s]:o&&i<this._deliveryQueue.end&&(this._deliveryQueue.end--,i<this._deliveryQueue.i&&this._deliveryQueue.i--);e.length=i}}_deliver(t,e){if(!t)return;let n=this._options?.onListenerError||ze;if(!n){t.value(e);return}try{t.value(e)}catch(o){n(o)}}_deliverQueue(t){let e=t.current._listeners;for(;t.i<t.end;)this._deliver(e[t.i++],t.value);t.reset()}fire(t){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof op)this._deliver(this._listeners,t);else{let e=this._deliveryQueue;e.enqueue(this,t,this._listeners.length),this._deliverQueue(e)}this._perfMon?.stop()}hasListeners(){return this._size>0}};var QP=class{constructor(){this.i=-1;this.end=0}enqueue(t,e,n){this.i=0,this.end=n,this.current=t,this.value=e}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},ns=class extends E{async fireAsync(t,e,n){if(this._listeners)for(this._asyncDeliveryQueue||(this._asyncDeliveryQueue=new ao),bU(this._listeners,o=>this._asyncDeliveryQueue.push([o.value,t]));this._asyncDeliveryQueue.size>0&&!e.isCancellationRequested;){let[o,i]=this._asyncDeliveryQueue.shift(),s=[],a={...i,token:e,waitUntil:l=>{if(Object.isFrozen(s))throw new Error("waitUntil can NOT be called asynchronous");n&&(l=n(l,o)),s.push(l)}};try{o(a)}catch(l){ze(l);continue}Object.freeze(s),await Promise.allSettled(s).then(l=>{for(let d of l)d.status==="rejected"&&ze(d.reason)})}}},os=class extends E{constructor(e){super(e);this._isPaused=0;this._eventQueue=new ao;this._mergeFn=e?.merge}get isPaused(){return this._isPaused!==0}pause(){this._isPaused++}resume(){if(this._isPaused!==0&&--this._isPaused===0)if(this._mergeFn){if(this._eventQueue.size>0){let e=Array.from(this._eventQueue);this._eventQueue.clear(),super.fire(this._mergeFn(e))}}else for(;!this._isPaused&&this._eventQueue.size!==0;)super.fire(this._eventQueue.shift())}fire(e){this._size&&(this._isPaused!==0?this._eventQueue.push(e):super.fire(e))}},nI=class extends os{constructor(t){super(t),this._delay=t.delay??100}fire(t){this._handle||(this.pause(),this._handle=setTimeout(()=>{this._handle=void 0,this.resume()},this._delay)),super.fire(t)}},oI=class extends E{constructor(e){super(e);this._queuedEvents=[];this._mergeFn=e?.merge}fire(e){this.hasListeners()&&(this._queuedEvents.push(e),this._queuedEvents.length===1&&queueMicrotask(()=>{this._mergeFn?super.fire(this._mergeFn(this._queuedEvents)):this._queuedEvents.forEach(n=>super.fire(n)),this._queuedEvents=[]}))}};var rI=class{constructor(){this.listening=!1;this.inputEvent=he.None;this.inputEventListener=O.None;this.emitter=new E({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(t){this.inputEvent=t,this.listening&&(this.inputEventListener.dispose(),this.inputEventListener=t(this.emitter.fire,this.emitter))}dispose(){this.inputEventListener.dispose(),this.emitter.dispose()}};function JP(r,t){t instanceof $?t.add(r):Array.isArray(t)&&t.push(r)}function vU(r,t){if(t instanceof $)t.delete(r);else if(Array.isArray(t)){let e=t.indexOf(r);e!==-1&&t.splice(e,1)}r.dispose()}var yU=Object.freeze(function(r,t){let e=setTimeout(r.bind(t),0);return{dispose(){clearTimeout(e)}}}),ve;(n=>{function r(o){return o===n.None||o===n.Cancelled||o instanceof ip?!0:!o||typeof o!="object"?!1:typeof o.isCancellationRequested=="boolean"&&typeof o.onCancellationRequested=="function"}n.isCancellationToken=r,n.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:he.None}),n.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:yU})})(ve||={});var ip=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?yU:(this._emitter||(this._emitter=new E),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Ce=class{constructor(t){this._token=void 0;this._parentListener=void 0;this._parentListener=t&&t.onCancellationRequested(this.cancel,this)}get token(){return this._token||(this._token=new ip),this._token}cancel(){this._token?this._token instanceof ip&&this._token.cancel():this._token=ve.Cancelled}dispose(t=!1){t&&this.cancel(),this._parentListener?.dispose(),this._token?this._token instanceof ip&&this._token.dispose():this._token=ve.None}};var bz=65,yz=97,Iz=90,xz=122,Yd=46,lo=47,cr=92,ea=58,Sz=63,iI=class extends Error{constructor(t,e,n){let o;typeof e=="string"&&e.indexOf("not ")===0?(o="must not be",e=e.replace(/^not /,"")):o="must be";let i=t.indexOf(".")!==-1?"property":"argument",s=`The "${t}" ${i} ${o} of type ${e}`;s+=`. Received type ${typeof n}`,super(s),this.code="ERR_INVALID_ARG_TYPE"}};function Cz(r,t){if(r===null||typeof r!="object")throw new iI(t,"Object",r)}function Rn(r,t){if(typeof r!="string")throw new iI(t,"string",r)}var ur=zP==="win32";function lt(r){return r===lo||r===cr}function YP(r){return r===lo}function ta(r){return r>=bz&&r<=Iz||r>=yz&&r<=xz}function sI(r,t,e,n){let o="",i=0,s=-1,a=0,l=0;for(let d=0;d<=r.length;++d){if(d<r.length)l=r.charCodeAt(d);else{if(n(l))break;l=lo}if(n(l)){if(!(s===d-1||a===1))if(a===2){if(o.length<2||i!==2||o.charCodeAt(o.length-1)!==Yd||o.charCodeAt(o.length-2)!==Yd){if(o.length>2){let c=o.lastIndexOf(e);c===-1?(o="",i=0):(o=o.slice(0,c),i=o.length-1-o.lastIndexOf(e)),s=d,a=0;continue}else if(o.length!==0){o="",i=0,s=d,a=0;continue}}t&&(o+=o.length>0?`${e}..`:"..",i=2)}else o.length>0?o+=`${e}${r.slice(s+1,d)}`:o=r.slice(s+1,d),i=d-s-1;s=d,a=0}else l===Yd&&a!==-1?++a:a=-1}return o}function Tz(r){return r?`${r[0]==="."?"":"."}${r}`:""}function IU(r,t){Cz(t,"pathObject");let e=t.dir||t.root,n=t.base||`${t.name||""}${Tz(t.ext)}`;return e?e===t.root?`${e}${n}`:`${e}${r}${n}`:n}var fn={resolve(...r){let t="",e="",n=!1;for(let o=r.length-1;o>=-1;o--){let i;if(o>=0){if(i=r[o],Rn(i,`paths[${o}]`),i.length===0)continue}else t.length===0?i=mi():(i=Do[`=${t}`]||mi(),(i===void 0||i.slice(0,2).toLowerCase()!==t.toLowerCase()&&i.charCodeAt(2)===cr)&&(i=`${t}\\`));let s=i.length,a=0,l="",d=!1,c=i.charCodeAt(0);if(s===1)lt(c)&&(a=1,d=!0);else if(lt(c))if(d=!0,lt(i.charCodeAt(1))){let u=2,m=u;for(;u<s&&!lt(i.charCodeAt(u));)u++;if(u<s&&u!==m){let g=i.slice(m,u);for(m=u;u<s&&lt(i.charCodeAt(u));)u++;if(u<s&&u!==m){for(m=u;u<s&&!lt(i.charCodeAt(u));)u++;(u===s||u!==m)&&(l=`\\\\${g}\\${i.slice(m,u)}`,a=u)}}}else a=1;else ta(c)&&i.charCodeAt(1)===ea&&(l=i.slice(0,2),a=2,s>2&&lt(i.charCodeAt(2))&&(d=!0,a=3));if(l.length>0)if(t.length>0){if(l.toLowerCase()!==t.toLowerCase())continue}else t=l;if(n){if(t.length>0)break}else if(e=`${i.slice(a)}\\${e}`,n=d,d&&t.length>0)break}return e=sI(e,!n,"\\",lt),n?`${t}\\${e}`:`${t}${e}`||"."},normalize(r){Rn(r,"path");let t=r.length;if(t===0)return".";let e=0,n,o=!1,i=r.charCodeAt(0);if(t===1)return YP(i)?"\\":r;if(lt(i))if(o=!0,lt(r.charCodeAt(1))){let a=2,l=a;for(;a<t&&!lt(r.charCodeAt(a));)a++;if(a<t&&a!==l){let d=r.slice(l,a);for(l=a;a<t&&lt(r.charCodeAt(a));)a++;if(a<t&&a!==l){for(l=a;a<t&&!lt(r.charCodeAt(a));)a++;if(a===t)return`\\\\${d}\\${r.slice(l)}\\`;a!==l&&(n=`\\\\${d}\\${r.slice(l,a)}`,e=a)}}}else e=1;else ta(i)&&r.charCodeAt(1)===ea&&(n=r.slice(0,2),e=2,t>2&&lt(r.charCodeAt(2))&&(o=!0,e=3));let s=e<t?sI(r.slice(e),!o,"\\",lt):"";if(s.length===0&&!o&&(s="."),s.length>0&&lt(r.charCodeAt(t-1))&&(s+="\\"),!o&&n===void 0&&r.includes(":")){if(s.length>=2&&ta(s.charCodeAt(0))&&s.charCodeAt(1)===ea)return`.\\${s}`;let a=r.indexOf(":");do if(a===t-1||lt(r.charCodeAt(a+1)))return`.\\${s}`;while((a=r.indexOf(":",a+1))!==-1)}return n===void 0?o?`\\${s}`:s:o?`${n}\\${s}`:`${n}${s}`},isAbsolute(r){Rn(r,"path");let t=r.length;if(t===0)return!1;let e=r.charCodeAt(0);return lt(e)||t>2&&ta(e)&&r.charCodeAt(1)===ea&&lt(r.charCodeAt(2))},join(...r){if(r.length===0)return".";let t,e;for(let i=0;i<r.length;++i){let s=r[i];Rn(s,"path"),s.length>0&&(t===void 0?t=e=s:t+=`\\${s}`)}if(t===void 0)return".";let n=!0,o=0;if(typeof e=="string"&&lt(e.charCodeAt(0))){++o;let i=e.length;i>1&&lt(e.charCodeAt(1))&&(++o,i>2&&(lt(e.charCodeAt(2))?++o:n=!1))}if(n){for(;o<t.length&&lt(t.charCodeAt(o));)o++;o>=2&&(t=`\\${t.slice(o)}`)}return fn.normalize(t)},relative(r,t){if(Rn(r,"from"),Rn(t,"to"),r===t)return"";let e=fn.resolve(r),n=fn.resolve(t);if(e===n||(r=e.toLowerCase(),t=n.toLowerCase(),r===t))return"";if(e.length!==r.length||n.length!==t.length){let h=e.split("\\"),f=n.split("\\");h[h.length-1]===""&&h.pop(),f[f.length-1]===""&&f.pop();let I=h.length,S=f.length,T=I<S?I:S,P;for(P=0;P<T&&h[P].toLowerCase()===f[P].toLowerCase();P++);return P===0?n:P===T?S>T?f.slice(P).join("\\"):I>T?"..\\".repeat(I-1-P)+"..":"":"..\\".repeat(I-P)+f.slice(P).join("\\")}let o=0;for(;o<r.length&&r.charCodeAt(o)===cr;)o++;let i=r.length;for(;i-1>o&&r.charCodeAt(i-1)===cr;)i--;let s=i-o,a=0;for(;a<t.length&&t.charCodeAt(a)===cr;)a++;let l=t.length;for(;l-1>a&&t.charCodeAt(l-1)===cr;)l--;let d=l-a,c=s<d?s:d,u=-1,m=0;for(;m<c;m++){let h=r.charCodeAt(o+m);if(h!==t.charCodeAt(a+m))break;h===cr&&(u=m)}if(m!==c){if(u===-1)return n}else{if(d>c){if(t.charCodeAt(a+m)===cr)return n.slice(a+m+1);if(m===2)return n.slice(a+m)}s>c&&(r.charCodeAt(o+m)===cr?u=m:m===2&&(u=3)),u===-1&&(u=0)}let g="";for(m=o+u+1;m<=i;++m)(m===i||r.charCodeAt(m)===cr)&&(g+=g.length===0?"..":"\\..");return a+=u,g.length>0?`${g}${n.slice(a,l)}`:(n.charCodeAt(a)===cr&&++a,n.slice(a,l))},toNamespacedPath(r){if(typeof r!="string"||r.length===0)return r;let t=fn.resolve(r);if(t.length<=2)return r;if(t.charCodeAt(0)===cr){if(t.charCodeAt(1)===cr){let e=t.charCodeAt(2);if(e!==Sz&&e!==Yd)return`\\\\?\\UNC\\${t.slice(2)}`}}else if(ta(t.charCodeAt(0))&&t.charCodeAt(1)===ea&&t.charCodeAt(2)===cr)return`\\\\?\\${t}`;return t},dirname(r){Rn(r,"path");let t=r.length;if(t===0)return".";let e=-1,n=0,o=r.charCodeAt(0);if(t===1)return lt(o)?r:".";if(lt(o)){if(e=n=1,lt(r.charCodeAt(1))){let a=2,l=a;for(;a<t&&!lt(r.charCodeAt(a));)a++;if(a<t&&a!==l){for(l=a;a<t&&lt(r.charCodeAt(a));)a++;if(a<t&&a!==l){for(l=a;a<t&&!lt(r.charCodeAt(a));)a++;if(a===t)return r;a!==l&&(e=n=a+1)}}}}else ta(o)&&r.charCodeAt(1)===ea&&(e=t>2&&lt(r.charCodeAt(2))?3:2,n=e);let i=-1,s=!0;for(let a=t-1;a>=n;--a)if(lt(r.charCodeAt(a))){if(!s){i=a;break}}else s=!1;if(i===-1){if(e===-1)return".";i=e}return r.slice(0,i)},basename(r,t){t!==void 0&&Rn(t,"suffix"),Rn(r,"path");let e=0,n=-1,o=!0,i;if(r.length>=2&&ta(r.charCodeAt(0))&&r.charCodeAt(1)===ea&&(e=2),t!==void 0&&t.length>0&&t.length<=r.length){if(t===r)return"";let s=t.length-1,a=-1;for(i=r.length-1;i>=e;--i){let l=r.charCodeAt(i);if(lt(l)){if(!o){e=i+1;break}}else a===-1&&(o=!1,a=i+1),s>=0&&(l===t.charCodeAt(s)?--s===-1&&(n=i):(s=-1,n=a))}return e===n?n=a:n===-1&&(n=r.length),r.slice(e,n)}for(i=r.length-1;i>=e;--i)if(lt(r.charCodeAt(i))){if(!o){e=i+1;break}}else n===-1&&(o=!1,n=i+1);return n===-1?"":r.slice(e,n)},extname(r){Rn(r,"path");let t=0,e=-1,n=0,o=-1,i=!0,s=0;r.length>=2&&r.charCodeAt(1)===ea&&ta(r.charCodeAt(0))&&(t=n=2);for(let a=r.length-1;a>=t;--a){let l=r.charCodeAt(a);if(lt(l)){if(!i){n=a+1;break}continue}o===-1&&(i=!1,o=a+1),l===Yd?e===-1?e=a:s!==1&&(s=1):e!==-1&&(s=-1)}return e===-1||o===-1||s===0||s===1&&e===o-1&&e===n+1?"":r.slice(e,o)},format:IU.bind(null,"\\"),parse(r){Rn(r,"path");let t={root:"",dir:"",base:"",ext:"",name:""};if(r.length===0)return t;let e=r.length,n=0,o=r.charCodeAt(0);if(e===1)return lt(o)?(t.root=t.dir=r,t):(t.base=t.name=r,t);if(lt(o)){if(n=1,lt(r.charCodeAt(1))){let u=2,m=u;for(;u<e&&!lt(r.charCodeAt(u));)u++;if(u<e&&u!==m){for(m=u;u<e&&lt(r.charCodeAt(u));)u++;if(u<e&&u!==m){for(m=u;u<e&&!lt(r.charCodeAt(u));)u++;u===e?n=u:u!==m&&(n=u+1)}}}}else if(ta(o)&&r.charCodeAt(1)===ea){if(e<=2)return t.root=t.dir=r,t;if(n=2,lt(r.charCodeAt(2))){if(e===3)return t.root=t.dir=r,t;n=3}}n>0&&(t.root=r.slice(0,n));let i=-1,s=n,a=-1,l=!0,d=r.length-1,c=0;for(;d>=n;--d){if(o=r.charCodeAt(d),lt(o)){if(!l){s=d+1;break}continue}a===-1&&(l=!1,a=d+1),o===Yd?i===-1?i=d:c!==1&&(c=1):i!==-1&&(c=-1)}return a!==-1&&(i===-1||c===0||c===1&&i===a-1&&i===s+1?t.base=t.name=r.slice(s,a):(t.name=r.slice(s,i),t.base=r.slice(s,a),t.ext=r.slice(i,a))),s>0&&s!==n?t.dir=r.slice(0,s-1):t.dir=t.root,t},sep:"\\",delimiter:";",win32:null,posix:null},Ez=(()=>{if(ur){let r=/\\/g;return()=>{let t=mi().replace(r,"/");return t.slice(t.indexOf("/"))}}return()=>mi()})(),Ge={resolve(...r){let t="",e=!1;for(let n=r.length-1;n>=0&&!e;n--){let o=r[n];Rn(o,`paths[${n}]`),o.length!==0&&(t=`${o}/${t}`,e=o.charCodeAt(0)===lo)}if(!e){let n=Ez();t=`${n}/${t}`,e=n.charCodeAt(0)===lo}return t=sI(t,!e,"/",YP),e?`/${t}`:t.length>0?t:"."},normalize(r){if(Rn(r,"path"),r.length===0)return".";let t=r.charCodeAt(0)===lo,e=r.charCodeAt(r.length-1)===lo;return r=sI(r,!t,"/",YP),r.length===0?t?"/":e?"./":".":(e&&(r+="/"),t?`/${r}`:r)},isAbsolute(r){return Rn(r,"path"),r.length>0&&r.charCodeAt(0)===lo},join(...r){if(r.length===0)return".";let t=[];for(let e=0;e<r.length;++e){let n=r[e];Rn(n,"path"),n.length>0&&t.push(n)}return t.length===0?".":Ge.normalize(t.join("/"))},relative(r,t){if(Rn(r,"from"),Rn(t,"to"),r===t||(r=Ge.resolve(r),t=Ge.resolve(t),r===t))return"";let e=1,n=r.length,o=n-e,i=1,s=t.length-i,a=o<s?o:s,l=-1,d=0;for(;d<a;d++){let u=r.charCodeAt(e+d);if(u!==t.charCodeAt(i+d))break;u===lo&&(l=d)}if(d===a)if(s>a){if(t.charCodeAt(i+d)===lo)return t.slice(i+d+1);if(d===0)return t.slice(i+d)}else o>a&&(r.charCodeAt(e+d)===lo?l=d:d===0&&(l=0));let c="";for(d=e+l+1;d<=n;++d)(d===n||r.charCodeAt(d)===lo)&&(c+=c.length===0?"..":"/..");return`${c}${t.slice(i+l)}`},toNamespacedPath(r){return r},dirname(r){if(Rn(r,"path"),r.length===0)return".";let t=r.charCodeAt(0)===lo,e=-1,n=!0;for(let o=r.length-1;o>=1;--o)if(r.charCodeAt(o)===lo){if(!n){e=o;break}}else n=!1;return e===-1?t?"/":".":t&&e===1?"//":r.slice(0,e)},basename(r,t){t!==void 0&&Rn(t,"suffix"),Rn(r,"path");let e=0,n=-1,o=!0,i;if(t!==void 0&&t.length>0&&t.length<=r.length){if(t===r)return"";let s=t.length-1,a=-1;for(i=r.length-1;i>=0;--i){let l=r.charCodeAt(i);if(l===lo){if(!o){e=i+1;break}}else a===-1&&(o=!1,a=i+1),s>=0&&(l===t.charCodeAt(s)?--s===-1&&(n=i):(s=-1,n=a))}return e===n?n=a:n===-1&&(n=r.length),r.slice(e,n)}for(i=r.length-1;i>=0;--i)if(r.charCodeAt(i)===lo){if(!o){e=i+1;break}}else n===-1&&(o=!1,n=i+1);return n===-1?"":r.slice(e,n)},extname(r){Rn(r,"path");let t=-1,e=0,n=-1,o=!0,i=0;for(let s=r.length-1;s>=0;--s){let a=r[s];if(a==="/"){if(!o){e=s+1;break}continue}n===-1&&(o=!1,n=s+1),a==="."?t===-1?t=s:i!==1&&(i=1):t!==-1&&(i=-1)}return t===-1||n===-1||i===0||i===1&&t===n-1&&t===e+1?"":r.slice(t,n)},format:IU.bind(null,"/"),parse(r){Rn(r,"path");let t={root:"",dir:"",base:"",ext:"",name:""};if(r.length===0)return t;let e=r.charCodeAt(0)===lo,n;e?(t.root="/",n=1):n=0;let o=-1,i=0,s=-1,a=!0,l=r.length-1,d=0;for(;l>=n;--l){let c=r.charCodeAt(l);if(c===lo){if(!a){i=l+1;break}continue}s===-1&&(a=!1,s=l+1),c===Yd?o===-1?o=l:d!==1&&(d=1):o!==-1&&(d=-1)}if(s!==-1){let c=i===0&&e?1:i;o===-1||d===0||d===1&&o===s-1&&o===i+1?t.base=t.name=r.slice(c,s):(t.name=r.slice(c,o),t.base=r.slice(c,s),t.ext=r.slice(o,s))}return i>0?t.dir=r.slice(0,i-1):e&&(t.dir="/"),t},sep:"/",delimiter:":",win32:null,posix:null};Ge.win32=fn.win32=fn;Ge.posix=fn.posix=Ge;var bo=ur?fn.normalize:Ge.normalize,En=ur?fn.isAbsolute:Ge.isAbsolute,Ne=ur?fn.join:Ge.join,XP=ur?fn.resolve:Ge.resolve,gi=ur?fn.relative:Ge.relative,cn=ur?fn.dirname:Ge.dirname,nt=ur?fn.basename:Ge.basename,al=ur?fn.extname:Ge.extname,tX=ur?fn.format:Ge.format,nX=ur?fn.parse:Ge.parse,oX=ur?fn.toNamespacedPath:Ge.toNamespacedPath,xt=ur?fn.sep:Ge.sep,sp=ur?fn.delimiter:Ge.delimiter;function wz(r){return r}var aI=class{constructor(t,e){this.lastCache=void 0;this.lastArgKey=void 0;typeof t=="function"?(this._fn=t,this._computeKey=wz):(this._fn=e,this._computeKey=t.getCacheKey)}get(t){let e=this._computeKey(t);return this.lastArgKey!==e&&(this.lastArgKey=e,this.lastCache=this._fn(t)),this.lastCache}};var mt=class{constructor(t){this.executor=t;this._state=0}get hasValue(){return this._state===2}get value(){if(this._state===0){this._state=1;try{this._value=this.executor()}catch(t){this._error=t}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}};function ZP(r){return r<0?0:r>255?255:r|0}function Xd(r){return r<0?0:r>4294967295?4294967295:r|0}function rs(r){return!r||typeof r!="string"?!0:r.trim().length===0}var Pz=/{(\d+)}/g;function EU(r,...t){return t.length===0?r:r.replace(Pz,function(e,n){let o=parseInt(n,10);return isNaN(o)||o<0||o>=t.length?e:t[o]})}var _z=/{([^}]+)}/g;function o_(r,t){return Object.keys(t).length===0?r:r.replace(_z,(e,n)=>t[n]??e)}function pr(r){return r.replace(/[\\\{\}\*\+\?\|\^\$\.\[\]\(\)]/g,"\\$&")}function wU(r,t){let e=0,n=r.indexOf(t);for(;n!==-1;)e++,n=r.indexOf(t,n+t.length);return e}function r_(r,t){if(!r||!t)return r;let e=t.length,n=0;if(e===1){let o=t.charCodeAt(0);for(;n<r.length&&r.charCodeAt(n)===o;)n++}else for(;r.startsWith(t,n);)n+=e;return r.substring(n)}function mr(r,t){if(!r||!t)return r;let e=t.length,n=r.length;if(e===1){let i=n,s=t.charCodeAt(0);for(;i>0&&r.charCodeAt(i-1)===s;)i--;return r.substring(0,i)}let o=n;for(;o>0&&r.endsWith(t,o);)o-=e;return r.substring(0,o)}function dI(r,t,e={}){if(!r)throw new Error("Cannot create regex from empty string");t||(r=pr(r)),e.wholeWord&&(/\B/.test(r.charAt(0))||(r="\\b"+r),/\B/.test(r.charAt(r.length-1))||(r=r+"\\b"));let n="";return e.global&&(n+="g"),e.matchCase||(n+="i"),e.multiline&&(n+="m"),e.unicode&&(n+="u"),new RegExp(r,n)}function cI(r){return r.source==="^"||r.source==="^$"||r.source==="$"||r.source==="^\\s*$"?!1:!!(r.exec("")&&r.lastIndex===0)}function uI(r){return r.split(/\r\n|\r|\n/)}function pI(r){for(let t=0,e=r.length;t<e;t++){let n=r.charCodeAt(t);if(n!==32&&n!==9)return t}return-1}function kU(r,t=r.length-1){for(let e=t;e>=0;e--){let n=r.charCodeAt(e);if(n!==32&&n!==9)return e}return-1}function fi(r,t){return r<t?-1:r>t?1:0}function mI(r,t,e=0,n=r.length,o=0,i=t.length){for(;e<n&&o<i;e++,o++){let l=r.charCodeAt(e),d=t.charCodeAt(o);if(l<d)return-1;if(l>d)return 1}let s=n-e,a=i-o;return s<a?-1:s>a?1:0}function mh(r,t){return Zd(r,t,0,r.length,0,t.length)}function Zd(r,t,e=0,n=r.length,o=0,i=t.length){for(;e<n&&o<i;e++,o++){let l=r.charCodeAt(e),d=t.charCodeAt(o);if(l===d)continue;if(l>=128||d>=128)return mI(r.toLowerCase(),t.toLowerCase(),e,n,o,i);xU(l)&&(l-=32),xU(d)&&(d-=32);let c=l-d;if(c!==0)return c}let s=n-e,a=i-o;return s<a?-1:s>a?1:0}function xU(r){return r>=97&&r<=122}function i_(r){return r>=65&&r<=90}function wn(r,t){return r.length===t.length&&Zd(r,t)===0}function is(r,t,e){return r===t||!!e&&r!==void 0&&t!==void 0&&wn(r,t)}function na(r,t){let e=t.length;return e<=r.length&&Zd(r,t,0,e)===0}function PU(r,t){let e=r.length,n=e-t.length;return n>=0&&Zd(r,t,n,e)===0}function _U(r,t){let e=Math.min(r.length,t.length),n;for(n=0;n<e;n++)if(r.charCodeAt(n)!==t.charCodeAt(n))return n;return e}function ec(r){return 55296<=r&&r<=56319}function gh(r){return 56320<=r&&r<=57343}function gI(r,t){return(r-55296<<10)+(t-56320)+65536}function s_(r,t,e){let n=r.charCodeAt(e);if(ec(n)&&e+1<t){let o=r.charCodeAt(e+1);if(gh(o))return gI(n,o)}return n}function Dz(r,t){let e=r.charCodeAt(t-1);if(gh(e)&&t>1){let n=r.charCodeAt(t-2);if(ec(n))return gI(n,e)}return e}var t_=class{get offset(){return this._offset}constructor(t,e=0){this._str=t,this._len=t.length,this._offset=e}setOffset(t){this._offset=t}prevCodePoint(){let t=Dz(this._str,this._offset);return this._offset-=t>=65536?2:1,t}nextCodePoint(){let t=s_(this._str,this._len,this._offset);return this._offset+=t>=65536?2:1,t}eol(){return this._offset>=this._len}},n_=class{get offset(){return this._iterator.offset}constructor(t,e=0){this._iterator=new t_(t,e)}nextGraphemeLength(){let t=lI.getInstance(),e=this._iterator,n=e.offset,o=t.getGraphemeBreakType(e.nextCodePoint());for(;!e.eol();){let i=e.offset,s=t.getGraphemeBreakType(e.nextCodePoint());if(SU(o,s)){e.setOffset(i);break}o=s}return e.offset-n}prevGraphemeLength(){let t=lI.getInstance(),e=this._iterator,n=e.offset,o=t.getGraphemeBreakType(e.prevCodePoint());for(;e.offset>0;){let i=e.offset,s=t.getGraphemeBreakType(e.prevCodePoint());if(SU(s,o)){e.setOffset(i);break}o=s}return n-e.offset}eol(){return this._iterator.eol()}};function a_(r,t){return new n_(r,t).nextGraphemeLength()}var e_;function Rz(){return/(?:[\u05BE\u05C0\u05C3\u05C6\u05D0-\u05F4\u0608\u060B\u060D\u061B-\u064A\u066D-\u066F\u0671-\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u0710\u0712-\u072F\u074D-\u07A5\u07B1-\u07EA\u07F4\u07F5\u07FA\u07FE-\u0815\u081A\u0824\u0828\u0830-\u0858\u085E-\u088E\u08A0-\u08C9\u200F\uFB1D\uFB1F-\uFB28\uFB2A-\uFD3D\uFD50-\uFDC7\uFDF0-\uFDFC\uFE70-\uFEFC]|\uD802[\uDC00-\uDD1B\uDD20-\uDE00\uDE10-\uDE35\uDE40-\uDEE4\uDEEB-\uDF35\uDF40-\uDFFF]|\uD803[\uDC00-\uDD23\uDE80-\uDEA9\uDEAD-\uDF45\uDF51-\uDF81\uDF86-\uDFF6]|\uD83A[\uDC00-\uDCCF\uDD00-\uDD43\uDD4B-\uDFFF]|\uD83B[\uDC00-\uDEBB])/}function fI(r){return e_||(e_=Rz()),e_.test(r)}var Az=/^[\t\n\r\x20-\x7E]*$/;function DU(r){return Az.test(r)}var Mz=/[\u2028\u2029]/;function hI(r){return Mz.test(r)}var Lz=/(?:\x1b\[|\x9b)[=?>!]?[\d;:]*["$#'* ]?[a-zA-Z@^`{}|~]/,Oz=/(?:\x1b\]|\x9d).*?(?:\x1b\\|\x07|\x9c)/,Nz=/\x1b(?:[ #%\(\)\*\+\-\.\/]?[a-zA-Z0-9\|}~@])/,mX=new RegExp("(?:"+[Lz.source,Oz.source,Nz.source].join("|")+")","g");var RU=String.fromCharCode(65279);function AU(r){return!!(r&&r.length>0&&r.charCodeAt(0)===65279)}function MU(r,t){if(!r||!t||r.length<t.length)return!1;let e=t.length,n=r.toLowerCase(),o=0,i=-1;for(;o<e;){let s=n.indexOf(t[o],i+1);if(s<0)return!1;i=s,o++}return!0}function l_(r,t=!1){return r?(t&&(r=r.replace(/\\./g,"")),r.toLowerCase()!==r):!1}function LU(r){return r.charAt(0).toUpperCase()+r.slice(1)}function OU(r,t=1){if(t===0)return"";let e=-1;do e=r.indexOf(`
`,e+1),t--;while(t>0&&e>=0);return e===-1?r:(r[e-1]==="\r"&&e--,r.substr(0,e))}function SU(r,t){return r===0?t!==5&&t!==7:r===2&&t===3?!1:r===4||r===2||r===3||t===4||t===2||t===3?!0:!(r===8&&(t===8||t===9||t===11||t===12)||(r===11||r===9)&&(t===9||t===10)||(r===12||r===10)&&t===10||t===5||t===13||t===7||r===1||r===13&&t===14||r===6&&t===6)}var lI=class r{static{this._INSTANCE=null}static getInstance(){return r._INSTANCE||(r._INSTANCE=new r),r._INSTANCE}constructor(){this._data=Uz()}getGraphemeBreakType(t){if(t<32)return t===10?3:t===13?2:4;if(t<127)return 0;let e=this._data,n=e.length/3,o=1;for(;o<=n;)if(t<e[3*o])o=2*o;else if(t>e[3*o+1])o=2*o+1;else return e[3*o+2];return 0}};function Uz(){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 CU=class r{constructor(t){this.confusableDictionary=t}static{this.ambiguousCharacterData=new mt(()=>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 aI(t=>{let e=t.split(",");function n(u){let m=new Map;for(let g=0;g<u.length;g+=2)m.set(u[g],u[g+1]);return m}function o(u,m){let g=new Map(u);for(let[h,f]of m)g.set(h,f);return g}function i(u,m){if(!u)return m;let g=new Map;for(let[h,f]of u)m.has(h)&&g.set(h,f);return g}let s=this.ambiguousCharacterData.value,a=e.filter(u=>!u.startsWith("_")&&Object.hasOwn(s,u));a.length===0&&(a=["_default"]);let l;for(let u of a){let m=n(s[u]);l=i(l,m)}let d=n(s._common),c=o(d,l);return new r(c)})}static getInstance(t){return r.cache.get(Array.from(t).join(","))}static{this._locales=new mt(()=>Object.keys(r.ambiguousCharacterData.value).filter(t=>!t.startsWith("_")))}static getLocales(){return r._locales.value}isAmbiguous(t){return this.confusableDictionary.has(t)}containsAmbiguousCharacter(t){for(let e=0;e<t.length;e++){let n=t.codePointAt(e);if(typeof n=="number"&&this.isAmbiguous(n))return!0}return!1}getPrimaryConfusable(t){return this.confusableDictionary.get(t)}getConfusableCodePoints(){return new Set(this.confusableDictionary.keys())}},TU=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(t){return r.getData().has(t)}static containsInvisibleCharacter(t){for(let e=0;e<t.length;e++){let n=t.codePointAt(e);if(typeof n=="number"&&(r.isInvisibleCharacter(n)||n===32))return!0}return!1}static get codePoints(){return r.getData()}};function ll(r){return r===47||r===92}function vI(r){return r.replace(/[\\/]/g,Ge.sep)}function NU(r){return r.indexOf("/")===-1&&(r=vI(r)),/^[a-zA-Z]:(\/|$)/.test(r)&&(r="/"+r),r}function fh(r,t=Ge.sep){if(!r)return"";let e=r.length,n=r.charCodeAt(0);if(ll(n)){if(ll(r.charCodeAt(1))&&!ll(r.charCodeAt(2))){let i=3,s=i;for(;i<e&&!ll(r.charCodeAt(i));i++);if(s!==i&&!ll(r.charCodeAt(i+1))){for(i+=1;i<e;i++)if(ll(r.charCodeAt(i)))return r.slice(0,i+1).replace(/[\\/]/g,t)}}return t}else if(FU(n)&&r.charCodeAt(1)===58)return ll(r.charCodeAt(2))?r.slice(0,2)+t:r.slice(0,2);let o=r.indexOf("://");if(o!==-1){for(o+=3;o<e;o++)if(ll(r.charCodeAt(o)))return r.slice(0,o+1)}return""}var Fz=/[\\/:\*\?"<>\|]/g,Hz=/[/]/g,Wz=/^(con|prn|aux|clock\$|nul|lpt[0-9]|com[0-9])(\.(.*?))?$/i;function UU(r,t=Ie){let e=t?Fz:Hz;return!(!r||r.length===0||/^\s+$/.test(r)||(e.lastIndex=0,e.test(r))||t&&Wz.test(r)||r==="."||r===".."||t&&r[r.length-1]==="."||t&&r.length!==r.trim().length||r.length>255)}function ap(r,t,e){let n=r===t;return!e||n?n:!r||!t?!1:wn(r,t)}function _r(r,t,e,n=xt){if(r===t)return!0;if(!r||!t||t.length>r.length)return!1;if(e){if(!na(r,t))return!1;if(t.length===r.length)return!0;let i=t.length;return t.charAt(t.length-1)===n&&i--,r.charAt(i)===n}return t.charAt(t.length-1)!==n&&(t+=n),r.indexOf(t)===0}function FU(r){return r>=65&&r<=90||r>=97&&r<=122}function HU(r){return Ie?(r=mr(r,xt),r.endsWith(":")&&(r+=xt)):(r=mr(r,xt),r||(r=xt)),r}function d_(r){let t=bo(r);return Ie?r.length>3?!1:bI(t)&&(r.length===2||t.charCodeAt(2)===92):t===Ge.sep}function bI(r,t=Ie){return t?FU(r.charCodeAt(0))&&r.charCodeAt(1)===58:!1}function c_(r,t=Ie){return bI(r,t)?r[0]:void 0}var Vz="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",Bz="BDEFGHIJKMOQRSTUVWXYZbdefghijkmoqrstuvwxyz0123456789";function WU(r,t,e=8){let n="";for(let i=0;i<e;i++){let s;i===0&&Ie&&!t&&(e===3||e===4)?s=Bz:s=Vz,n+=s.charAt(Math.floor(Math.random()*s.length))}let o;return t?o=`${t}-${n}`:o=n,r?Ne(r,o):o}var $z=/^\w[\w\d+.-]*$/,zz=/^\//,qz=/^\/\//;function Kz(r,t){if(!r.scheme&&t)throw new Error(`[UriError]: Scheme is missing: {scheme: "", authority: "${r.authority}", path: "${r.path}", query: "${r.query}", fragment: "${r.fragment}"}`);if(r.scheme&&!$z.test(r.scheme)){let e=[...r.scheme.matchAll(/[^\w\d+.-]/gu)],n=e.length>0?` Found '${e[0][0]}' at index ${e[0].index} (${e.length} total)`:"";throw new Error(`[UriError]: Scheme contains illegal characters.${n} (len:${r.scheme.length})`)}if(r.path){if(r.authority){if(!zz.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(qz.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 jz(r,t){return!r&&!t?"file":r}function Gz(r,t){switch(r){case"https":case"http":case"file":t?t[0]!==hi&&(t=hi+t):t=hi;break}return t}var ln="",hi="/",Qz=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/,b=class r{static isUri(t){return t instanceof r?!0:!t||typeof t!="object"?!1:typeof t.authority=="string"&&typeof t.fragment=="string"&&typeof t.path=="string"&&typeof t.query=="string"&&typeof t.scheme=="string"&&typeof t.fsPath=="string"&&typeof t.with=="function"&&typeof t.toString=="function"}constructor(t,e,n,o,i,s=!1){typeof t=="object"?(this.scheme=t.scheme||ln,this.authority=t.authority||ln,this.path=t.path||ln,this.query=t.query||ln,this.fragment=t.fragment||ln):(this.scheme=jz(t,s),this.authority=e||ln,this.path=Gz(this.scheme,n||ln),this.query=o||ln,this.fragment=i||ln,Kz(this,s))}get fsPath(){return hh(this,!1)}with(t){if(!t)return this;let{scheme:e,authority:n,path:o,query:i,fragment:s}=t;return e===void 0?e=this.scheme:e===null&&(e=ln),n===void 0?n=this.authority:n===null&&(n=ln),o===void 0?o=this.path:o===null&&(o=ln),i===void 0?i=this.query:i===null&&(i=ln),s===void 0?s=this.fragment:s===null&&(s=ln),e===this.scheme&&n===this.authority&&o===this.path&&i===this.query&&s===this.fragment?this:new dl(e,n,o,i,s)}static parse(t,e=!1){let n=Qz.exec(t);return n?new dl(n[2]||ln,yI(n[4]||ln),yI(n[5]||ln),yI(n[7]||ln),yI(n[9]||ln),e):new dl(ln,ln,ln,ln,ln)}static file(t){let e=ln;if(Ie&&(t=t.replace(/\\/g,hi)),t[0]===hi&&t[1]===hi){let n=t.indexOf(hi,2);n===-1?(e=t.substring(2),t=hi):(e=t.substring(2,n),t=t.substring(n)||hi)}return new dl("file",e,t,ln,ln)}static from(t,e){return new dl(t.scheme,t.authority,t.path,t.query,t.fragment,e)}static joinPath(t,...e){if(!t.path)throw new Error("[UriError]: cannot call joinPath on URI without path");let n;return Ie&&t.scheme==="file"?n=r.file(fn.join(hh(t,!0),...e)).path:n=Ge.join(t.path,...e),t.with({path:n})}toString(t=!1){return p_(this,t)}toJSON(){return this}static revive(t){if(t){if(t instanceof r)return t;{let e=new dl(t);return e._formatted=t.external??null,e._fsPath=t._sep===$U?t.fsPath??null:null,e}}else return t}[Symbol.for("debug.description")](){return`URI(${this.toString()})`}};function cl(r){return!r||typeof r!="object"?!1:typeof r.scheme=="string"&&(typeof r.authority=="string"||typeof r.authority>"u")&&(typeof r.path=="string"||typeof r.path>"u")&&(typeof r.query=="string"||typeof r.query>"u")&&(typeof r.fragment=="string"||typeof r.fragment>"u")}var $U=Ie?1:void 0,dl=class extends b{constructor(){super(...arguments);this._formatted=null;this._fsPath=null}get fsPath(){return this._fsPath||(this._fsPath=hh(this,!1)),this._fsPath}toString(e=!1){return e?p_(this,!0):(this._formatted||(this._formatted=p_(this,!1)),this._formatted)}toJSON(){let e={$mid:1};return this._fsPath&&(e.fsPath=this._fsPath,e._sep=$U),this._formatted&&(e.external=this._formatted),this.path&&(e.path=this.path),this.scheme&&(e.scheme=this.scheme),this.authority&&(e.authority=this.authority),this.query&&(e.query=this.query),this.fragment&&(e.fragment=this.fragment),e}},zU={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 VU(r,t,e){let n,o=-1;for(let i=0;i<r.length;i++){let s=r.charCodeAt(i);if(s>=97&&s<=122||s>=65&&s<=90||s>=48&&s<=57||s===45||s===46||s===95||s===126||t&&s===47||e&&s===91||e&&s===93||e&&s===58)o!==-1&&(n+=encodeURIComponent(r.substring(o,i)),o=-1),n!==void 0&&(n+=r.charAt(i));else{n===void 0&&(n=r.substr(0,i));let a=zU[s];a!==void 0?(o!==-1&&(n+=encodeURIComponent(r.substring(o,i)),o=-1),n+=a):o===-1&&(o=i)}}return o!==-1&&(n+=encodeURIComponent(r.substring(o))),n!==void 0?n:r}function Jz(r){let t;for(let e=0;e<r.length;e++){let n=r.charCodeAt(e);n===35||n===63?(t===void 0&&(t=r.substr(0,e)),t+=zU[n]):t!==void 0&&(t+=r[e])}return t!==void 0?t:r}function hh(r,t){let e;return r.authority&&r.path.length>1&&r.scheme==="file"?e=`//${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?t?e=r.path.substr(1):e=r.path[1].toLowerCase()+r.path.substr(2):e=r.path,Ie&&(e=e.replace(/\//g,"\\")),e}function p_(r,t){let e=t?Jz:VU,n="",{scheme:o,authority:i,path:s,query:a,fragment:l}=r;if(o&&(n+=o,n+=":"),(i||o==="file")&&(n+=hi,n+=hi),i){let d=i.indexOf("@");if(d!==-1){let c=i.substr(0,d);i=i.substr(d+1),d=c.lastIndexOf(":"),d===-1?n+=e(c,!1,!1):(n+=e(c.substr(0,d),!1,!1),n+=":",n+=e(c.substr(d+1),!1,!0)),n+="@"}i=i.toLowerCase(),d=i.lastIndexOf(":"),d===-1?n+=e(i,!1,!0):(n+=e(i.substr(0,d),!1,!0),n+=i.substr(d))}if(s){if(s.length>=3&&s.charCodeAt(0)===47&&s.charCodeAt(2)===58){let d=s.charCodeAt(1);d>=65&&d<=90&&(s=`/${String.fromCharCode(d+32)}:${s.substr(3)}`)}else if(s.length>=2&&s.charCodeAt(1)===58){let d=s.charCodeAt(0);d>=65&&d<=90&&(s=`${String.fromCharCode(d+32)}:${s.substr(2)}`)}n+=e(s,!0,!1)}return a&&(n+="?",n+=e(a,!1,!1)),l&&(n+="#",n+=t?l:VU(l,!1,!1)),n}function qU(r){try{return decodeURIComponent(r)}catch{return r.length>3?r.substr(0,3)+qU(r.substr(3)):r}}var BU=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function yI(r){return r.match(BU)?r.replace(BU,t=>qU(t)):r}var V;(ye=>(ye.inMemory="inmemory",ye.vscode="vscode",ye.internal="private",ye.walkThrough="walkThrough",ye.walkThroughSnippet="walkThroughSnippet",ye.http="http",ye.https="https",ye.file="file",ye.mailto="mailto",ye.untitled="untitled",ye.data="data",ye.command="command",ye.vscodeRemote="vscode-remote",ye.vscodeRemoteResource="vscode-remote-resource",ye.vscodeManagedRemoteResource="vscode-managed-remote-resource",ye.vscodeUserData="vscode-userdata",ye.vscodeCustomEditor="vscode-custom-editor",ye.vscodeNotebookCell="vscode-notebook-cell",ye.vscodeNotebookCellMetadata="vscode-notebook-cell-metadata",ye.vscodeNotebookCellMetadataDiff="vscode-notebook-cell-metadata-diff",ye.vscodeNotebookCellOutput="vscode-notebook-cell-output",ye.vscodeNotebookCellOutputDiff="vscode-notebook-cell-output-diff",ye.vscodeNotebookMetadata="vscode-notebook-metadata",ye.vscodeInteractiveInput="vscode-interactive-input",ye.vscodeSettings="vscode-settings",ye.vscodeWorkspaceTrust="vscode-workspace-trust",ye.vscodeTerminal="vscode-terminal",ye.vscodeImageCarousel="vscode-image-carousel",ye.vscodeChatCodeBlock="vscode-chat-code-block",ye.vscodeChatCodeCompareBlock="vscode-chat-code-compare-block",ye.vscodeChatEditor="vscode-chat-editor",ye.vscodeChatInput="chatSessionInput",ye.vscodeLocalChatSession="vscode-chat-session",ye.webviewPanel="webview-panel",ye.vscodeWebview="vscode-webview",ye.vscodeBrowser="vscode-browser",ye.extension="extension",ye.vscodeFileResource="vscode-file",ye.tmp="tmp",ye.vsls="vsls",ye.vscodeSourceControl="vscode-scm",ye.commentsInput="comment",ye.codeSetting="code-setting",ye.outputChannel="output",ye.accessibleView="accessible-view",ye.chatEditingSnapshotScheme="chat-editing-snapshot-text-model",ye.chatEditingModel="chat-editing-text-model",ye.copilotPr="copilot-pr"))(V||={});function II(r,t){return b.isUri(r)?wn(r.scheme,t):na(r,t+":")}function KU(r,...t){return t.some(e=>II(r,e))}var Yz="tkn",m_=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(t){this._preferredWebSchema=t}setDelegate(t){this._delegate=t}setServerRootPath(t,e){this._serverRootPath=Ge.join(e??"/",Xz(t))}getServerRootPath(){return this._serverRootPath}get _remoteResourcesPath(){return Ge.join(this._serverRootPath,V.vscodeRemoteResource)}set(t,e,n){this._hosts[t]=e,this._ports[t]=n}setConnectionToken(t,e){this._connectionTokens[t]=e}getPreferredWebSchema(){return this._preferredWebSchema}rewrite(t){if(this._delegate)try{return this._delegate(t)}catch(a){return ze(a),t}let e=t.authority,n=this._hosts[e];n&&n.indexOf(":")!==-1&&n.indexOf("[")===-1&&(n=`[${n}]`);let o=this._ports[e],i=this._connectionTokens[e],s=`path=${encodeURIComponent(t.path)}`;return typeof i=="string"&&(s+=`&${Yz}=${encodeURIComponent(i)}`),b.from({scheme:Pr?this._preferredWebSchema:V.vscodeRemoteResource,authority:`${n}:${o}`,path:this._remoteResourcesPath,query:s})}},f_=new m_;function Xz(r){return`${r.quality??"oss"}-${r.commit??"dev"}`}var jU="vs/../../node_modules",GU="vs/../../node_modules.asar";var h_="vscode-app",g_=class r{static{this.FALLBACK_AUTHORITY=h_}asBrowserUri(t){let e=this.toUri(t);return this.uriToBrowserUri(e)}uriToBrowserUri(t){return t.scheme===V.vscodeRemote?f_.rewrite(t):t.scheme===V.file&&(Jy||lU===`${V.vscodeFileResource}://${r.FALLBACK_AUTHORITY}`)?t.with({scheme:V.vscodeFileResource,authority:t.authority||r.FALLBACK_AUTHORITY,query:null,fragment:null}):t}asFileUri(t){let e=this.toUri(t);return this.uriToFileUri(e)}uriToFileUri(t){return t.scheme===V.vscodeFileResource?t.with({scheme:V.file,authority:t.authority!==r.FALLBACK_AUTHORITY?t.authority:null,query:null,fragment:null}):t}toUri(t){if(b.isUri(t))return t;if(globalThis._VSCODE_FILE_ROOT){let e=globalThis._VSCODE_FILE_ROOT;if(/^\w[\w\d+.-]*:\/\//.test(e))return b.joinPath(b.parse(e,!0),t);let n=Ne(e,t);return b.file(n)}throw new Error("Cannot determine URI for module id!")}},ul=new g_,wX=Object.freeze({"Cache-Control":"no-cache, no-store"}),kX=Object.freeze({"Document-Policy":"include-js-call-stacks-in-crash-reports"}),Zz;(i=>{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"}]]);i.CoopAndCoep=Object.freeze(r.get("3"));let e="vscode-coi";function n(s){let a;typeof s=="string"?a=new URL(s).searchParams:s instanceof URL?a=s.searchParams:b.isUri(s)&&(a=new URL(s.toString(!0)).searchParams);let l=a?.get(e);if(l)return r.get(l)}i.getHeadersFromQuery=n;function o(s,a,l){if(!globalThis.crossOriginIsolated)return;let d=a&&l?"3":l?"2":"1";s instanceof URLSearchParams?s.set(e,d):s[e]=d}i.addSearchParam=o})(Zz||={});function zr(r){return hh(r,!0)}var ss=class{constructor(t){this._ignorePathCasing=t}compare(t,e,n=!1){return t===e?0:fi(this.getComparisonKey(t,n),this.getComparisonKey(e,n))}isEqual(t,e,n=!1){return t===e?!0:!t||!e?!1:this.getComparisonKey(t,n)===this.getComparisonKey(e,n)}getComparisonKey(t,e=!1){return t.with({path:this._ignorePathCasing(t)?t.path.toLowerCase():void 0,fragment:e?null:void 0}).toString()}ignorePathCasing(t){return this._ignorePathCasing(t)}isEqualOrParent(t,e,n=!1){if(t.scheme===e.scheme){if(t.scheme===V.file)return _r(zr(t),zr(e),this._ignorePathCasing(t))&&t.query===e.query&&(n||t.fragment===e.fragment);if(QU(t.authority,e.authority))return _r(t.path,e.path,this._ignorePathCasing(t),"/")&&t.query===e.query&&(n||t.fragment===e.fragment)}return!1}joinPath(t,...e){return b.joinPath(t,...e)}basenameOrAuthority(t){return Tt(t)||t.authority}basename(t,e){return Ge.basename(t.path,e)}extname(t){return Ge.extname(t.path)}dirname(t){if(t.path.length===0)return t;let e;return t.scheme===V.file?e=b.file(cn(zr(t))).path:(e=Ge.dirname(t.path),t.authority&&e.length&&e.charCodeAt(0)!==47&&(console.error(`dirname("${t.toString})) resulted in a relative path`),e="/")),t.with({path:e})}normalizePath(t){if(!t.path.length)return t;let e;return t.scheme===V.file?e=b.file(bo(zr(t))).path:e=Ge.normalize(t.path),t.with({path:e})}relativePath(t,e){if(t.scheme!==e.scheme||!QU(t.authority,e.authority))return;if(t.scheme===V.file){let i=gi(zr(t),zr(e));return Ie?vI(i):i}let n=t.path||"/",o=e.path||"/";if(this._ignorePathCasing(t)){let i=0;for(let s=Math.min(n.length,o.length);i<s&&!(n.charCodeAt(i)!==o.charCodeAt(i)&&n.charAt(i).toLowerCase()!==o.charAt(i).toLowerCase());i++);n=o.substr(0,i)+n.substr(i)}return Ge.relative(n,o)}resolvePath(t,e){if(t.scheme===V.file){let n=b.file(XP(zr(t),e));return t.with({authority:n.authority,path:n.path})}return e=NU(e),t.with({path:Ge.resolve(t.path,e)})}isAbsolutePath(t){return!!t.path&&t.path[0]==="/"}isEqualAuthority(t,e){return t===e||t!==void 0&&e!==void 0&&wn(t,e)}hasTrailingPathSeparator(t,e=xt){if(t.scheme===V.file){let n=zr(t);return n.length>fh(n).length&&n[n.length-1]===e}else{let n=t.path;return n.length>1&&n.charCodeAt(n.length-1)===47&&!/^[a-zA-Z]:(\/$|\\$)/.test(t.fsPath)}}removeTrailingPathSeparator(t,e=xt){return JU(t,e)?t.with({path:t.path.substr(0,t.path.length-1)}):t}addTrailingPathSeparator(t,e=xt){let n=!1;if(t.scheme===V.file){let o=zr(t);n=o!==void 0&&o.length===fh(o).length&&o[o.length-1]===e}else{e="/";let o=t.path;n=o.length===1&&o.charCodeAt(o.length-1)===47}return!n&&!JU(t,e)?t.with({path:t.path+"/"}):t}},ft=new ss(()=>!1),tc=new ss(r=>r.scheme===V.file?!Qe:!0),v_=new ss(r=>!0),Ro=ft.isEqual.bind(ft),e8=ft.isEqualOrParent.bind(ft),LX=ft.getComparisonKey.bind(ft),vh=ft.basenameOrAuthority.bind(ft),Tt=ft.basename.bind(ft),xI=ft.extname.bind(ft),Go=ft.dirname.bind(ft),Et=ft.joinPath.bind(ft),OX=ft.normalizePath.bind(ft),bh=ft.relativePath.bind(ft),NX=ft.resolvePath.bind(ft),YU=ft.isAbsolutePath.bind(ft),QU=ft.isEqualAuthority.bind(ft),JU=ft.hasTrailingPathSeparator.bind(ft),UX=ft.removeTrailingPathSeparator.bind(ft),FX=ft.addTrailingPathSeparator.bind(ft);var t8;(i=>{i.META_DATA_LABEL="label",i.META_DATA_DESCRIPTION="description",i.META_DATA_SIZE="size",i.META_DATA_MIME="mime";function o(s){let a=new Map;s.path.substring(s.path.indexOf(";")+1,s.path.lastIndexOf(";")).split(";").forEach(c=>{let[u,m]=c.split(":");u&&m&&a.set(u,m)});let d=s.path.substring(0,s.path.indexOf(";"));return d&&a.set(i.META_DATA_MIME,d),a}i.parseMetaData=o})(t8||={});var XU=Symbol("MicrotaskDelay");function qr(r){return!!r&&typeof r.then=="function"}function fr(r){let t=new Ce,e=r(t.token),n=!1,o=new Promise((i,s)=>{let a=t.token.onCancellationRequested(()=>{n=!0,a.dispose(),s(new Be)});Promise.resolve(e).then(l=>{a.dispose(),t.dispose(),n?qy(l)&&l.dispose():i(l)},l=>{a.dispose(),t.dispose(),s(l)})});return new class{cancel(){t.cancel(),t.dispose()}then(i,s){return o.then(i,s)}catch(i){return this.then(void 0,i)}finally(i){return o.finally(i)}}}function gp(r,t,e){return new Promise((n,o)=>{let i=t.onCancellationRequested(()=>{i.dispose(),n(e)});r.then(n,o).finally(()=>i.dispose())})}function ml(r,t){return new Promise((e,n)=>{let o=t.onCancellationRequested(()=>{o.dispose(),n(new Be)});r.then(e,n).finally(()=>o.dispose())})}function hn(r){return new Promise((t,e)=>{let n=r();qr(n)?n.then(t,e):t(n)})}function Sh(){let r,t;return{promise:new Promise((n,o)=>{r=n,t=o}),resolve:r,reject:t}}var b_=class{constructor(){this.activePromise=null,this.queuedPromise=null,this.queuedPromiseFactory=null,this.cancellationTokenSource=new Ce}queue(t){if(this.cancellationTokenSource.token.isCancellationRequested)return Promise.reject(new Error("Throttler is disposed"));if(this.activePromise){if(this.queuedPromiseFactory=t,!this.queuedPromise){let e=()=>{if(this.queuedPromise=null,this.cancellationTokenSource.token.isCancellationRequested)return;let n=this.queue(this.queuedPromiseFactory);return this.queuedPromiseFactory=null,n};this.queuedPromise=new Promise(n=>{this.activePromise.then(e,e).then(n)})}return new Promise((e,n)=>{this.queuedPromise.then(e,n)})}return this.activePromise=t(this.cancellationTokenSource.token),new Promise((e,n)=>{this.activePromise.then(o=>{this.activePromise=null,e(o)},o=>{this.activePromise=null,n(o)})})}dispose(){this.cancellationTokenSource.cancel()}},CI=class{constructor(){this.current=Promise.resolve(null)}queue(t){return this.current=this.current.then(()=>t(),()=>t())}},pl=class{constructor(){this.promiseMap=new Map}queue(t,e){let o=(this.promiseMap.get(t)??Promise.resolve()).catch(()=>{}).then(e).finally(()=>{this.promiseMap.get(t)===o&&this.promiseMap.delete(t)});return this.promiseMap.set(t,o),o}peek(t){return this.promiseMap.get(t)||void 0}keys(){return this.promiseMap.keys()}},n8=(r,t)=>{let e=!0,n=setTimeout(()=>{e=!1,t()},r);return{isTriggered:()=>e,dispose:()=>{clearTimeout(n),e=!1}}},o8=r=>{let t=!0;return queueMicrotask(()=>{t&&(t=!1,r())}),{isTriggered:()=>t,dispose:()=>{t=!1}}},yh=class{constructor(t){this.defaultDelay=t;this.deferred=null,this.completionPromise=null,this.doResolve=null,this.doReject=null,this.task=null}trigger(t,e=this.defaultDelay){this.task=t,this.cancelTimeout(),this.completionPromise||(this.completionPromise=new Promise((o,i)=>{this.doResolve=o,this.doReject=i}).then(()=>{if(this.completionPromise=null,this.doResolve=null,this.task){let o=this.task;return this.task=null,o()}}));let n=()=>{this.deferred=null,this.doResolve?.(null)};return this.deferred=e===XU?o8(n):n8(e,n),this.completionPromise}isTriggered(){return!!this.deferred?.isTriggered()}cancel(){this.cancelTimeout(),this.completionPromise&&(this.doReject?.(new Be),this.completionPromise=null)}cancelTimeout(){this.deferred?.dispose(),this.deferred=null}dispose(){this.cancel()}},vi=class{constructor(t){this.delayer=new yh(t),this.throttler=new b_}trigger(t,e){return this.delayer.trigger(()=>this.throttler.queue(t),e)}isTriggered(){return this.delayer.isTriggered()}cancel(){this.delayer.cancel()}dispose(){this.delayer.dispose(),this.throttler.dispose()}},In=class{constructor(){this._isOpen=!1,this._promise=new Promise((t,e)=>{this._completePromise=t})}isOpen(){return this._isOpen}open(){this._isOpen=!0,this._completePromise(!0)}wait(){return this._promise}};function Ut(r,t){return t?new Promise((e,n)=>{let o=setTimeout(()=>{i.dispose(),e()},r),i=t.onCancellationRequested(()=>{clearTimeout(o),i.dispose(),n(new Be)})}):fr(e=>Ut(r,e))}function Ch(r,t=0,e){let n=setTimeout(()=>{r(),e&&o.dispose()},t),o=K(()=>{clearTimeout(n),e?.delete(o)});return e?.add(o),o}function ZU(r,t=n=>!!n,e=null){if(r.length===0)return Promise.resolve(e);let n=r.length,o=()=>{n=-1;for(let i of r)i.cancel?.()};return new Promise((i,s)=>{for(let a of r)a.then(l=>{--n>=0&&t(l)?(o(),i(l)):n===0&&i(e)}).catch(l=>{--n>=0&&(o(),s(l))})})}var y_=class{constructor(t){this._size=0;this._isDisposed=!1;this.maxDegreeOfParalellism=t,this.outstandingPromises=[],this.runningPromises=0,this._onDrained=new E}whenIdle(){return this.size>0?he.toPromise(this.onDrained):Promise.resolve()}get onDrained(){return this._onDrained.event}get size(){return this._size}queue(t){if(this._isDisposed)throw new Error("Object has been disposed");return this._size++,new Promise((e,n)=>{this.outstandingPromises.push({factory:t,c:e,e:n}),this.consume()})}consume(){for(;this.outstandingPromises.length&&this.runningPromises<this.maxDegreeOfParalellism;){let t=this.outstandingPromises.shift();this.runningPromises++;let e=t.factory();e.then(t.c,t.e),e.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()}},I_=class extends y_{constructor(){super(1)}};var dp=class{constructor(){this.queues=new Map;this.drainers=new Set;this.drainListeners=void 0;this.drainListenerCount=0}async whenDrained(){if(this.isDrained())return;let t=new Jt;return this.drainers.add(t),t.p}isDrained(){for(let[,t]of this.queues)if(t.size>0)return!1;return!0}queueSize(t,e=ft){let n=e.getComparisonKey(t);return this.queues.get(n)?.size??0}queueFor(t,e,n=ft){let o=n.getComparisonKey(t),i=this.queues.get(o);if(!i){i=new I_;let s=this.drainListenerCount++,a=he.once(i.onDrained)(()=>{i?.dispose(),this.queues.delete(o),this.onDidQueueDrain(),this.drainListeners?.deleteAndDispose(s),this.drainListeners?.size===0&&(this.drainListeners.dispose(),this.drainListeners=void 0)});this.drainListeners||(this.drainListeners=new Fn),this.drainListeners.set(s,a),this.queues.set(o,i)}return i.queue(e)}onDidQueueDrain(){this.isDrained()&&this.releaseDrainers()}releaseDrainers(){for(let t of this.drainers)t.complete();this.drainers.clear()}dispose(){for(let[,t]of this.queues)t.dispose();this.queues.clear(),this.releaseDrainers(),this.drainListeners?.dispose()}};var Ih=class{constructor(t,e){this._isDisposed=!1;this._token=void 0,typeof t=="function"&&typeof e=="number"&&this.setIfNotSet(t,e)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==void 0&&(clearTimeout(this._token),this._token=void 0)}cancelAndSet(t,e){if(this._isDisposed)throw new Pt("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=void 0,t()},e)}setIfNotSet(t,e){if(this._isDisposed)throw new Pt("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===void 0&&(this._token=setTimeout(()=>{this._token=void 0,t()},e))}},cp=class{constructor(){this.disposable=void 0;this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(t,e,n=globalThis){if(this.isDisposed)throw new Pt("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let o=n.setInterval(()=>{t()},e);this.disposable=K(()=>{n.clearInterval(o),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},jn=class{constructor(t,e){this.timeoutToken=void 0,this.runner=t,this.timeout=e,this.timeoutHandler=this.onTimeout.bind(this)}dispose(){this.cancel(),this.runner=null}cancel(){this.isScheduled()&&(clearTimeout(this.timeoutToken),this.timeoutToken=void 0)}schedule(t=this.timeout){this.cancel(),this.timeoutToken=setTimeout(this.timeoutHandler,t)}get delay(){return this.timeout}set delay(t){this.timeout=t}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?.()}},xh=class{constructor(t,e){e%1e3!==0&&console.warn(`ProcessTimeRunOnceScheduler resolution is 1s, ${e}ms is not a multiple of 1000ms.`),this.runner=t,this.timeout=e,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(t=this.timeout){t%1e3!==0&&console.warn(`ProcessTimeRunOnceScheduler resolution is 1s, ${t}ms is not a multiple of 1000ms.`),this.cancel(),this.counter=Math.ceil(t/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?.())}},TI=class extends jn{constructor(e,n){super(e,n);this.units=[]}work(e){this.units.push(e),this.isScheduled()||this.schedule()}doRun(){let e=this.units;this.units=[],this.runner?.(e)}dispose(){this.units=[],super.dispose()}},up=class extends O{constructor(e,n){super();this.options=e;this.handler=n;this.pendingWork=[];this.throttler=this._register(new sn);this.disposed=!1;this.lastExecutionTime=0}get pending(){return this.pendingWork.length}work(e){if(this.disposed)return!1;if(typeof this.options.maxBufferedWork=="number"){if(this.throttler.value){if(this.pending+e.length>this.options.maxBufferedWork)return!1}else if(this.pending+e.length-this.options.maxWorkChunkSize>this.options.maxBufferedWork)return!1}for(let o of e)this.pendingWork.push(o);let n=Date.now()-this.lastExecutionTime;return!this.throttler.value&&(!this.options.waitThrottleDelayBetweenWorkUnits||n>=this.options.throttleDelay)?this.doWork():!this.throttler.value&&this.options.waitThrottleDelayBetweenWorkUnits&&this.scheduleThrottler(Math.max(this.options.throttleDelay-n,0)),!0}doWork(){this.lastExecutionTime=Date.now(),this.handler(this.pendingWork.splice(0,this.options.maxWorkChunkSize)),this.pendingWork.length>0&&this.scheduleThrottler()}scheduleThrottler(e=this.options.throttleDelay){this.throttler.value=new jn(()=>{this.throttler.clear(),this.doWork()},e),this.throttler.value.schedule()}dispose(){super.dispose(),this.pendingWork.length=0,this.disposed=!0}},C_,SI;(function(){let r=globalThis;typeof r.requestIdleCallback!="function"||typeof r.cancelIdleCallback!="function"?SI=(t,e,n)=>{Xy(()=>{if(o)return;let i=Date.now()+15;e(Object.freeze({didTimeout:!0,timeRemaining(){return Math.max(0,i-Date.now())}}))});let o=!1;return{dispose(){o||(o=!0)}}}:SI=(t,e,n)=>{let o=t.requestIdleCallback(e,typeof n=="number"?{timeout:n}:void 0),i=!1;return{dispose(){i||(i=!0,t.cancelIdleCallback(o))}}},C_=(t,e)=>SI(globalThis,t,e)})();var x_=class{constructor(t,e){this._didRun=!1;this._executor=()=>{try{this._value=e()}catch(n){this._error=n}finally{this._didRun=!0}},this._handle=SI(t,()=>this._executor())}dispose(){this._handle.dispose()}get value(){if(this._didRun||(this._handle.dispose(),this._executor()),this._error)throw this._error;return this._value}get isInitialized(){return this._didRun}},EI=class extends x_{constructor(t){super(globalThis,t)}};async function eF(r,t,e){let n;for(let o=0;o<e;o++)try{return await r()}catch(i){n=i,await Ut(t)}throw n}var Jt=class r{static fromPromise(t){let e=new r;return e.settleWith(t),e}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((t,e)=>{this.completeCallback=t,this.errorCallback=e})}complete(t){return this.isSettled?Promise.resolve():new Promise(e=>{this.completeCallback(t),this.outcome={outcome:0,value:t},e()})}error(t){return this.isSettled?Promise.resolve():new Promise(e=>{this.errorCallback(t),this.outcome={outcome:1,value:t},e()})}settleWith(t){return t.then(e=>this.complete(e),e=>this.error(e))}cancel(){return this.error(new Be)}},Kr;(e=>{async function r(n){let o,i=await Promise.all(n.map(s=>s.then(a=>a,a=>{o||(o=a)})));if(typeof o<"u")throw o;return i}e.settled=r;function t(n){return new Promise(async(o,i)=>{try{await n(o,i)}catch(s){i(s)}})}e.withAsyncBody=t})(Kr||={});var pp=class r{static fromArray(t){return new r(e=>{e.emitMany(t)})}static fromPromise(t){return new r(async e=>{e.emitMany(await t)})}static fromPromisesResolveOrder(t){return new r(async e=>{await Promise.all(t.map(async n=>e.emitOne(await n)))})}static merge(t){return new r(async e=>{await Promise.all(t.map(async n=>{for await(let o of n)e.emitOne(o)}))})}static{this.EMPTY=r.fromArray([])}constructor(t,e){this._state=0,this._results=[],this._error=null,this._onReturn=e,this._onStateChanged=new E,queueMicrotask(async()=>{let n={emitOne:o=>this.emitOne(o),emitMany:o=>this.emitMany(o),reject:o=>this.reject(o)};try{await Promise.resolve(t(n)),this.resolve()}catch(o){this.reject(o)}finally{n.emitOne=void 0,n.emitMany=void 0,n.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await he.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,e){return new r(async n=>{for await(let o of t)n.emitOne(e(o))})}map(t){return r.map(this,t)}static filter(t,e){return new r(async n=>{for await(let o of t)e(o)&&n.emitOne(o)})}filter(t){return r.filter(this,t)}static coalesce(t){return r.filter(t,e=>!!e)}coalesce(){return r.coalesce(this)}static async toPromise(t){let e=[];for await(let n of t)e.push(n);return e}toPromise(){return r.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};var wI=class{constructor(t){this._deferred=new Jt;this._asyncIterable=new pp(o=>{if(e){o.reject(e);return}return n&&o.emitMany(n),this._errorFn=i=>o.reject(i),this._emitOneFn=i=>o.emitOne(i),this._emitManyFn=i=>o.emitMany(i),this._deferred.p},t);let e,n;this._errorFn=o=>{e||(e=o)},this._emitOneFn=o=>{n||(n=[]),n.push(o)},this._emitManyFn=o=>{n?o.forEach(i=>n.push(i)):n=o.slice()}}get asyncIterable(){return this._asyncIterable}resolve(){this._deferred.complete()}reject(t){this._errorFn(t),this._deferred.complete()}emitOne(t){this._emitOneFn(t)}emitMany(t){this._emitManyFn(t)}};var S_=class{constructor(){this._unsatisfiedConsumers=[];this._unconsumedValues=[]}get hasFinalValue(){return!!this._finalValue}produce(t){if(this._ensureNoFinalValue(),this._unsatisfiedConsumers.length>0){let e=this._unsatisfiedConsumers.shift();this._resolveOrRejectDeferred(e,t)}else this._unconsumedValues.push(t)}produceFinal(t){this._ensureNoFinalValue(),this._finalValue=t;for(let e of this._unsatisfiedConsumers)this._resolveOrRejectDeferred(e,t);this._unsatisfiedConsumers.length=0}_ensureNoFinalValue(){if(this._finalValue)throw new Pt("ProducerConsumer: cannot produce after final value has been set")}_resolveOrRejectDeferred(t,e){e.ok?t.complete(e.value):t.error(e.error)}consume(){if(this._unconsumedValues.length>0||this._finalValue){let t=this._unconsumedValues.length>0?this._unconsumedValues.shift():this._finalValue;return t.ok?Promise.resolve(t.value):Promise.reject(t.error)}else{let t=new Jt;return this._unsatisfiedConsumers.push(t),t.p}}},mp=class r{constructor(t,e){this._onReturn=e;this._producerConsumer=new S_;this._iterator={next:()=>this._producerConsumer.consume(),return:()=>(this._onReturn?.(),Promise.resolve({done:!0,value:void 0})),throw:async t=>(this._finishError(t),{done:!0,value:void 0})};queueMicrotask(async()=>{let n=t({emitOne:o=>this._producerConsumer.produce({ok:!0,value:{done:!1,value:o}}),emitMany:o=>{for(let i of o)this._producerConsumer.produce({ok:!0,value:{done:!1,value:i}})},reject:o=>this._finishError(o)});if(!this._producerConsumer.hasFinalValue)try{await n,this._finishOk()}catch(o){this._finishError(o)}})}static fromArray(t){return new r(e=>{e.emitMany(t)})}static fromPromise(t){return new r(async e=>{e.emitMany(await t)})}static fromPromisesResolveOrder(t){return new r(async e=>{await Promise.all(t.map(async n=>e.emitOne(await n)))})}static merge(t){return new r(async e=>{await Promise.all(t.map(async n=>{for await(let o of n)e.emitOne(o)}))})}static{this.EMPTY=r.fromArray([])}static map(t,e){return new r(async n=>{for await(let o of t)n.emitOne(e(o))})}static tee(t){let e,n,o=new Jt,i=async()=>{if(!(!e||!n))try{for await(let l of t)e.emitOne(l),n.emitOne(l)}catch(l){e.reject(l),n.reject(l)}finally{o.complete()}},s=new r(async l=>(e=l,i(),o.p)),a=new r(async l=>(n=l,i(),o.p));return[s,a]}map(t){return r.map(this,t)}static coalesce(t){return r.filter(t,e=>!!e)}coalesce(){return r.coalesce(this)}static filter(t,e){return new r(async n=>{for await(let o of t)e(o)&&n.emitOne(o)})}filter(t){return r.filter(this,t)}_finishOk(){this._producerConsumer.hasFinalValue||this._producerConsumer.produceFinal({ok:!0,value:{done:!0,value:void 0}})}_finishError(t){this._producerConsumer.hasFinalValue||this._producerConsumer.produceFinal({ok:!1,error:t})}[Symbol.asyncIterator](){return this._iterator}};function nc(r,t){return new T_(r,t)}var T_=class{constructor(t,e){this.reducer=t;this.options=e;this.state={flowing:!1,ended:!1,destroyed:!1};this.buffer={data:[],error:[]};this.listeners={data:[],error:[],end:[]};this.pendingWritePromises=[]}pause(){this.state.destroyed||(this.state.flowing=!1)}resume(){this.state.destroyed||this.state.flowing||(this.state.flowing=!0,this.flowData(),this.flowErrors(),this.flowEnd())}write(t){if(!this.state.destroyed){if(this.state.flowing)this.emitData(t);else if(this.buffer.data.push(t),typeof this.options?.highWaterMark=="number"&&this.buffer.data.length>this.options.highWaterMark)return new Promise(e=>this.pendingWritePromises.push(e))}}error(t){this.state.destroyed||(this.state.flowing?this.emitError(t):this.buffer.error.push(t))}end(t){this.state.destroyed||(typeof t<"u"&&this.write(t),this.state.flowing?(this.emitEnd(),this.destroy()):this.state.ended=!0)}emitData(t){this.listeners.data.slice(0).forEach(e=>e(t))}emitError(t){this.listeners.error.length===0?ze(t):this.listeners.error.slice(0).forEach(e=>e(t))}emitEnd(){this.listeners.end.slice(0).forEach(t=>t())}on(t,e){if(!this.state.destroyed)switch(t){case"data":this.listeners.data.push(e),this.resume();break;case"end":this.listeners.end.push(e),this.state.flowing&&this.flowEnd()&&this.destroy();break;case"error":this.listeners.error.push(e),this.state.flowing&&this.flowErrors();break}}removeListener(t,e){if(this.state.destroyed)return;let n;switch(t){case"data":n=this.listeners.data;break;case"end":n=this.listeners.end;break;case"error":n=this.listeners.error;break}if(n){let o=n.indexOf(e);o>=0&&n.splice(o,1)}}flowData(){if(this.buffer.data.length===0)return;if(typeof this.reducer=="function"){let e=this.reducer(this.buffer.data);this.emitData(e)}else for(let e of this.buffer.data)this.emitData(e);this.buffer.data.length=0;let t=[...this.pendingWritePromises];this.pendingWritePromises.length=0,t.forEach(e=>e())}flowErrors(){if(this.listeners.error.length>0){for(let t of this.buffer.error)this.emitError(t);this.buffer.error.length=0}}flowEnd(){return this.state.ended?(this.emitEnd(),this.listeners.end.length>0):!1}destroy(){this.state.destroyed||(this.state.destroyed=!0,this.state.ended=!0,this.buffer.data.length=0,this.buffer.error.length=0,this.listeners.data.length=0,this.listeners.error.length=0,this.listeners.end.length=0,this.pendingWritePromises.length=0)}};function tF(r,t){let e=[],n;for(;(n=r.read())!==null;)e.push(n);return t(e)}function kI(r,t){return new Promise((e,n)=>{let o=[];PI(r,{onData:i=>{t&&o.push(i)},onError:i=>{t?n(i):e(void 0)},onEnd:()=>{e(t?t(o):void 0)}})})}function PI(r,t,e){r.on("error",n=>{e?.isCancellationRequested||t.onError(n)}),r.on("end",()=>{e?.isCancellationRequested||t.onEnd()}),r.on("data",n=>{e?.isCancellationRequested||t.onData(n)})}function nF(r,t){let e=nc(t);return e.end(r),e}function oF(r,t,e){let n=nc(e);return PI(r,{onData:o=>n.write(t.data(o)),onError:o=>n.error(t.error?t.error(o):o),onEnd:()=>n.end()}),n}var Th=typeof Buffer<"u",i8=new mt(()=>new Uint8Array(256)),E_,w_,H=class r{static alloc(t){return Th?new r(Buffer.allocUnsafe(t)):new r(new Uint8Array(t))}static wrap(t){return Th&&!Buffer.isBuffer(t)&&(t=Buffer.from(t.buffer,t.byteOffset,t.byteLength)),new r(t)}static fromString(t,e){return!(e?.dontUseNodeBuffer||!1)&&Th?new r(Buffer.from(t)):(E_||(E_=new TextEncoder),new r(E_.encode(t)))}static fromByteArray(t){let e=r.alloc(t.length);for(let n=0,o=t.length;n<o;n++)e.buffer[n]=t[n];return e}static concat(t,e){if(typeof e>"u"){e=0;for(let i=0,s=t.length;i<s;i++)e+=t[i].byteLength}let n=r.alloc(e),o=0;for(let i=0,s=t.length;i<s;i++){let a=t[i];n.set(a,o),o+=a.byteLength}return n}static isNativeBuffer(t){return Th&&Buffer.isBuffer(t)}constructor(t){this.buffer=t,this.byteLength=this.buffer.byteLength}clone(){let t=r.alloc(this.byteLength);return t.set(this),t}toString(){return Th?this.buffer.toString():(w_||(w_=new TextDecoder(void 0,{ignoreBOM:!0})),w_.decode(this.buffer))}slice(t,e){return new r(this.buffer.subarray(t,e))}set(t,e){if(t instanceof r)this.buffer.set(t.buffer,e);else if(t instanceof Uint8Array)this.buffer.set(t,e);else if(t instanceof ArrayBuffer)this.buffer.set(new Uint8Array(t),e);else if(ArrayBuffer.isView(t))this.buffer.set(new Uint8Array(t.buffer,t.byteOffset,t.byteLength),e);else throw new Error("Unknown argument 'array'")}readUInt32BE(t){return Eh(this.buffer,t)}writeUInt32BE(t,e){wh(this.buffer,t,e)}readUInt32LE(t){return s8(this.buffer,t)}writeUInt32LE(t,e){a8(this.buffer,t,e)}readUInt8(t){return l8(this.buffer,t)}writeUInt8(t,e){d8(this.buffer,t,e)}indexOf(t,e=0){return k_(this.buffer,t instanceof r?t.buffer:t,e)}equals(t){return this===t?!0:this.byteLength!==t.byteLength?!1:this.buffer.every((e,n)=>e===t.buffer[n])}};function k_(r,t,e=0){let n=t.byteLength,o=r.byteLength;if(n===0)return 0;if(n===1)return r.indexOf(t[0],e);if(n>o-e)return-1;let i=i8.value;i.fill(t.length);for(let d=0;d<t.length;d++)i[t[d]]=t.length-d-1;let s=e+t.length-1,a=s,l=-1;for(;s<o;)if(r[s]===t[a]){if(a===0){l=s;break}s--,a--}else s+=Math.max(t.length-a,i[r[s]]),a=t.length-1;return l}function sF(r,t){return r[t+0]<<0>>>0|r[t+1]<<8>>>0}function aF(r,t,e){r[e+0]=t&255,t=t>>>8,r[e+1]=t&255}function Eh(r,t){return r[t]*2**24+r[t+1]*2**16+r[t+2]*2**8+r[t+3]}function wh(r,t,e){r[e+3]=t,t=t>>>8,r[e+2]=t,t=t>>>8,r[e+1]=t,t=t>>>8,r[e]=t}function s8(r,t){return r[t+0]<<0>>>0|r[t+1]<<8>>>0|r[t+2]<<16>>>0|r[t+3]<<24>>>0}function a8(r,t,e){r[e+0]=t&255,t=t>>>8,r[e+1]=t&255,t=t>>>8,r[e+2]=t&255,t=t>>>8,r[e+3]=t&255}function l8(r,t){return r[t]}function d8(r,t,e){r[e]=t}function lF(r){return tF(r,t=>H.concat(t))}function P_(r){return kI(r,t=>H.concat(t))}function dF(r){return nF(r,t=>H.concat(t))}function cF(r){return oF(r,{data:t=>typeof t=="string"?H.fromString(t):H.wrap(t)},t=>H.concat(t))}function Rr(r){let t=0,e=0,n=0,o=new Uint8Array(Math.floor(r.length/4*3)),i=a=>{switch(e){case 3:o[n++]=t|a,e=0;break;case 2:o[n++]=t|a>>>2,t=a<<6,e=3;break;case 1:o[n++]=t|a>>>4,t=a<<4,e=2;break;default:t=a<<2,e=1}};for(let a=0;a<r.length;a++){let l=r.charCodeAt(a);if(l>=65&&l<=90)i(l-65);else if(l>=97&&l<=122)i(l-97+26);else if(l>=48&&l<=57)i(l-48+52);else if(l===43||l===45)i(62);else if(l===47||l===95)i(63);else{if(l===61)break;throw new SyntaxError(`Unexpected base64 character ${r[a]}`)}}let s=n;for(;e>0;)i(0);return H.wrap(o).slice(0,s)}var c8="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u8="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";function Ao({buffer:r},t=!0,e=!1){let n=e?u8:c8,o="",i=r.byteLength%3,s=0;for(;s<r.byteLength-i;s+=3){let a=r[s+0],l=r[s+1],d=r[s+2];o+=n[a>>>2],o+=n[(a<<4|l>>>4)&63],o+=n[(l<<2|d>>>6)&63],o+=n[d&63]}if(i===1){let a=r[s+0];o+=n[a>>>2],o+=n[a<<4&63],t&&(o+="==")}else if(i===2){let a=r[s+0],l=r[s+1];o+=n[a>>>2],o+=n[(a<<4|l>>>4)&63],o+=n[l<<2&63],t&&(o+="=")}return o}var rF="0123456789abcdef";function gl({buffer:r}){let t="";for(let e=0;e<r.length;e++){let n=r[e];t+=rF[n>>>4],t+=rF[n&15]}return t}function kh(r){if(r.length%2!==0)throw new SyntaxError("Hex string must have an even length");let t=new Uint8Array(r.length>>1);for(let e=0;e<r.length;)t[e>>1]=iF(r,e++)<<4|iF(r,e++);return H.wrap(t)}function iF(r,t){let e=r.charCodeAt(t);if(e>=48&&e<=57)return e-48;if(e>=97&&e<=102)return e-87;if(e>=65&&e<=70)return e-55;throw new SyntaxError(`Invalid hex character at position ${t}`)}function __(r){let t=[];typeof r=="number"&&t.push("code/timeOrigin",r);function e(i,s){t.push(i,s?.startTime??Date.now())}function n(){let i=[];for(let s=0;s<t.length;s+=2)i.push({name:t[s],startTime:t[s+1]});return i}function o(i){for(let s=t.length-2;s>=0;s-=2)typeof t[s]=="string"&&t[s].startsWith(i)&&t.splice(s,2)}return{mark:e,getMarks:n,clearMarks:o}}function p8(){if(typeof performance=="object"&&typeof performance.mark=="function"&&!performance.nodeTiming)return typeof performance.timeOrigin!="number"&&!performance.timing?__():{mark(r,t){performance.mark(r,t)},clearMarks(r){let t=new Set;for(let e of performance.getEntriesByType("mark"))e.name.startsWith(r)&&t.add(e.name);for(let e of t)performance.clearMarks(e)},getMarks(){let r=performance.timeOrigin;typeof r!="number"&&(r=(performance.timing.navigationStart||performance.timing.redirectStart||performance.timing.fetchStart)??0);let t=[{name:"code/timeOrigin",startTime:Math.round(r)}];for(let e of performance.getEntriesByType("mark"))t.push({name:e.name,startTime:Math.round(r+e.startTime)});return t}};if(typeof process=="object"){let r=performance?.timeOrigin;return __(r)}else return console.trace("perf-util loaded in UNKNOWN environment"),__()}function m8(r){return r.MonacoPerformanceMarks||(r.MonacoPerformanceMarks=p8()),r.MonacoPerformanceMarks}var D_=m8(globalThis),Ft=D_.mark,g8=D_.clearMarks,pF=D_.getMarks;var bi={};q$(bi,{Promises:()=>st,RimRafMode:()=>M_,SymlinkSupport:()=>Mo,configureFlushOnWrite:()=>O_,realcase:()=>A_,realpathSync:()=>N_,whenDeleted:()=>E8,writeFileSync:()=>_8});import*as Oe from"fs";import{tmpdir as I8}from"os";import{promisify as Ph}from"util";var f8=new $r(1e4);function oc(r){return mF(r,"NFC",f8)}var h8=new $r(1e4);function _I(r){return mF(r,"NFD",h8)}var v8=/[^\u0000-\u0080]/;function mF(r,t,e){if(!r)return r;let n=e.get(r);if(n)return n;let o;return v8.test(r)?o=r.normalize(t):o=r,e.set(r,o),o}var b8=(function(){let r=new $r(1e4),t=/[\u0300-\u036f]/g;return function(e){let n=r.get(e);if(n)return n;let o=_I(e).replace(t,""),i=(o.length===e.length?o:e).toLowerCase();return r.set(e,i),i}})();var M_=(e=>(e[e.UNLINK=0]="UNLINK",e[e.MOVE=1]="MOVE",e))(M_||{});async function hF(r,t=0,e){if(d_(r))throw new Error("rimraf - will refuse to recursively delete root");return t===0?R_(r):x8(r,e)}async function x8(r,t=WU(I8())){try{try{await Oe.promises.rename(r,t)}catch(e){return e.code==="ENOENT"?void 0:R_(r)}R_(t).catch(()=>{})}catch(e){if(e.code!=="ENOENT")throw e}}async function R_(r){return Oe.promises.rm(r,{recursive:!0,force:!0,maxRetries:3})}async function DI(r,t){try{return await gF(r,t)}catch(e){if(e.code==="ENOENT"&&Ie&&d_(r))try{return await gF(`${r}.`,t)}catch{}throw e}}async function gF(r,t){return C8(await(t?S8(r):Oe.promises.readdir(r)))}async function S8(r){try{return await Oe.promises.readdir(r,{withFileTypes:!0})}catch(n){n.code!=="ENOENT"&&console.warn("[node.js fs] readdir with filetypes failed with error: ",n)}let t=[],e=await DI(r);for(let n of e){let o=!1,i=!1,s=!1;try{let a=await Oe.promises.lstat(Ne(r,n));o=a.isFile(),i=a.isDirectory(),s=a.isSymbolicLink()}catch(a){a.code!=="ENOENT"&&console.warn("[node.js fs] unexpected error from lstat after readdir: ",a)}t.push({name:n,isFile:()=>o,isDirectory:()=>i,isSymbolicLink:()=>s})}return t}function C8(r){return r.map(t=>typeof t=="string"?pt?oc(t):t:(t.name=pt?oc(t.name):t.name,t))}async function T8(r){let t=await DI(r),e=[];for(let n of t)await Mo.existsDirectory(Ne(r,n))&&e.push(n);return e}function E8(r,t=1e3){return new Promise(e=>{let n=!1,o=setInterval(()=>{n||(n=!0,Oe.access(r,i=>{n=!1,i&&(clearInterval(o),e(void 0))}))},t)})}var Mo;(n=>{async function r(o){let i;try{if(i=await Oe.promises.lstat(o),!i.isSymbolicLink())return{stat:i}}catch{}try{return{stat:await Oe.promises.stat(o),symbolicLink:i?.isSymbolicLink()?{dangling:!1}:void 0}}catch(s){if(s.code==="ENOENT"&&i)return{stat:i,symbolicLink:{dangling:!0}};if(Ie&&s.code==="EACCES")try{return{stat:await Oe.promises.stat(await Oe.promises.readlink(o)),symbolicLink:{dangling:!1}}}catch(a){if(a.code==="ENOENT"&&i)return{stat:i,symbolicLink:{dangling:!0}};throw a}throw s}}n.stat=r;async function t(o){try{let{stat:i,symbolicLink:s}=await n.stat(o);return i.isFile()&&s?.dangling!==!0}catch{}return!1}n.existsFile=t;async function e(o){try{let{stat:i,symbolicLink:s}=await n.stat(o);return i.isDirectory()&&s?.dangling!==!0}catch{}return!1}n.existsDirectory=e})(Mo||={});var w8=new dp;function k8(r,t,e){return w8.queueFor(b.file(r),()=>{let n=vF(e);return new Promise((o,i)=>P8(r,t,n,s=>s?i(s):o()))},tc)}var L_=!0;function O_(r){L_=r}function P8(r,t,e,n){if(!L_)return Oe.writeFile(r,t,{mode:e.mode,flag:e.flag},n);Oe.open(r,e.flag,e.mode,(o,i)=>{if(o)return n(o);Oe.writeFile(i,t,s=>{if(s)return Oe.close(i,()=>n(s));Oe.fdatasync(i,a=>(a&&(console.warn("[node.js fs] fdatasync is now disabled for this session because it failed: ",a),O_(!1)),Oe.close(i,l=>n(l))))})})}function _8(r,t,e){let n=vF(e);if(!L_)return Oe.writeFileSync(r,t,{mode:n.mode,flag:n.flag});let o=Oe.openSync(r,n.flag,n.mode);try{Oe.writeFileSync(o,t);try{Oe.fdatasyncSync(o)}catch(i){console.warn("[node.js fs] fdatasyncSync is now disabled for this session because it failed: ",i),O_(!1)}}finally{Oe.closeSync(o)}}function vF(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 D8(r,t,e=6e4){if(r!==t)try{Ie&&typeof e=="number"?await bF(r,t,Date.now(),e):await Oe.promises.rename(r,t)}catch(n){if(r.toLowerCase()!==t.toLowerCase()&&n.code==="EXDEV"||r.endsWith("."))await yF(r,t,{preserveSymlinks:!1}),await hF(r,1);else throw n}}async function bF(r,t,e,n,o=0){try{return await Oe.promises.rename(r,t)}catch(i){if(i.code!=="EACCES"&&i.code!=="EPERM"&&i.code!=="EBUSY")throw i;if(Date.now()-e>=n)throw console.error(`[node.js fs] rename failed after ${o} retries with error: ${i}`),i;if(o===0){let s=!1;try{let{stat:a}=await Mo.stat(t);a.isFile()||(s=!0)}catch{}if(s)throw i}return await Ut(Math.min(100,o*10)),bF(r,t,e,n,o+1)}}async function yF(r,t,e){return IF(r,t,{root:{source:r,target:t},options:e,handledSourcePaths:new Set})}var fF=511;async function IF(r,t,e){if(e.handledSourcePaths.has(r))return;e.handledSourcePaths.add(r);let{stat:n,symbolicLink:o}=await Mo.stat(r);if(o){if(e.options.preserveSymlinks)try{return await M8(r,t,e)}catch{}if(o.dangling)return}return n.isDirectory()?R8(r,t,n.mode&fF,e):A8(r,t,n.mode&fF)}async function R8(r,t,e,n){await Oe.promises.mkdir(t,{recursive:!0,mode:e});let o=await DI(r);for(let i of o)await IF(Ne(r,i),Ne(t,i),n)}async function A8(r,t,e){await Oe.promises.copyFile(r,t),await Oe.promises.chmod(t,e)}async function M8(r,t,e){let n=await Oe.promises.readlink(r);_r(n,e.root.source,!Qe)&&(n=Ne(e.root.target,n.substr(e.root.source.length+1))),await Oe.promises.symlink(n,t)}async function A_(r,t){if(Qe)return r;let e=cn(r);if(r===e)return r;let n=(nt(r)||r).toLowerCase();try{if(t?.isCancellationRequested)return null;let i=(await st.readdir(e)).filter(s=>s.toLowerCase()===n);if(i.length===1){let s=await A_(e,t);if(s)return Ne(s,i[0])}else if(i.length>1){let s=i.indexOf(n);if(s>=0){let a=await A_(e,t);if(a)return Ne(a,i[s])}}}catch{}return null}async function L8(r){try{return await Ph(Oe.realpath)(r)}catch{let t=xF(r);return await Oe.promises.access(t,Oe.constants.R_OK),t}}function N_(r){try{return Oe.realpathSync(r)}catch{let t=xF(r);return Oe.accessSync(t,Oe.constants.R_OK),t}}function xF(r){return mr(bo(r),xt)}var st=new class{get read(){return(r,t,e,n,o)=>new Promise((i,s)=>{Oe.read(r,t,e,n,o,(a,l,d)=>a?s(a):i({bytesRead:l,buffer:d}))})}get write(){return(r,t,e,n,o)=>new Promise((i,s)=>{Oe.write(r,t,e,n,o,(a,l,d)=>a?s(a):i({bytesWritten:l,buffer:d}))})}get fdatasync(){return Ph(Oe.fdatasync)}get open(){return Ph(Oe.open)}get close(){return Ph(Oe.close)}get ftruncate(){return Ph(Oe.ftruncate)}async exists(r){try{return await Oe.promises.access(r),!0}catch{return!1}}get readdir(){return DI}get readDirsInDir(){return T8}get writeFile(){return k8}get rm(){return hF}get rename(){return D8}get copy(){return yF}get realpath(){return L8}};function SF(r){return(t,e,n)=>{let o=null,i=null;if(typeof n.value=="function"?(o="value",i=n.value):typeof n.get=="function"&&(o="get",i=n.get),!i||typeof e=="symbol")throw new Error("not supported");n[o]=r(i,e)}}function RI(r,t,e){let n=null,o=null;if(typeof e.value=="function"?(n="value",o=e.value,o.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof e.get=="function"&&(n="get",o=e.get),!o)throw new Error("not supported");let i=`$memoize$${t}`;e[n]=function(...s){return this.hasOwnProperty(i)||Object.defineProperty(this,i,{configurable:!1,enumerable:!1,writable:!1,value:o.apply(this,s)}),this[i]}}function rc(r,t,e){return SF((n,o)=>{let i=`$debounce$${o}`,s=`$debounce$result$${o}`;return function(...a){this[s]||(this[s]=e?e():void 0),clearTimeout(this[i]),t&&(this[s]=t(this[s],...a),a=[this[s]]),this[i]=setTimeout(()=>{n.apply(this,a),this[s]=e?e():void 0},r)}})}function CF(r,t,e){return SF((n,o)=>{let i=`$throttle$timer$${o}`,s=`$throttle$result$${o}`,a=`$throttle$lastRun$${o}`,l=`$throttle$pending$${o}`;return function(...d){if(this[s]||(this[s]=e?e():void 0),(this[a]===null||this[a]===void 0)&&(this[a]=-Number.MAX_VALUE),t&&(this[s]=t(this[s],...d)),this[l])return;let c=this[a]+r;c<=Date.now()?(this[a]=Date.now(),n.apply(this,[this[s]]),this[s]=e?e():void 0):(this[l]=!0,this[i]=setTimeout(()=>{this[l]=!1,this[a]=Date.now(),n.apply(this,[this[s]]),this[s]=e?e():void 0},c-Date.now()))}})}function TF(r){return JSON.stringify(r,O8)}function AI(r){let t=JSON.parse(r);return t=ht(t),t}function O8(r,t){return t instanceof RegExp?{$mid:2,source:t.source,flags:t.flags}:t}function ht(r,t=0){if(!r||t>200)return r;if(typeof r=="object"){switch(r.$mid){case 1:return b.revive(r);case 2:return new RegExp(r.source,r.flags);case 17:return new Date(r.source)}if(r instanceof H||r instanceof Uint8Array)return r;if(Array.isArray(r))for(let e=0;e<r.length;++e)r[e]=ht(r[e],t+1);else for(let e in r)Object.hasOwnProperty.call(r,e)&&(r[e]=ht(r[e],t+1))}return r}function EF(r){switch(r){case 100:return"req";case 101:return"cancel";case 102:return"subscribe";case 103:return"unsubscribe"}}function wF(r){switch(r){case 200:return"init";case 201:return"reply:";case 202:case 203:return"replyErr:";case 204:return"event:"}}function hp(r){let t=0;for(let e=0;;e+=7){let n=r.read(1);if(t|=(n.buffer[0]&127)<<e,!(n.buffer[0]&128))return t}}var N8=fl(0);function vp(r,t){if(t===0){r.write(N8);return}let e=0;for(let o=t;o!==0;o=o>>>7)e++;let n=H.alloc(e);for(let o=0;t!==0;o++)n.buffer[o]=t&127,t=t>>>7,t>0&&(n.buffer[o]|=128);r.write(n)}var U_=class{constructor(t){this.buffer=t;this.pos=0}read(t){let e=this.buffer.slice(this.pos,this.pos+t);return this.pos+=e.byteLength,e}},F_=class{constructor(){this.buffers=[]}get buffer(){return H.concat(this.buffers)}write(t){this.buffers.push(t)}};function fl(r){let t=H.alloc(1);return t.writeUInt8(r,0),t}var ic={Undefined:fl(0),String:fl(1),Buffer:fl(2),VSBuffer:fl(3),Array:fl(4),Object:fl(5),Uint:fl(6)};function H_(r,t){if(typeof t>"u")r.write(ic.Undefined);else if(typeof t=="string"){let e=H.fromString(t);r.write(ic.String),vp(r,e.byteLength),r.write(e)}else if(H.isNativeBuffer(t)){let e=H.wrap(t);r.write(ic.Buffer),vp(r,e.byteLength),r.write(e)}else if(t instanceof H)r.write(ic.VSBuffer),vp(r,t.byteLength),r.write(t);else if(Array.isArray(t)){r.write(ic.Array),vp(r,t.length);for(let e of t)H_(r,e)}else if(typeof t=="number"&&(t|0)===t)r.write(ic.Uint),vp(r,t);else{let e=H.fromString(JSON.stringify(t));r.write(ic.Object),vp(r,e.byteLength),r.write(e)}}function W_(r){switch(r.read(1).readUInt8(0)){case 0:return;case 1:return r.read(hp(r)).toString();case 2:return r.read(hp(r)).buffer;case 3:return r.read(hp(r));case 4:{let e=hp(r),n=[];for(let o=0;o<e;o++)n.push(W_(r));return n}case 5:return JSON.parse(r.read(hp(r)).toString());case 6:return hp(r)}}var _h=class{constructor(t,e=null){this.protocol=t;this.isDisposed=!1;this.state=0;this.activeRequests=new Set;this.handlers=new Map;this.lastRequestId=0;this._onDidInitialize=new E;this.onDidInitialize=this._onDidInitialize.event;this.protocolListener=this.protocol.onMessage(n=>this.onBuffer(n)),this.logger=e}getChannel(t){let e=this;return{call(n,o,i){return e.isDisposed?Promise.reject(new Be):e.requestPromise(t,n,o,i)},listen(n,o){return e.isDisposed?he.None:e.requestEvent(t,n,o)}}}requestPromise(t,e,n,o=ve.None){let i=this.lastRequestId++,a={id:i,type:100,channelName:t,name:e,arg:n};if(o.isCancellationRequested)return Promise.reject(new Be);let l,d;return new Promise((u,m)=>{if(o.isCancellationRequested)return m(new Be);let g=()=>{let I=S=>{switch(S.type){case 201:this.handlers.delete(i),u(S.data);break;case 202:{this.handlers.delete(i);let T=new Error(S.data.message);T.stack=Array.isArray(S.data.stack)?S.data.stack.join(`
`):S.data.stack,T.name=S.data.name,m(T);break}case 203:this.handlers.delete(i),m(S.data);break}};this.handlers.set(i,I),this.sendRequest(a)},h=null;this.state===1?g():(h=fr(I=>this.whenInitialized()),h.then(()=>{h=null,g()}));let f=()=>{h?(h.cancel(),h=null):this.sendRequest({id:i,type:101}),m(new Be)};l=o.onCancellationRequested(f),d={dispose:el(()=>{f(),l.dispose()})},this.activeRequests.add(d)}).finally(()=>{l?.dispose(),this.activeRequests.delete(d)})}requestEvent(t,e,n){let o=this.lastRequestId++,s={id:o,type:102,channelName:t,name:e,arg:n},a=null,l=new E({onWillAddFirstListener:()=>{let c=()=>{this.activeRequests.add(l),this.sendRequest(s)};this.state===1?c():(a=fr(u=>this.whenInitialized()),a.then(()=>{a=null,c()}))},onDidRemoveLastListener:()=>{a?(a.cancel(),a=null):(this.activeRequests.delete(l),this.sendRequest({id:o,type:103})),this.handlers.delete(o)}}),d=c=>l.fire(c.data);return this.handlers.set(o,d),l.event}sendRequest(t){switch(t.type){case 100:case 102:{let e=this.send([t.type,t.id,t.channelName,t.name],t.arg);this.logger?.logOutgoing(e,t.id,0,`${EF(t.type)}: ${t.channelName}.${t.name}`,t.arg);return}case 101:case 103:{let e=this.send([t.type,t.id]);this.logger?.logOutgoing(e,t.id,0,EF(t.type));return}}}send(t,e=void 0){let n=new F_;return H_(n,t),H_(n,e),this.sendBuffer(n.buffer)}sendBuffer(t){try{return this.protocol.send(t),t.byteLength}catch{return 0}}onBuffer(t){let e=new U_(t),n=W_(e),o=W_(e),i=n[0];switch(i){case 200:return this.logger?.logIncoming(t.byteLength,0,0,wF(i)),this.onResponse({type:n[0]});case 201:case 202:case 204:case 203:return this.logger?.logIncoming(t.byteLength,n[1],0,wF(i),o),this.onResponse({type:n[0],id:n[1],data:o})}}onResponse(t){if(t.type===200){this.state=1,this._onDidInitialize.fire();return}this.handlers.get(t.id)?.(t)}get onDidInitializePromise(){return he.toPromise(this.onDidInitialize)}whenInitialized(){return this.state===1?Promise.resolve():this.onDidInitializePromise}dispose(){this.isDisposed=!0,this.protocolListener&&(this.protocolListener.dispose(),this.protocolListener=null),Cn(this.activeRequests.values()),this.activeRequests.clear(),this._onDidInitialize.dispose()}};_([RI],_h.prototype,"onDidInitializePromise",1);function kF(r){let t=!1;return{call(e,n,o){return t?r.call(e,n,o):Ut(0).then(()=>t=!0).then(()=>r.call(e,n,o))},listen(e,n){if(t)return r.listen(e,n);let o=new rI;return Ut(0).then(()=>t=!0).then(()=>o.input=r.listen(e,n)),o.event}}}var V_;(o=>{function r(i,s,a){let l=i,d=a?.disableMarshalling,c=new Map;for(let u in l)e(u)&&c.set(u,he.buffer(l[u],u,!0,void 0,s));return new class{listen(u,m,g){let h=c.get(m);if(h)return h;let f=l[m];if(typeof f=="function"){if(n(m))return f.call(l,g);if(e(m))return c.set(m,he.buffer(l[m],m,!0,void 0,s)),c.get(m)}throw new ho(`Event not found: ${m}`)}call(u,m,g){let h=l[m];if(typeof h=="function"){if(!d&&Array.isArray(g))for(let I=0;I<g.length;I++)g[I]=ht(g[I]);let f=h.apply(l,g);return f instanceof Promise||(f=Promise.resolve(f)),f}throw new ho(`Method not found: ${m}`)}}}o.fromService=r;function t(i,s){let a=s?.disableMarshalling;return new Proxy({},{get(l,d){if(typeof d=="string")return s?.properties?.has(d)?s.properties.get(d):n(d)?function(c){return i.listen(d,c)}:e(d)?i.listen(d):async function(...c){let u;s&&!Ot(s.context)?u=[s.context,...c]:u=c;let m=await i.call(d,u);return a?m:ht(m)};throw new ho(`Property not found: ${String(d)}`)}})}o.toService=t;function e(i){return i[0]==="o"&&i[1]==="n"&&i_(i.charCodeAt(2))}function n(i){return/^onDynamic/.test(i)&&i_(i.charCodeAt(9))}})(V_||={});var Rh;(s=>{s.enableDiagnostics=!1,s.records=[];let e=new WeakMap,n=0;function o(a,l){if(!e.has(a)){let d=String(++n);e.set(a,d)}return e.get(a)}function i(a,l,d,c){}s.traceSocketEvent=i})(Rh||={});var B_=null;function hl(){return B_||(B_=H.alloc(0)),B_}var Dh=class{get byteLength(){return this._totalLength}constructor(){this._chunks=[],this._totalLength=0}acceptChunk(t){this._chunks.push(t),this._totalLength+=t.byteLength}read(t){return this._read(t,!0)}peek(t){return this._read(t,!1)}_read(t,e){if(t===0)return hl();if(t>this._totalLength)throw new Error("Cannot read so many bytes!");if(this._chunks[0].byteLength===t){let s=this._chunks[0];return e&&(this._chunks.shift(),this._totalLength-=t),s}if(this._chunks[0].byteLength>t){let s=this._chunks[0].slice(0,t);return e&&(this._chunks[0]=this._chunks[0].slice(t),this._totalLength-=t),s}let n=H.alloc(t),o=0,i=0;for(;t>0;){let s=this._chunks[i];if(s.byteLength>t){let a=s.slice(0,t);n.set(a,o),o+=t,e&&(this._chunks[i]=s.slice(t),this._totalLength-=t),t-=t}else n.set(s,o),o+=s.byteLength,e?(this._chunks.shift(),this._totalLength-=s.byteLength):i++,t-=s.byteLength}return n}};function PF(r){switch(r){case 0:return"None";case 1:return"Regular";case 2:return"Control";case 3:return"Ack";case 5:return"Disconnect";case 6:return"ReplayRequest";case 7:return"PauseWriting";case 8:return"ResumeWriting";case 9:return"KeepAlive"}}var jr=class{constructor(t,e,n,o){this.type=t;this.id=e;this.ack=n;this.data=o;this.writtenTime=0}get size(){return this.data.byteLength}},MI=class extends O{constructor(e){super();this._onMessage=this._register(new E);this.onMessage=this._onMessage.event;this._state={readHead:!0,readLen:13,messageType:0,id:0,ack:0};this._socket=e,this._isDisposed=!1,this._incomingData=new Dh,this._register(this._socket.onData(n=>this.acceptChunk(n))),this.lastReadTime=Date.now()}acceptChunk(e){if(!(!e||e.byteLength===0))for(this.lastReadTime=Date.now(),this._incomingData.acceptChunk(e);this._incomingData.byteLength>=this._state.readLen;){let n=this._incomingData.read(this._state.readLen);if(this._state.readHead)this._state.readHead=!1,this._state.readLen=n.readUInt32BE(9),this._state.messageType=n.readUInt8(0),this._state.id=n.readUInt32BE(1),this._state.ack=n.readUInt32BE(5),this._socket.traceSocketEvent("protocolHeaderRead",{messageType:PF(this._state.messageType),id:this._state.id,ack:this._state.ack,messageSize:this._state.readLen});else{let o=this._state.messageType,i=this._state.id,s=this._state.ack;if(this._state.readHead=!0,this._state.readLen=13,this._state.messageType=0,this._state.id=0,this._state.ack=0,this._socket.traceSocketEvent("protocolMessageRead",n),this._onMessage.fire(new jr(o,i,s,n)),this._isDisposed)break}}}readEntireBuffer(){return this._incomingData.read(this._incomingData.byteLength)}dispose(){this._isDisposed=!0,super.dispose()}},LI=class{constructor(t){this._writeNowTimeout=null;this._isDisposed=!1,this._isPaused=!1,this._socket=t,this._data=[],this._totalLength=0,this.lastWriteTime=0}dispose(){try{this.flush()}catch{}this._isDisposed=!0}drain(){return this.flush(),this._socket.drain()}flush(){this._writeNow()}pause(){this._isPaused=!0}resume(){this._isPaused=!1,this._scheduleWriting()}write(t){if(this._isDisposed)return;t.writtenTime=Date.now(),this.lastWriteTime=Date.now();let e=H.alloc(13);e.writeUInt8(t.type,0),e.writeUInt32BE(t.id,1),e.writeUInt32BE(t.ack,5),e.writeUInt32BE(t.data.byteLength,9),this._socket.traceSocketEvent("protocolHeaderWrite",{messageType:PF(t.type),id:t.id,ack:t.ack,messageSize:t.data.byteLength}),this._socket.traceSocketEvent("protocolMessageWrite",t.data),this._writeSoon(e,t.data)}_bufferAdd(t,e){let n=this._totalLength===0;return this._data.push(t,e),this._totalLength+=t.byteLength+e.byteLength,n}_bufferTake(){let t=H.concat(this._data,this._totalLength);return this._data.length=0,this._totalLength=0,t}_writeSoon(t,e){this._bufferAdd(t,e)&&this._scheduleWriting()}_scheduleWriting(){this._writeNowTimeout||(this._writeNowTimeout=setTimeout(()=>{this._writeNowTimeout=null,this._writeNow()}))}_writeNow(){if(this._totalLength===0||this._isPaused)return;let t=this._bufferTake();this._socket.traceSocketEvent("protocolWrite",{byteLength:t.byteLength}),this._socket.write(t)}};var as=class{constructor(){this._hasListeners=!1;this._isDeliveringMessages=!1;this._bufferedMessages=[];this._emitter=new E({onWillAddFirstListener:()=>{this._hasListeners=!0,queueMicrotask(()=>this._deliverMessages())},onDidRemoveLastListener:()=>{this._hasListeners=!1}}),this.event=this._emitter.event}_deliverMessages(){if(!this._isDeliveringMessages){for(this._isDeliveringMessages=!0;this._hasListeners&&this._bufferedMessages.length>0;)this._emitter.fire(this._bufferedMessages.shift());this._isDeliveringMessages=!1}}fire(t){this._hasListeners?this._bufferedMessages.length>0?this._bufferedMessages.push(t):this._emitter.fire(t):this._bufferedMessages.push(t)}flushBuffer(){this._bufferedMessages=[]}},$_=class{constructor(t){this.data=t,this.next=null}},z_=class{constructor(){this._first=null,this._last=null}length(){let t=0,e=this._first;for(;e;)e=e.next,t++;return t}peek(){return this._first?this._first.data:null}toArray(){let t=[],e=0,n=this._first;for(;n;)t[e++]=n.data,n=n.next;return t}pop(){if(this._first){if(this._first===this._last){this._first=null,this._last=null;return}this._first=this._first.next}}push(t){let e=new $_(t);if(!this._first){this._first=e,this._last=e;return}this._last.next=e,this._last=e}},q_=class r{static{this._HISTORY_LENGTH=10}static{this._INSTANCE=null}static getInstance(){return r._INSTANCE||(r._INSTANCE=new r),r._INSTANCE}constructor(){this.lastRuns=[];let t=Date.now();for(let e=0;e<r._HISTORY_LENGTH;e++)this.lastRuns[e]=t-1e3*e;setInterval(()=>{for(let e=r._HISTORY_LENGTH;e>=1;e--)this.lastRuns[e]=this.lastRuns[e-1];this.lastRuns[0]=Date.now()},1e3)}load(){let t=Date.now(),e=(1+r._HISTORY_LENGTH)*1e3,n=0;for(let o=0;o<r._HISTORY_LENGTH;o++)t-this.lastRuns[o]<=e&&n++;return 1-n/r._HISTORY_LENGTH}hasHighLoad(){return this.load()>=.5}},sc=class{constructor(t){this._onControlMessage=new as;this.onControlMessage=this._onControlMessage.event;this._onMessage=new as;this.onMessage=this._onMessage.event;this._onDidDispose=new as;this.onDidDispose=this._onDidDispose.event;this._onSocketClose=new as;this.onSocketClose=this._onSocketClose.event;this._onSocketTimeout=new as;this.onSocketTimeout=this._onSocketTimeout.event;this._loadEstimator=t.loadEstimator??q_.getInstance(),this._shouldSendKeepAlive=t.sendKeepAlive??!0,this._isReconnecting=!1,this._outgoingUnackMsg=new z_,this._outgoingMsgId=0,this._outgoingAckId=0,this._outgoingAckTimeout=null,this._incomingMsgId=0,this._incomingAckId=0,this._incomingMsgLastTime=0,this._incomingAckTimeout=null,this._lastReplayRequestTime=0,this._lastSocketTimeoutTime=Date.now(),this._socketDisposables=new $,this._socket=t.socket,this._socketWriter=this._socketDisposables.add(new LI(this._socket)),this._socketReader=this._socketDisposables.add(new MI(this._socket)),this._socketDisposables.add(this._socketReader.onMessage(e=>this._receiveMessage(e))),this._socketDisposables.add(this._socket.onClose(e=>this._onSocketClose.fire(e))),t.initialChunk&&this._socketReader.acceptChunk(t.initialChunk),this._shouldSendKeepAlive?this._keepAliveInterval=setInterval(()=>{this._sendKeepAlive()},5e3):this._keepAliveInterval=null}get unacknowledgedCount(){return this._outgoingMsgId-this._outgoingAckId}dispose(){this._outgoingAckTimeout&&(clearTimeout(this._outgoingAckTimeout),this._outgoingAckTimeout=null),this._incomingAckTimeout&&(clearTimeout(this._incomingAckTimeout),this._incomingAckTimeout=null),this._keepAliveInterval&&(clearInterval(this._keepAliveInterval),this._keepAliveInterval=null),this._socketDisposables.dispose()}drain(){return this._socketWriter.drain()}sendDisconnect(){if(!this._didSendDisconnect){this._didSendDisconnect=!0;let t=new jr(5,0,0,hl());this._socketWriter.write(t),this._socketWriter.flush()}}sendPause(){let t=new jr(7,0,0,hl());this._socketWriter.write(t)}sendResume(){let t=new jr(8,0,0,hl());this._socketWriter.write(t)}pauseSocketWriting(){this._socketWriter.pause()}getSocket(){return this._socket}getMillisSinceLastIncomingData(){return Date.now()-this._socketReader.lastReadTime}beginAcceptReconnection(t,e){this._isReconnecting=!0,this._socketDisposables.dispose(),this._socketDisposables=new $,this._onControlMessage.flushBuffer(),this._onSocketClose.flushBuffer(),this._onSocketTimeout.flushBuffer(),this._socket.dispose(),this._lastReplayRequestTime=0,this._lastSocketTimeoutTime=Date.now(),this._socket=t,this._socketWriter=this._socketDisposables.add(new LI(this._socket)),this._socketReader=this._socketDisposables.add(new MI(this._socket)),this._socketDisposables.add(this._socketReader.onMessage(n=>this._receiveMessage(n))),this._socketDisposables.add(this._socket.onClose(n=>this._onSocketClose.fire(n))),this._socketReader.acceptChunk(e)}endAcceptReconnection(){this._isReconnecting=!1,this._incomingAckId=this._incomingMsgId;let t=new jr(3,0,this._incomingAckId,hl());this._socketWriter.write(t);let e=this._outgoingUnackMsg.toArray();for(let n=0,o=e.length;n<o;n++)this._socketWriter.write(e[n]);this._recvAckCheck()}acceptDisconnect(){this._onDidDispose.fire()}_receiveMessage(t){if(t.ack>this._outgoingAckId){this._outgoingAckId=t.ack;do{let e=this._outgoingUnackMsg.peek();if(e&&e.id<=t.ack)this._outgoingUnackMsg.pop();else break}while(!0)}switch(t.type){case 0:break;case 1:{if(t.id>this._incomingMsgId)if(t.id!==this._incomingMsgId+1){let e=Date.now();e-this._lastReplayRequestTime>1e4&&(this._lastReplayRequestTime=e,this._socketWriter.write(new jr(6,0,0,hl())))}else this._incomingMsgId=t.id,this._incomingMsgLastTime=Date.now(),this._sendAckCheck(),this._onMessage.fire(t.data);break}case 2:{this._onControlMessage.fire(t.data);break}case 3:break;case 5:{this._onDidDispose.fire();break}case 6:{let e=this._outgoingUnackMsg.toArray();for(let n=0,o=e.length;n<o;n++)this._socketWriter.write(e[n]);this._recvAckCheck();break}case 7:{this._socketWriter.pause();break}case 8:{this._socketWriter.resume();break}case 9:break}}readEntireBuffer(){return this._socketReader.readEntireBuffer()}flush(){this._socketWriter.flush()}send(t){let e=++this._outgoingMsgId;this._incomingAckId=this._incomingMsgId;let n=new jr(1,e,this._incomingAckId,t);this._outgoingUnackMsg.push(n),this._isReconnecting||(this._socketWriter.write(n),this._recvAckCheck())}sendControl(t){let e=new jr(2,0,0,t);this._socketWriter.write(e)}_sendAckCheck(){if(this._incomingMsgId<=this._incomingAckId||this._incomingAckTimeout)return;let t=Date.now()-this._incomingMsgLastTime;if(t>=2e3){this._sendAck();return}this._incomingAckTimeout=setTimeout(()=>{this._incomingAckTimeout=null,this._sendAckCheck()},2e3-t+5)}_recvAckCheck(){if(this._outgoingMsgId<=this._outgoingAckId||this._outgoingAckTimeout||this._isReconnecting)return;let t=this._outgoingUnackMsg.peek(),e=Date.now()-t.writtenTime,n=Date.now()-this._socketReader.lastReadTime,o=Date.now()-this._lastSocketTimeoutTime;if(e>=2e4&&n>=2e4&&o>=2e4&&!this._loadEstimator.hasHighLoad()){this._lastSocketTimeoutTime=Date.now(),this._onSocketTimeout.fire({unacknowledgedMsgCount:this._outgoingUnackMsg.length(),timeSinceOldestUnacknowledgedMsg:e,timeSinceLastReceivedSomeData:n});return}let i=Math.max(2e4-e,2e4-n,2e4-o,500);this._outgoingAckTimeout=setTimeout(()=>{this._outgoingAckTimeout=null,this._recvAckCheck()},i)}_sendAck(){if(this._incomingMsgId<=this._incomingAckId)return;this._incomingAckId=this._incomingMsgId;let t=new jr(3,0,this._incomingAckId,hl());this._socketWriter.write(t)}_sendKeepAlive(){this._incomingAckId=this._incomingMsgId;let t=new jr(9,0,this._incomingAckId,hl());this._socketWriter.write(t)}};import{createHash as uee}from"crypto";import{createConnection as fee,createServer as hee}from"net";import{tmpdir as F8}from"os";import{createDeflateRaw as H8,createInflateRaw as W8}from"zlib";var Ae=(function(){if(typeof crypto.randomUUID=="function")return crypto.randomUUID.bind(crypto);let r=new Uint8Array(16),t=[];for(let e=0;e<256;e++)t.push(e.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,o="";return o+=t[r[n++]],o+=t[r[n++]],o+=t[r[n++]],o+=t[r[n++]],o+="-",o+=t[r[n++]],o+=t[r[n++]],o+="-",o+=t[r[n++]],o+=t[r[n++]],o+="-",o+=t[r[n++]],o+=t[r[n++]],o+="-",o+=t[r[n++]],o+=t[r[n++]],o+=t[r[n++]],o+=t[r[n++]],o+=t[r[n++]],o+=t[r[n++]],o}})();var V8=3e4,oa=class{constructor(t,e=""){this._canWrite=!0;this.debugLabel=e,this.socket=t,this.traceSocketEvent("created",{type:"NodeSocket"}),this._errorListener=o=>{if(this.traceSocketEvent("error",{code:o?.code,message:o?.message}),o){if(o.code==="EPIPE")return;ze(o)}},this.socket.on("error",this._errorListener);let n;this._closeListener=o=>{this.traceSocketEvent("close",{hadError:o}),this._canWrite=!1,n&&clearTimeout(n)},this.socket.on("close",this._closeListener),this._endListener=()=>{this.traceSocketEvent("nodeEndReceived"),this._canWrite=!1,n=setTimeout(()=>t.destroy(),V8)},this.socket.on("end",this._endListener)}traceSocketEvent(t,e){Rh.traceSocketEvent(this.socket,this.debugLabel,t,e)}dispose(){this.socket.off("error",this._errorListener),this.socket.off("close",this._closeListener),this.socket.off("end",this._endListener),this.socket.destroy()}onData(t){let e=n=>{this.traceSocketEvent("read",n),t(H.wrap(n))};return this.socket.on("data",e),{dispose:()=>this.socket.off("data",e)}}onClose(t){let e=n=>{t({type:0,hadError:n,error:void 0})};return this.socket.on("close",e),{dispose:()=>this.socket.off("close",e)}}onEnd(t){let e=()=>{t()};return this.socket.on("end",e),{dispose:()=>this.socket.off("end",e)}}write(t){if(!(this.socket.destroyed||!this._canWrite))try{this.traceSocketEvent("write",t),this.socket.write(t.buffer,e=>{if(e){if(e.code==="EPIPE")return;ze(e)}})}catch(e){if(e.code==="EPIPE")return;ze(e)}}end(){this.traceSocketEvent("nodeEndSent"),this.socket.end()}drain(){return this.traceSocketEvent("nodeDrainBegin"),new Promise((t,e)=>{if(this.socket.bufferSize===0){this.traceSocketEvent("nodeDrainEnd"),t();return}let n=()=>{this.socket.off("close",n),this.socket.off("end",n),this.socket.off("error",n),this.socket.off("timeout",n),this.socket.off("drain",n),this.traceSocketEvent("nodeDrainEnd"),t()};this.socket.on("close",n),this.socket.on("end",n),this.socket.on("error",n),this.socket.on("timeout",n),this.socket.on("drain",n)})}};var OI=class extends O{constructor(e,n,o,i,s=!0){super();this._onData=this._register(new E);this._onClose=this._register(new E);this._isEnded=!1;this._state={state:1,readLen:2,fin:0,compressed:!1,firstFrameOfMessage:!0,mask:0,opcode:0};this.socket=e,this._maxSocketMessageLength=s?262144:1/0,this.traceSocketEvent("created",{type:"WebSocketNodeSocket",permessageDeflate:n,inflateBytesLength:o?.byteLength||0,recordInflateBytes:i}),this._flowManager=this._register(new K_(this,n,o,i,this._onData,(a,l)=>this._write(a,l))),this._register(this._flowManager.onError(a=>{console.error(a),ze(a),this._onClose.fire({type:0,hadError:!0,error:a})})),this._incomingData=new Dh,this._register(this.socket.onData(a=>this._acceptChunk(a))),this._register(this.socket.onClose(async a=>{this._flowManager.isProcessingReadQueue()&&await he.toPromise(this._flowManager.onDidFinishProcessingReadQueue),this._onClose.fire(a)}))}get permessageDeflate(){return this._flowManager.permessageDeflate}get recordedInflateBytes(){return this._flowManager.recordedInflateBytes}setRecordInflateBytes(e){this._flowManager.setRecordInflateBytes(e)}traceSocketEvent(e,n){this.socket.traceSocketEvent(e,n)}dispose(){this._flowManager.isProcessingWriteQueue()?this._register(this._flowManager.onDidFinishProcessingWriteQueue(()=>{this.dispose()})):(this.socket.dispose(),super.dispose())}onData(e){return this._onData.event(e)}onClose(e){return this._onClose.event(e)}onEnd(e){return this.socket.onEnd(e)}write(e){let n=0;for(;n<e.byteLength;)this._flowManager.writeMessage(e.slice(n,Math.min(n+this._maxSocketMessageLength,e.byteLength)),{compressed:!0,opcode:2}),n+=this._maxSocketMessageLength}_write(e,{compressed:n,opcode:o}){if(this._isEnded)return;this.traceSocketEvent("webSocketNodeSocketWrite",e);let i=2;e.byteLength<126?i+=0:e.byteLength<2**16?i+=2:i+=8;let s=H.alloc(i),a=n?64:0,l=o&15;if(s.writeUInt8(128|a|l,0),e.byteLength<126)s.writeUInt8(e.byteLength,1);else if(e.byteLength<2**16){s.writeUInt8(126,1);let d=1;s.writeUInt8(e.byteLength>>>8&255,++d),s.writeUInt8(e.byteLength>>>0&255,++d)}else{s.writeUInt8(127,1);let d=1;s.writeUInt8(0,++d),s.writeUInt8(0,++d),s.writeUInt8(0,++d),s.writeUInt8(0,++d),s.writeUInt8(e.byteLength>>>24&255,++d),s.writeUInt8(e.byteLength>>>16&255,++d),s.writeUInt8(e.byteLength>>>8&255,++d),s.writeUInt8(e.byteLength>>>0&255,++d)}this.socket.write(H.concat([s,e]))}end(){this._isEnded=!0,this.socket.end()}_acceptChunk(e){if(e.byteLength!==0){for(this._incomingData.acceptChunk(e);this._incomingData.byteLength>=this._state.readLen;)if(this._state.state===1){let n=this._incomingData.peek(this._state.readLen),o=n.readUInt8(0),i=(o&128)>>>7,s=(o&64)>>>6,a=o&15,l=n.readUInt8(1),d=(l&128)>>>7,c=l&127;this._state.state=2,this._state.readLen=2+(d?4:0)+(c===126?2:0)+(c===127?8:0),this._state.fin=i,this._state.firstFrameOfMessage&&(this._state.compressed=!!s),this._state.firstFrameOfMessage=!!i,this._state.mask=0,this._state.opcode=a,this.traceSocketEvent("webSocketNodeSocketPeekedHeader",{headerSize:this._state.readLen,compressed:this._state.compressed,fin:this._state.fin,opcode:this._state.opcode})}else if(this._state.state===2){let n=this._incomingData.read(this._state.readLen),o=n.readUInt8(1),i=(o&128)>>>7,s=o&127,a=1;s===126?s=n.readUInt8(++a)*2**8+n.readUInt8(++a):s===127&&(s=n.readUInt8(++a)*0+n.readUInt8(++a)*0+n.readUInt8(++a)*0+n.readUInt8(++a)*0+n.readUInt8(++a)*2**24+n.readUInt8(++a)*2**16+n.readUInt8(++a)*2**8+n.readUInt8(++a));let l=0;i&&(l=n.readUInt8(++a)*2**24+n.readUInt8(++a)*2**16+n.readUInt8(++a)*2**8+n.readUInt8(++a)),this._state.state=3,this._state.readLen=s,this._state.mask=l,this.traceSocketEvent("webSocketNodeSocketPeekedHeader",{bodySize:this._state.readLen,compressed:this._state.compressed,fin:this._state.fin,mask:this._state.mask,opcode:this._state.opcode})}else if(this._state.state===3){let n=this._incomingData.read(this._state.readLen);this.traceSocketEvent("webSocketNodeSocketReadData",n),B8(n,this._state.mask),this.traceSocketEvent("webSocketNodeSocketUnmaskedData",n),this._state.state=1,this._state.readLen=2,this._state.mask=0,this._state.opcode<=2?this._flowManager.acceptFrame(n,this._state.compressed,!!this._state.fin):this._state.opcode===9&&this._flowManager.writeMessage(n,{compressed:!1,opcode:10})}}}async drain(){this.traceSocketEvent("webSocketNodeSocketDrainBegin"),this._flowManager.isProcessingWriteQueue()&&await he.toPromise(this._flowManager.onDidFinishProcessingWriteQueue),await this.socket.drain(),this.traceSocketEvent("webSocketNodeSocketDrainEnd")}},K_=class extends O{constructor(e,n,o,i,s,a){super();this._tracer=e;this._onData=s;this._writeFn=a;this._onError=this._register(new E);this.onError=this._onError.event;this._writeQueue=[];this._readQueue=[];this._onDidFinishProcessingReadQueue=this._register(new E);this.onDidFinishProcessingReadQueue=this._onDidFinishProcessingReadQueue.event;this._onDidFinishProcessingWriteQueue=this._register(new E);this.onDidFinishProcessingWriteQueue=this._onDidFinishProcessingWriteQueue.event;this._isProcessingWriteQueue=!1;this._isProcessingReadQueue=!1;n?(this._zlibInflateStream=this._register(new j_(this._tracer,i,o,{windowBits:15})),this._zlibDeflateStream=this._register(new G_(this._tracer,{windowBits:15})),this._register(this._zlibInflateStream.onError(l=>this._onError.fire(l))),this._register(this._zlibDeflateStream.onError(l=>this._onError.fire(l)))):(this._zlibInflateStream=null,this._zlibDeflateStream=null)}get permessageDeflate(){return!!(this._zlibInflateStream&&this._zlibDeflateStream)}get recordedInflateBytes(){return this._zlibInflateStream?this._zlibInflateStream.recordedInflateBytes:H.alloc(0)}setRecordInflateBytes(e){this._zlibInflateStream?.setRecordInflateBytes(e)}writeMessage(e,n){this._writeQueue.push({data:e,options:n}),this._processWriteQueue()}async _processWriteQueue(){if(!this._isProcessingWriteQueue){for(this._isProcessingWriteQueue=!0;this._writeQueue.length>0;){let{data:e,options:n}=this._writeQueue.shift();if(this._zlibDeflateStream&&n.compressed){let o=await this._deflateMessage(this._zlibDeflateStream,e);this._writeFn(o,n)}else this._writeFn(e,{...n,compressed:!1})}this._isProcessingWriteQueue=!1,this._onDidFinishProcessingWriteQueue.fire()}}isProcessingWriteQueue(){return this._isProcessingWriteQueue}_deflateMessage(e,n){return new Promise((o,i)=>{e.write(n),e.flush(s=>o(s))})}acceptFrame(e,n,o){this._readQueue.push({data:e,isCompressed:n,isLastFrameOfMessage:o}),this._processReadQueue()}async _processReadQueue(){if(!this._isProcessingReadQueue){for(this._isProcessingReadQueue=!0;this._readQueue.length>0;){let e=this._readQueue.shift();if(this._zlibInflateStream&&e.isCompressed){let n=await this._inflateFrame(this._zlibInflateStream,e.data,e.isLastFrameOfMessage);this._onData.fire(n)}else this._onData.fire(e.data)}this._isProcessingReadQueue=!1,this._onDidFinishProcessingReadQueue.fire()}}isProcessingReadQueue(){return this._isProcessingReadQueue}_inflateFrame(e,n,o){return new Promise((i,s)=>{e.write(n),o&&e.write(H.fromByteArray([0,0,255,255])),e.flush(a=>i(a))})}},j_=class extends O{constructor(e,n,o,i){super();this._tracer=e;this._onError=this._register(new E);this.onError=this._onError.event;this._recordedInflateBytes=[];this._pendingInflateData=[];this._recordInflateBytes=n,this._zlibInflate=W8(i),this._zlibInflate.on("error",s=>{this._tracer.traceSocketEvent("zlibInflateError",{message:s?.message,code:s?.code}),this._onError.fire(s)}),this._zlibInflate.on("data",s=>{this._tracer.traceSocketEvent("zlibInflateData",s),this._pendingInflateData.push(H.wrap(s))}),o&&(this._tracer.traceSocketEvent("zlibInflateInitialWrite",o.buffer),this._zlibInflate.write(o.buffer),this._zlibInflate.flush(()=>{this._tracer.traceSocketEvent("zlibInflateInitialFlushFired"),this._pendingInflateData.length=0}))}get recordedInflateBytes(){return this._recordInflateBytes?H.concat(this._recordedInflateBytes):H.alloc(0)}write(e){this._recordInflateBytes&&this._recordedInflateBytes.push(e.clone()),this._tracer.traceSocketEvent("zlibInflateWrite",e),this._zlibInflate.write(e.buffer)}setRecordInflateBytes(e){this._recordInflateBytes=e,e||(this._recordedInflateBytes.length=0)}flush(e){this._zlibInflate.flush(()=>{this._tracer.traceSocketEvent("zlibInflateFlushFired");let n=H.concat(this._pendingInflateData);this._pendingInflateData.length=0,e(n)})}dispose(){this._recordedInflateBytes.length=0,this._pendingInflateData.length=0;try{this._zlibInflate.close()}catch{}super.dispose()}},G_=class extends O{constructor(e,n){super();this._tracer=e;this._onError=this._register(new E);this.onError=this._onError.event;this._pendingDeflateData=[];this._zlibDeflate=H8({windowBits:15}),this._zlibDeflate.on("error",o=>{this._tracer.traceSocketEvent("zlibDeflateError",{message:o?.message,code:o?.code}),this._onError.fire(o)}),this._zlibDeflate.on("data",o=>{this._tracer.traceSocketEvent("zlibDeflateData",o),this._pendingDeflateData.push(H.wrap(o))})}write(e){this._tracer.traceSocketEvent("zlibDeflateWrite",e.buffer),this._zlibDeflate.write(e.buffer)}flush(e){this._zlibDeflate.flush(2,()=>{this._tracer.traceSocketEvent("zlibDeflateFlushFired");let n=H.concat(this._pendingDeflateData);this._pendingDeflateData.length=0,n=n.slice(0,n.byteLength-4),e(n)})}dispose(){this._pendingDeflateData.length=0;try{this._zlibDeflate.close()}catch{}super.dispose()}};function B8(r,t){if(t===0)return;let e=r.byteLength>>>2;for(let l=0;l<e;l++){let d=r.readUInt32BE(l*4);r.writeUInt32BE(d^t,l*4)}let n=e*4,o=r.byteLength-n,i=t>>>24&255,s=t>>>16&255,a=t>>>8&255;o>=1&&r.writeUInt8(r.readUInt8(n)^i,n),o>=2&&r.writeUInt8(r.readUInt8(n+1)^s,n+1),o>=3&&r.writeUInt8(r.readUInt8(n+2)^a,n+2)}var _F=process.env.XDG_RUNTIME_DIR,$8={2:107,1:103};function RF(){let r=Ae();if(process.platform==="win32")return`\\\\.\\pipe\\vscode-ipc-${r}-sock`;let t=process.platform!=="darwin"&&_F?_F:F8(),e=Ne(t,`vscode-ipc-${r}.sock`);return z8(e),e}function z8(r){let t=$8[Yy];typeof t=="number"&&r.length>=t&&console.warn(`WARNING: IPC handle "${r}" is longer than ${t} chars, try a shorter --user-data-dir`)}function at(r){if(!r||typeof r!="object"||r instanceof RegExp)return r;let t=Array.isArray(r)?[]:{};return Object.entries(r).forEach(([e,n])=>{t[e]=n&&typeof n=="object"?at(n):n}),t}function Ah(r){if(!r||typeof r!="object")return r;let t=[r];for(;t.length>0;){let e=t.shift();Object.freeze(e);for(let n in e)if(AF.call(e,n)){let o=e[n];typeof o=="object"&&!Object.isFrozen(o)&&!QN(o)&&t.push(o)}}return r}var AF=Object.prototype.hasOwnProperty;function ra(r,t){return J_(r,t,new Set)}function J_(r,t,e){if(Ot(r))return r;let n=t(r);if(typeof n<"u")return n;if(Array.isArray(r)){let o=[];for(let i of r)o.push(J_(i,t,e));return o}if(it(r)){if(e.has(r))throw new Error("Cannot clone recursive data-structure");e.add(r);let o={};for(let i in r)AF.call(r,i)&&(o[i]=J_(r[i],t,e));return e.delete(r),o}return r}function Qo(r,t,e=!0){return it(r)?(it(t)&&Object.keys(t).forEach(n=>{n in r?e&&(it(r[n])&&it(t[n])?Qo(r[n],t[n],e):r[n]=t[n]):r[n]=t[n]}),r):t}function qt(r,t){if(r===t)return!0;if(r==null||t===null||t===void 0||typeof r!=typeof t||typeof r!="object"||Array.isArray(r)!==Array.isArray(t))return!1;let e,n;if(Array.isArray(r)){if(r.length!==t.length)return!1;for(e=0;e<r.length;e++)if(!qt(r[e],t[e]))return!1}else{let o=[];for(n in r)o.push(n);o.sort();let i=[];for(n in t)i.push(n);if(i.sort(),!qt(o,i))return!1;for(e=0;e<o.length;e++)if(!qt(r[o[e]],t[o[e]]))return!1}return!0}function Y_(r){let t=new Set;return JSON.stringify(r,(e,n)=>{if(it(n)||Array.isArray(n)){if(t.has(n))return"[Circular]";t.add(n)}return typeof n=="bigint"?`[BigInt ${n.toString()}]`:n})}function X_(r,t){let e=t.toLowerCase(),n=Object.keys(r).find(o=>o.toLowerCase()===e);return n?r[n]:r[t]}function Z_(r,t){let e=Object.create(null);for(let[n,o]of Object.entries(r))t(n,o)&&(e[n]=o);return e}var MF=new class{constructor(){this._zoomLevel=0;this._onDidChangeZoomLevel=new E;this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event}getZoomLevel(){return this._zoomLevel}setZoomLevel(r){r=Math.min(Math.max(-5,r),20),this._zoomLevel!==r&&(this._zoomLevel=r,this._onDidChangeZoomLevel.fire(this._zoomLevel))}};var q8=pt?1.5:1.35,eD=8,tD=class r{constructor(t){this._bareFontInfoBrand=void 0;this.pixelRatio=t.pixelRatio,this.fontFamily=String(t.fontFamily),this.fontWeight=String(t.fontWeight),this.fontSize=t.fontSize,this.fontFeatureSettings=t.fontFeatureSettings,this.fontVariationSettings=t.fontVariationSettings,this.lineHeight=t.lineHeight|0,this.letterSpacing=t.letterSpacing}static _create(t,e,n,o,i,s,a,l,d){s===0?s=q8*n:s<eD&&(s=s*n),s=Math.round(s),s<eD&&(s=eD);let c=1+(d?0:MF.getZoomLevel()*.1);return n*=c,s*=c,i===oD&&(e==="normal"||e==="bold"?i=nD:(i=`'wght' ${parseInt(e,10)}`,e="normal")),new r({pixelRatio:l,fontFamily:t,fontWeight:e,fontSize:n,fontFeatureSettings:o,fontVariationSettings:i,lineHeight:s,letterSpacing:a})}getId(){return`${this.pixelRatio}-${this.fontFamily}-${this.fontWeight}-${this.fontSize}-${this.fontFeatureSettings}-${this.fontVariationSettings}-${this.lineHeight}-${this.letterSpacing}`}getMassagedFontFamily(){let t=yi.fontFamily,e=r._wrapInQuotes(this.fontFamily);return t&&this.fontFamily!==t?`${e}, ${t}`:e}static _wrapInQuotes(t){return/[,"']/.test(t)?t:/[+ ]/.test(t)?`"${t}"`:t}},K8=2,NI=class extends tD{constructor(e,n){super(e);this._editorStylingBrand=void 0;this.version=K8;this.isTrusted=n,this.isMonospace=e.isMonospace,this.typicalHalfwidthCharacterWidth=e.typicalHalfwidthCharacterWidth,this.typicalFullwidthCharacterWidth=e.typicalFullwidthCharacterWidth,this.canUseHalfwidthRightwardsArrow=e.canUseHalfwidthRightwardsArrow,this.spaceWidth=e.spaceWidth,this.middotWidth=e.middotWidth,this.wsmiddotWidth=e.wsmiddotWidth,this.maxDigitWidth=e.maxDigitWidth}equals(e){return this.fontFamily===e.fontFamily&&this.fontWeight===e.fontWeight&&this.fontSize===e.fontSize&&this.fontFeatureSettings===e.fontFeatureSettings&&this.fontVariationSettings===e.fontVariationSettings&&this.lineHeight===e.lineHeight&&this.letterSpacing===e.letterSpacing&&this.typicalHalfwidthCharacterWidth===e.typicalHalfwidthCharacterWidth&&this.typicalFullwidthCharacterWidth===e.typicalFullwidthCharacterWidth&&this.canUseHalfwidthRightwardsArrow===e.canUseHalfwidthRightwardsArrow&&this.spaceWidth===e.spaceWidth&&this.middotWidth===e.middotWidth&&this.wsmiddotWidth===e.wsmiddotWidth&&this.maxDigitWidth===e.maxDigitWidth}},nD="normal",oD="translate",j8="Consolas, 'Courier New', monospace",G8="Menlo, Monaco, 'Courier New', monospace",Q8="'Droid Sans Mono', monospace",yi={fontFamily:pt?G8:Ie?j8:Q8,fontWeight:"normal",fontSize:pt?12:14,lineHeight:0,letterSpacing:0};var rD={tabSize:4,indentSize:4,insertSpaces:!0,detectIndentation:!0,trimAutoWhitespace:!0,largeFileOptimizations:!0,bracketPairColorizationOptions:{enabled:!0,independentColorPoolPerBracketType:!1}};var iD="`~!@#$%^&*()-=+[{]}\\|;:'\",.<>/?";function J8(r=""){let t="(-?\\d*\\.\\d\\w*)|([^";for(let e of iD)r.indexOf(e)>=0||(t+="\\"+e);return t+="\\s]+)",new RegExp(t,"g")}var Y8=J8();function sD(r){let t=Y8;if(r&&r instanceof RegExp)if(r.global)t=r;else{let e="g";r.ignoreCase&&(e+="i"),r.multiline&&(e+="m"),r.unicode&&(e+="u"),t=new RegExp(r.source,e)}return t.lastIndex=0,t}var LF=new ao;LF.unshift({maxLen:1e3,windowSize:15,timeBudget:150});function aD(r,t,e,n,o){if(t=sD(t),o||(o=Nt.first(LF)),e.length>o.maxLen){let d=r-o.maxLen/2;return d<0?d=0:n+=d,e=e.substring(d,r+o.maxLen/2),aD(r,t,e,n,o)}let i=Date.now(),s=r-1-n,a=-1,l=null;for(let d=1;!(Date.now()-i>=o.timeBudget);d++){let c=s-o.windowSize*d;t.lastIndex=Math.max(0,c);let u=X8(t,e,s,a);if(!u&&l||(l=u,c<=0))break;a=c}if(l){let d={word:l[0],startColumn:n+1+l.index,endColumn:n+1+l.index+l[0].length};return t.lastIndex=0,d}return null}function X8(r,t,e,n){let o;for(;o=r.exec(t);){let i=o.index||0;if(i<=e&&r.lastIndex>=e)return o;if(n>0&&i>n)return null}return null}function lD(...r){switch(r.length){case 1:return p(1931,null,r[0]);case 2:return p(1932,null,r[0],r[1]);case 3:return p(1933,null,r[0],r[1],r[2]);default:return}}var Z8=p(1930,null),e9=p(1929,null),bl=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(t){switch(t.type){case 0:return"(";case 1:return")";case 2:return"!";case 3:return t.isTripleEq?"===":"==";case 4:return t.isTripleEq?"!==":"!=";case 5:return"<";case 6:return"<=";case 7:return">=";case 8:return">=";case 9:return"=~";case 10:return t.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 t.lexeme;case 18:return t.lexeme;case 19:return t.lexeme;case 20:return"EOF";default:throw Qu(`unhandled token type: ${JSON.stringify(t)}; have you forgotten to add a case?`)}}static{this._regexFlags=new Set(["i","g","s","m","y","u"].map(t=>t.charCodeAt(0)))}static{this._keywords=new Map([["not",14],["in",13],["false",12],["true",11]])}get errors(){return this._errors}reset(t){return this._input=t,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 e=this._match(61);this._tokens.push({type:4,offset:this._start,isTripleEq:e})}else this._addToken(2);break;case 39:this._quotedString();break;case 47:this._regex();break;case 61:if(this._match(61)){let e=this._match(61);this._tokens.push({type:3,offset:this._start,isTripleEq:e})}else this._match(126)?this._addToken(9):this._error(lD("==","=~"));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(lD("&&"));break;case 124:this._match(124)?this._addToken(16):this._error(lD("||"));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(t){return this._isAtEnd()||this._input.charCodeAt(this._current)!==t?!1:(this._current++,!0)}_advance(){return this._input.charCodeAt(this._current++)}_peek(){return this._isAtEnd()?0:this._input.charCodeAt(this._current)}_addToken(t){this._tokens.push({type:t,offset:this._start})}_error(t){let e=this._start,n=this._input.substring(this._start,this._current),o={type:19,offset:this._start,lexeme:n};this._errors.push({offset:e,lexeme:n,additionalInfo:t}),this._tokens.push(o)}_string(){this.stringRe.lastIndex=this._start;let t=this.stringRe.exec(this._input);if(t){this._current=this._start+t[0].length;let e=this._input.substring(this._start,this._current),n=r._keywords.get(e);n?this._addToken(n):this._tokens.push({type:17,lexeme:e,offset:this._start})}}_quotedString(){for(;this._peek()!==39&&!this._isAtEnd();)this._advance();if(this._isAtEnd()){this._error(Z8);return}this._advance(),this._tokens.push({type:18,lexeme:this._input.substring(this._start+1,this._current-1),offset:this._start+1})}_regex(){let t=this._current,e=!1,n=!1;for(;;){if(t>=this._input.length){this._current=t,this._error(e9);return}let i=this._input.charCodeAt(t);if(e)e=!1;else if(i===47&&!n){t++;break}else i===91?n=!0:i===92?e=!0:i===93&&(n=!1);t++}for(;t<this._input.length&&r._regexFlags.has(this._input.charCodeAt(t));)t++;this._current=t;let o=this._input.substring(this._start,this._current);this._tokens.push({type:10,lexeme:o,offset:this._start})}_isAtEnd(){return this._current>=this._input.length}};var Ii;(o=>{o.serviceIds=new Map,o.DI_TARGET="$di$target",o.DI_DEPENDENCIES="$di$dependencies";function n(i){return i[o.DI_DEPENDENCIES]||[]}o.getServiceDependencies=n})(Ii||={});var Jo=R("instantiationService");function t9(r,t,e){t[Ii.DI_TARGET]===t?t[Ii.DI_DEPENDENCIES].push({id:r,index:e}):(t[Ii.DI_DEPENDENCIES]=[{id:r,index:e}],t[Ii.DI_TARGET]=t)}function R(r){if(Ii.serviceIds.has(r))return Ii.serviceIds.get(r);let t=function(e,n,o){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");t9(t,e,o)};return t.toString=()=>r,Ii.serviceIds.set(r,t),t}var eo=new Map;eo.set("false",!1);eo.set("true",!0);eo.set("isMac",pt);eo.set("isLinux",Qe);eo.set("isWindows",Ie);eo.set("isWeb",Pr);eo.set("isMacNative",pt&&!Pr);eo.set("isEdge",eI);eo.set("isFirefox",uU);eo.set("isChrome",ph);eo.set("isSafari",pU);var n9=Object.prototype.hasOwnProperty;var o9={regexParsingWithErrorRecovery:!0},r9=p(1910,null),i9=p(1911,null),s9=p(1913,null),OF=p(1909,null),a9=p(1916,null),l9=p(1917,null),d9=p(1914,null),c9=p(1915,null),UI=class r{constructor(t=o9){this._config=t;this._scanner=new bl;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(t){if(t===""){this._parsingErrors.push({message:r9,offset:0,lexeme:"",additionalInfo:i9});return}this._tokens=this._scanner.reset(t).scan(),this._current=0,this._parsingErrors=[];try{let e=this._expr();if(!this._isAtEnd()){let n=this._peek(),o=n.type===17?l9:void 0;throw this._parsingErrors.push({message:a9,offset:n.offset,lexeme:bl.getLexeme(n),additionalInfo:o}),r._parseError}return e}catch(e){if(e!==r._parseError)throw e;return}}_expr(){return this._or()}_or(){let t=[this._and()];for(;this._matchOne(16);){let e=this._and();t.push(e)}return t.length===1?t[0]:Wt.or(...t)}_and(){let t=[this._term()];for(;this._matchOne(15);){let e=this._term();t.push(e)}return t.length===1?t[0]:Wt.and(...t)}_term(){if(this._matchOne(2)){let t=this._peek();switch(t.type){case 11:return this._advance(),yo.INSTANCE;case 12:return this._advance(),Lo.INSTANCE;case 0:{this._advance();let e=this._expr();return this._consume(1,OF),e?.negate()}case 17:return this._advance(),lc.create(t.lexeme);default:throw this._errExpectedButGot("KEY | true | false | '(' expression ')'",t)}}return this._primary()}_primary(){let t=this._peek();switch(t.type){case 11:return this._advance(),Wt.true();case 12:return this._advance(),Wt.false();case 0:{this._advance();let e=this._expr();return this._consume(1,OF),e}case 17:{let e=t.lexeme;if(this._advance(),this._matchOne(9)){let o=this._peek();if(!this._config.regexParsingWithErrorRecovery){if(this._advance(),o.type!==10)throw this._errExpectedButGot("REGEX",o);let i=o.lexeme,s=i.lastIndexOf("/"),a=s===i.length-1?void 0:this._removeFlagsGY(i.substring(s+1)),l;try{l=new RegExp(i.substring(1,s),a)}catch{throw this._errExpectedButGot("REGEX",o)}return Hh.create(e,l)}switch(o.type){case 10:case 19:{let i=[o.lexeme];this._advance();let s=this._peek(),a=0;for(let m=0;m<o.lexeme.length;m++)o.lexeme.charCodeAt(m)===40?a++:o.lexeme.charCodeAt(m)===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 m=0;m<s.lexeme.length;m++)s.lexeme.charCodeAt(m)===40?a++:o.lexeme.charCodeAt(m)===41&&a--}if(a<0)break;i.push(bl.getLexeme(s)),this._advance(),s=this._peek()}let l=i.join(""),d=l.lastIndexOf("/"),c=d===l.length-1?void 0:this._removeFlagsGY(l.substring(d+1)),u;try{u=new RegExp(l.substring(1,d),c)}catch{throw this._errExpectedButGot("REGEX",o)}return Wt.regex(e,u)}case 18:{let i=o.lexeme;this._advance();let s=null;if(!rs(i)){let a=i.indexOf("/"),l=i.lastIndexOf("/");if(a!==l&&a>=0){let d=i.slice(a+1,l),c=i[l+1]==="i"?"i":"";try{s=new RegExp(d,c)}catch{throw this._errExpectedButGot("REGEX",o)}}}if(s===null)throw this._errExpectedButGot("REGEX",o);return Hh.create(e,s)}default:throw this._errExpectedButGot("REGEX",this._peek())}}if(this._matchOne(14)){this._consume(13,s9);let o=this._value();return Wt.notIn(e,o)}switch(this._peek().type){case 3:{this._advance();let o=this._value();if(this._previous().type===18)return Wt.equals(e,o);switch(o){case"true":return Wt.has(e);case"false":return Wt.not(e);default:return Wt.equals(e,o)}}case 4:{this._advance();let o=this._value();if(this._previous().type===18)return Wt.notEquals(e,o);switch(o){case"true":return Wt.not(e);case"false":return Wt.has(e);default:return Wt.notEquals(e,o)}}case 5:return this._advance(),Uh.create(e,this._value());case 6:return this._advance(),Fh.create(e,this._value());case 7:return this._advance(),bp.create(e,this._value());case 8:return this._advance(),Nh.create(e,this._value());case 13:return this._advance(),Wt.in(e,this._value());default:return Wt.has(e)}}case 20:throw this._parsingErrors.push({message:d9,offset:t.offset,lexeme:"",additionalInfo:c9}),r._parseError;default:throw this._errExpectedButGot(`true | false | KEY 
	| KEY '=~' REGEX 
	| KEY ('==' | '!=' | '<' | '<=' | '>' | '>=' | 'in' | 'not' 'in') value`,this._peek())}}_value(){let t=this._peek();switch(t.type){case 17:case 18:return this._advance(),t.lexeme;case 11:return this._advance(),"true";case 12:return this._advance(),"false";case 13:return this._advance(),"in";default:return""}}_removeFlagsGY(t){return t.replaceAll(this._flagsGYRe,"")}_previous(){return this._tokens[this._current-1]}_matchOne(t){return this._check(t)?(this._advance(),!0):!1}_advance(){return this._isAtEnd()||this._current++,this._previous()}_consume(t,e){if(this._check(t))return this._advance();throw this._errExpectedButGot(e,this._peek())}_errExpectedButGot(t,e,n){let o=p(1912,null,t,bl.getLexeme(e)),i=e.offset,s=bl.getLexeme(e);return this._parsingErrors.push({message:o,offset:i,lexeme:s,additionalInfo:n}),r._parseError}_check(t){return this._peek().type===t}_peek(){return this._tokens[this._current]}_isAtEnd(){return this._peek().type===20}},Wt=class{static false(){return yo.INSTANCE}static true(){return Lo.INSTANCE}static has(t){return ac.create(t)}static equals(t,e){return Lh.create(t,e)}static notEquals(t,e){return Oh.create(t,e)}static regex(t,e){return Hh.create(t,e)}static in(t,e){return FI.create(t,e)}static notIn(t,e){return HI.create(t,e)}static not(t){return lc.create(t)}static and(...t){return WI.create(t,null,!0)}static or(...t){return Wh.create(t,null,!0)}static greater(t,e){return bp.create(t,e)}static greaterEquals(t,e){return Nh.create(t,e)}static smaller(t,e){return Uh.create(t,e)}static smallerEquals(t,e){return Fh.create(t,e)}static{this._parser=new UI({regexParsingWithErrorRecovery:!1})}static deserialize(t){return t==null?void 0:this._parser.parse(t)}};function UF(r){let t=new UI({regexParsingWithErrorRecovery:!1});return r.map(e=>(t.parse(e),t.lexingErrors.length>0?t.lexingErrors.map(n=>({errorMessage:n.additionalInfo?p(1919,null,n.additionalInfo):p(1918,null),offset:n.offset,length:n.lexeme.length})):t.parsingErrors.length>0?t.parsingErrors.map(n=>({errorMessage:n.additionalInfo?`${n.message}. ${n.additionalInfo}`:n.message,offset:n.offset,length:n.lexeme.length})):[]))}function Mh(r,t){return r.cmp(t)}var yo=class r{constructor(){this.type=0}static{this.INSTANCE=new r}cmp(t){return this.type-t.type}equals(t){return t.type===this.type}substituteConstants(){return this}evaluate(t){return!1}serialize(){return"false"}keys(){return[]}map(t){return this}negate(){return Lo.INSTANCE}},Lo=class r{constructor(){this.type=1}static{this.INSTANCE=new r}cmp(t){return this.type-t.type}equals(t){return t.type===this.type}substituteConstants(){return this}evaluate(t){return!0}serialize(){return"true"}keys(){return[]}map(t){return this}negate(){return yo.INSTANCE}},ac=class r{constructor(t,e){this.key=t;this.negated=e;this.type=2}static create(t,e=null){let n=eo.get(t);return typeof n=="boolean"?n?Lo.INSTANCE:yo.INSTANCE:new r(t,e)}cmp(t){return t.type!==this.type?this.type-t.type:HF(this.key,t.key)}equals(t){return t.type===this.type?this.key===t.key:!1}substituteConstants(){let t=eo.get(this.key);return typeof t=="boolean"?t?Lo.INSTANCE:yo.INSTANCE:this}evaluate(t){return!!t.getValue(this.key)}serialize(){return this.key}keys(){return[this.key]}map(t){return t.mapDefined(this.key)}negate(){return this.negated||(this.negated=lc.create(this.key,this)),this.negated}},Lh=class r{constructor(t,e,n){this.key=t;this.value=e;this.negated=n;this.type=4}static create(t,e,n=null){if(typeof e=="boolean")return e?ac.create(t,n):lc.create(t,n);let o=eo.get(t);return typeof o=="boolean"?e===(o?"true":"false")?Lo.INSTANCE:yo.INSTANCE:new r(t,e,n)}cmp(t){return t.type!==this.type?this.type-t.type:dc(this.key,this.value,t.key,t.value)}equals(t){return t.type===this.type?this.key===t.key&&this.value===t.value:!1}substituteConstants(){let t=eo.get(this.key);if(typeof t=="boolean"){let e=t?"true":"false";return this.value===e?Lo.INSTANCE:yo.INSTANCE}return this}evaluate(t){return t.getValue(this.key)==this.value}serialize(){return`${this.key} == '${this.value}'`}keys(){return[this.key]}map(t){return t.mapEquals(this.key,this.value)}negate(){return this.negated||(this.negated=Oh.create(this.key,this.value,this)),this.negated}},FI=class r{constructor(t,e){this.key=t;this.valueKey=e;this.type=10;this.negated=null}static create(t,e){return new r(t,e)}cmp(t){return t.type!==this.type?this.type-t.type:dc(this.key,this.valueKey,t.key,t.valueKey)}equals(t){return t.type===this.type?this.key===t.key&&this.valueKey===t.valueKey:!1}substituteConstants(){return this}evaluate(t){let e=t.getValue(this.valueKey),n=t.getValue(this.key);if(Array.isArray(e)){if(e.includes(n))return!0;if(Ie&&typeof n=="string"&&n.startsWith("file:///")){let o=n.toLowerCase();return e.some(i=>typeof i=="string"&&i.toLowerCase()===o)}return!1}if(typeof n=="string"&&typeof e=="object"&&e!==null){if(n9.call(e,n))return!0;if(Ie&&n.startsWith("file:///")){let o=n.toLowerCase();return Object.keys(e).some(i=>i.toLowerCase()===o)}return!1}return!1}serialize(){return`${this.key} in '${this.valueKey}'`}keys(){return[this.key,this.valueKey]}map(t){return t.mapIn(this.key,this.valueKey)}negate(){return this.negated||(this.negated=HI.create(this.key,this.valueKey)),this.negated}},HI=class r{constructor(t,e){this.key=t;this.valueKey=e;this.type=11;this._negated=FI.create(t,e)}static create(t,e){return new r(t,e)}cmp(t){return t.type!==this.type?this.type-t.type:this._negated.cmp(t._negated)}equals(t){return t.type===this.type?this._negated.equals(t._negated):!1}substituteConstants(){return this}evaluate(t){return!this._negated.evaluate(t)}serialize(){return`${this.key} not in '${this.valueKey}'`}keys(){return this._negated.keys()}map(t){return t.mapNotIn(this.key,this.valueKey)}negate(){return this._negated}},Oh=class r{constructor(t,e,n){this.key=t;this.value=e;this.negated=n;this.type=5}static create(t,e,n=null){if(typeof e=="boolean")return e?lc.create(t,n):ac.create(t,n);let o=eo.get(t);return typeof o=="boolean"?e===(o?"true":"false")?yo.INSTANCE:Lo.INSTANCE:new r(t,e,n)}cmp(t){return t.type!==this.type?this.type-t.type:dc(this.key,this.value,t.key,t.value)}equals(t){return t.type===this.type?this.key===t.key&&this.value===t.value:!1}substituteConstants(){let t=eo.get(this.key);if(typeof t=="boolean"){let e=t?"true":"false";return this.value===e?yo.INSTANCE:Lo.INSTANCE}return this}evaluate(t){return t.getValue(this.key)!=this.value}serialize(){return`${this.key} != '${this.value}'`}keys(){return[this.key]}map(t){return t.mapNotEquals(this.key,this.value)}negate(){return this.negated||(this.negated=Lh.create(this.key,this.value,this)),this.negated}},lc=class r{constructor(t,e){this.key=t;this.negated=e;this.type=3}static create(t,e=null){let n=eo.get(t);return typeof n=="boolean"?n?yo.INSTANCE:Lo.INSTANCE:new r(t,e)}cmp(t){return t.type!==this.type?this.type-t.type:HF(this.key,t.key)}equals(t){return t.type===this.type?this.key===t.key:!1}substituteConstants(){let t=eo.get(this.key);return typeof t=="boolean"?t?yo.INSTANCE:Lo.INSTANCE:this}evaluate(t){return!t.getValue(this.key)}serialize(){return`!${this.key}`}keys(){return[this.key]}map(t){return t.mapNot(this.key)}negate(){return this.negated||(this.negated=ac.create(this.key,this)),this.negated}};function VI(r,t){if(typeof r=="string"){let e=parseFloat(r);isNaN(e)||(r=e)}return typeof r=="string"||typeof r=="number"?t(r):yo.INSTANCE}var bp=class r{constructor(t,e,n){this.key=t;this.value=e;this.negated=n;this.type=12}static create(t,e,n=null){return VI(e,o=>new r(t,o,n))}cmp(t){return t.type!==this.type?this.type-t.type:dc(this.key,this.value,t.key,t.value)}equals(t){return t.type===this.type?this.key===t.key&&this.value===t.value:!1}substituteConstants(){return this}evaluate(t){return typeof this.value=="string"?!1:parseFloat(t.getValue(this.key))>this.value}serialize(){return`${this.key} > ${this.value}`}keys(){return[this.key]}map(t){return t.mapGreater(this.key,this.value)}negate(){return this.negated||(this.negated=Fh.create(this.key,this.value,this)),this.negated}},Nh=class r{constructor(t,e,n){this.key=t;this.value=e;this.negated=n;this.type=13}static create(t,e,n=null){return VI(e,o=>new r(t,o,n))}cmp(t){return t.type!==this.type?this.type-t.type:dc(this.key,this.value,t.key,t.value)}equals(t){return t.type===this.type?this.key===t.key&&this.value===t.value:!1}substituteConstants(){return this}evaluate(t){return typeof this.value=="string"?!1:parseFloat(t.getValue(this.key))>=this.value}serialize(){return`${this.key} >= ${this.value}`}keys(){return[this.key]}map(t){return t.mapGreaterEquals(this.key,this.value)}negate(){return this.negated||(this.negated=Uh.create(this.key,this.value,this)),this.negated}},Uh=class r{constructor(t,e,n){this.key=t;this.value=e;this.negated=n;this.type=14}static create(t,e,n=null){return VI(e,o=>new r(t,o,n))}cmp(t){return t.type!==this.type?this.type-t.type:dc(this.key,this.value,t.key,t.value)}equals(t){return t.type===this.type?this.key===t.key&&this.value===t.value:!1}substituteConstants(){return this}evaluate(t){return typeof this.value=="string"?!1:parseFloat(t.getValue(this.key))<this.value}serialize(){return`${this.key} < ${this.value}`}keys(){return[this.key]}map(t){return t.mapSmaller(this.key,this.value)}negate(){return this.negated||(this.negated=Nh.create(this.key,this.value,this)),this.negated}},Fh=class r{constructor(t,e,n){this.key=t;this.value=e;this.negated=n;this.type=15}static create(t,e,n=null){return VI(e,o=>new r(t,o,n))}cmp(t){return t.type!==this.type?this.type-t.type:dc(this.key,this.value,t.key,t.value)}equals(t){return t.type===this.type?this.key===t.key&&this.value===t.value:!1}substituteConstants(){return this}evaluate(t){return typeof this.value=="string"?!1:parseFloat(t.getValue(this.key))<=this.value}serialize(){return`${this.key} <= ${this.value}`}keys(){return[this.key]}map(t){return t.mapSmallerEquals(this.key,this.value)}negate(){return this.negated||(this.negated=bp.create(this.key,this.value,this)),this.negated}},Hh=class r{constructor(t,e){this.key=t;this.regexp=e;this.type=7;this.negated=null}static create(t,e){return new r(t,e)}cmp(t){if(t.type!==this.type)return this.type-t.type;if(this.key<t.key)return-1;if(this.key>t.key)return 1;let e=this.regexp?this.regexp.source:"",n=t.regexp?t.regexp.source:"";return e<n?-1:e>n?1:0}equals(t){if(t.type===this.type){let e=this.regexp?this.regexp.source:"",n=t.regexp?t.regexp.source:"";return this.key===t.key&&e===n}return!1}substituteConstants(){return this}evaluate(t){let e=t.getValue(this.key);return this.regexp?this.regexp.test(e):!1}serialize(){let t=this.regexp?`/${this.regexp.source}/${this.regexp.flags}`:"/invalid/";return`${this.key} =~ ${t}`}keys(){return[this.key]}map(t){return t.mapRegex(this.key,this.regexp)}negate(){return this.negated||(this.negated=dD.create(this)),this.negated}},dD=class r{constructor(t){this._actual=t;this.type=8}static create(t){return new r(t)}cmp(t){return t.type!==this.type?this.type-t.type:this._actual.cmp(t._actual)}equals(t){return t.type===this.type?this._actual.equals(t._actual):!1}substituteConstants(){return this}evaluate(t){return!this._actual.evaluate(t)}serialize(){return`!(${this._actual.serialize()})`}keys(){return this._actual.keys()}map(t){return new r(this._actual.map(t))}negate(){return this._actual}};function FF(r){let t=null;for(let e=0,n=r.length;e<n;e++){let o=r[e].substituteConstants();if(r[e]!==o&&t===null){t=[];for(let i=0;i<e;i++)t[i]=r[i]}t!==null&&(t[e]=o)}return t===null?r:t}var WI=class r{constructor(t,e){this.expr=t;this.negated=e;this.type=6}static create(t,e,n){return r._normalizeArr(t,e,n)}cmp(t){if(t.type!==this.type)return this.type-t.type;if(this.expr.length<t.expr.length)return-1;if(this.expr.length>t.expr.length)return 1;for(let e=0,n=this.expr.length;e<n;e++){let o=Mh(this.expr[e],t.expr[e]);if(o!==0)return o}return 0}equals(t){if(t.type===this.type){if(this.expr.length!==t.expr.length)return!1;for(let e=0,n=this.expr.length;e<n;e++)if(!this.expr[e].equals(t.expr[e]))return!1;return!0}return!1}substituteConstants(){let t=FF(this.expr);return t===this.expr?this:r.create(t,this.negated,!1)}evaluate(t){for(let e=0,n=this.expr.length;e<n;e++)if(!this.expr[e].evaluate(t))return!1;return!0}static _normalizeArr(t,e,n){let o=[],i=!1;for(let s of t)if(s){if(s.type===1){i=!0;continue}if(s.type===0)return yo.INSTANCE;if(s.type===6){o.push(...s.expr);continue}o.push(s)}if(o.length===0&&i)return Lo.INSTANCE;if(o.length!==0){if(o.length===1)return o[0];o.sort(Mh);for(let s=1;s<o.length;s++)o[s-1].equals(o[s])&&(o.splice(s,1),s--);if(o.length===1)return o[0];for(;o.length>1;){let s=o[o.length-1];if(s.type!==9)break;o.pop();let a=o.pop(),l=o.length===0,d=Wh.create(s.expr.map(c=>r.create([c,a],null,n)),null,l);d&&(o.push(d),o.sort(Mh))}if(o.length===1)return o[0];if(n){for(let s=0;s<o.length;s++)for(let a=s+1;a<o.length;a++)if(o[s].negate().equals(o[a]))return yo.INSTANCE;if(o.length===1)return o[0]}return new r(o,e)}}serialize(){return this.expr.map(t=>t.serialize()).join(" && ")}keys(){let t=[];for(let e of this.expr)t.push(...e.keys());return t}map(t){return new r(this.expr.map(e=>e.map(t)),null)}negate(){if(!this.negated){let t=[];for(let e of this.expr)t.push(e.negate());this.negated=Wh.create(t,this,!0)}return this.negated}},Wh=class r{constructor(t,e){this.expr=t;this.negated=e;this.type=9}static create(t,e,n){return r._normalizeArr(t,e,n)}cmp(t){if(t.type!==this.type)return this.type-t.type;if(this.expr.length<t.expr.length)return-1;if(this.expr.length>t.expr.length)return 1;for(let e=0,n=this.expr.length;e<n;e++){let o=Mh(this.expr[e],t.expr[e]);if(o!==0)return o}return 0}equals(t){if(t.type===this.type){if(this.expr.length!==t.expr.length)return!1;for(let e=0,n=this.expr.length;e<n;e++)if(!this.expr[e].equals(t.expr[e]))return!1;return!0}return!1}substituteConstants(){let t=FF(this.expr);return t===this.expr?this:r.create(t,this.negated,!1)}evaluate(t){for(let e=0,n=this.expr.length;e<n;e++)if(this.expr[e].evaluate(t))return!0;return!1}static _normalizeArr(t,e,n){let o=[],i=!1;if(t){for(let s=0,a=t.length;s<a;s++){let l=t[s];if(l){if(l.type===0){i=!0;continue}if(l.type===1)return Lo.INSTANCE;if(l.type===9){o=o.concat(l.expr);continue}o.push(l)}}if(o.length===0&&i)return yo.INSTANCE;o.sort(Mh)}if(o.length!==0){if(o.length===1)return o[0];for(let s=1;s<o.length;s++)o[s-1].equals(o[s])&&(o.splice(s,1),s--);if(o.length===1)return o[0];if(n){for(let s=0;s<o.length;s++)for(let a=s+1;a<o.length;a++)if(o[s].negate().equals(o[a]))return Lo.INSTANCE;if(o.length===1)return o[0]}return new r(o,e)}}serialize(){return this.expr.map(t=>t.serialize()).join(" || ")}keys(){let t=[];for(let e of this.expr)t.push(...e.keys());return t}map(t){return new r(this.expr.map(e=>e.map(t)),null)}negate(){if(!this.negated){let t=[];for(let e of this.expr)t.push(e.negate());for(;t.length>1;){let e=t.shift(),n=t.shift(),o=[];for(let i of NF(e))for(let s of NF(n))o.push(WI.create([i,s],null,!1));t.unshift(r.create(o,null,!1))}this.negated=r.create(t,this,!0)}return this.negated}},w=class r extends ac{static{this._info=[]}static all(){return r._info.values()}constructor(t,e,n){super(t,null),this._defaultValue=e,typeof n=="object"?r._info.push({...n,key:t}):n!==!0&&r._info.push({key:t,description:n,type:e!=null?typeof e:void 0})}bindTo(t){return t.createKey(this.key,this._defaultValue)}getValue(t){return t.getContextKeyValue(this.key)}toNegated(){return this.negate()}isEqualTo(t){return Lh.create(this.key,t)}notEqualsTo(t){return Oh.create(this.key,t)}greater(t){return bp.create(this.key,t)}},Oo=R("contextKeyService");function HF(r,t){return r<t?-1:r>t?1:0}function dc(r,t,e,n){return r<e?-1:r>e?1:t<n?-1:t>n?1:0}function NF(r){return r.type===9?r.expr:[r]}var WF=R("accessibilityService");var vte=new w("accessibilityModeEnabled",!1);var u9=8;var cD=class{constructor(){this.stableMinimapLayoutInput=null,this.stableFitMaxMinimapScale=0,this.stableFitRemainingWidth=0}},Mt=class{constructor(t,e,n,o){this.id=t,this.name=e,this.defaultValue=n,this.schema=o}applyUpdate(t,e){return BI(t,e)}compute(t,e,n){return n}},yp=class{constructor(t,e){this.newValue=t;this.didChange=e}};function BI(r,t){if(typeof r!="object"||typeof t!="object"||!r||!t)return new yp(t,r!==t);if(Array.isArray(r)||Array.isArray(t)){let n=Array.isArray(r)&&Array.isArray(t)&&rn(r,t);return new yp(t,!n)}let e=!1;for(let n in t)if(t.hasOwnProperty(n)){let o=BI(r[n],t[n]);o.didChange&&(r[n]=o.newValue,e=!0)}return new yp(r,e)}var ls=class{constructor(t,e){this.schema=void 0;this.id=t,this.name="_never_",this.defaultValue=e}applyUpdate(t,e){return BI(t,e)}validate(t){return this.defaultValue}},yl=class{constructor(t,e,n,o){this.id=t,this.name=e,this.defaultValue=n,this.schema=o}applyUpdate(t,e){return BI(t,e)}compute(t,e,n){return n}};function le(r,t){return typeof r>"u"?t:r==="false"?!1:!!r}var Te=class extends yl{constructor(t,e,n,o=void 0){typeof o<"u"&&(o.type="boolean",o.default=n),super(t,e,n,o)}validate(t){return le(t,this.defaultValue)}};function p9(r,t,e,n){if(typeof r=="string"&&(r=parseInt(r,10)),typeof r!="number"||isNaN(r))return t;let o=r;return o=Math.max(e,o),o=Math.min(n,o),o|0}var dt=class r extends yl{static clampedInt(t,e,n,o){return p9(t,e,n,o)}constructor(t,e,n,o,i,s=void 0){typeof s<"u"&&(s.type="integer",s.default=n,s.minimum=o,s.maximum=i),super(t,e,n,s),this.minimum=o,this.maximum=i}validate(t){return r.clampedInt(t,this.defaultValue,this.minimum,this.maximum)}};var hr=class r extends yl{static clamp(t,e,n){return t<e?e:t>n?n:t}static float(t,e){return typeof t=="string"&&(t=parseFloat(t)),typeof t!="number"||isNaN(t)?e:t}constructor(t,e,n,o,i,s,a){typeof i<"u"&&(i.type="number",i.default=n,i.minimum=s,i.maximum=a),super(t,e,n,i),this.validationFn=o,this.minimum=s,this.maximum=a}validate(t){return this.validationFn(r.float(t,this.defaultValue))}},co=class r extends yl{static string(t,e){return typeof t!="string"?e:t}constructor(t,e,n,o=void 0){typeof o<"u"&&(o.type="string",o.default=n),super(t,e,n,o)}validate(t){return r.string(t,this.defaultValue)}};function At(r,t,e,n){return typeof r!="string"?t:n&&r in n?n[r]:e.indexOf(r)===-1?t:r}var Rt=class extends yl{constructor(t,e,n,o,i=void 0){typeof i<"u"&&(i.type="string",i.enum=o.slice(0),i.default=n),super(t,e,n,i),this._allowedValues=o}validate(t){return At(t,this.defaultValue,this._allowedValues)}},uc=class extends Mt{constructor(t,e,n,o,i,s,a=void 0){typeof a<"u"&&(a.type="string",a.enum=i,a.default=o),super(t,e,n,a),this._allowedValues=i,this._convert=s}validate(t){return typeof t!="string"?this.defaultValue:this._allowedValues.indexOf(t)===-1?this.defaultValue:this._convert(t)}};function m9(r){switch(r){case"none":return 0;case"keep":return 1;case"brackets":return 2;case"advanced":return 3;case"full":return 4}}var uD=class extends Mt{constructor(){super(2,"accessibilitySupport",0,{type:"string",enum:["auto","on","off"],enumDescriptions:[p(315,null),p(317,null),p(316,null)],default:"auto",tags:["accessibility"],description:p(314,null)})}validate(t){switch(t){case"auto":return 0;case"off":return 1;case"on":return 2}return this.defaultValue}compute(t,e,n){return n===0?t.accessibilitySupport:n}},pD=class extends Mt{constructor(){let t={insertSpace:!0,ignoreEmptyLines:!0};super(29,"comments",t,{"editor.comments.insertSpace":{type:"boolean",default:t.insertSpace,description:p(345,null)},"editor.comments.ignoreEmptyLines":{type:"boolean",default:t.ignoreEmptyLines,description:p(344,null)}})}validate(t){if(!t||typeof t!="object")return this.defaultValue;let e=t;return{insertSpace:le(e.insertSpace,this.defaultValue.insertSpace),ignoreEmptyLines:le(e.ignoreEmptyLines,this.defaultValue.ignoreEmptyLines)}}};function g9(r){switch(r){case"blink":return 1;case"smooth":return 2;case"phase":return 3;case"expand":return 4;case"solid":return 5}}var eR=(s=>(s[s.Line=1]="Line",s[s.Block=2]="Block",s[s.Underline=3]="Underline",s[s.LineThin=4]="LineThin",s[s.BlockOutline=5]="BlockOutline",s[s.UnderlineThin=6]="UnderlineThin",s))(eR||{});function VF(r){switch(r){case"line":return 1;case"block":return 2;case"underline":return 3;case"line-thin":return 4;case"block-outline":return 5;case"underline-thin":return 6}}var mD=class extends ls{constructor(){super(162,"")}compute(t,e,n){let o=["monaco-editor"];return e.get(48)&&o.push(e.get(48)),t.extraEditorClassName&&o.push(t.extraEditorClassName),e.get(82)==="default"?o.push("mouse-default"):e.get(82)==="copy"&&o.push("mouse-copy"),e.get(127)&&o.push("showUnused"),e.get(157)&&o.push("showDeprecated"),o.join(" ")}},gD=class extends Te{constructor(){super(45,"emptySelectionClipboard",!0,{description:p(468,null)})}compute(t,e,n){return n&&t.emptySelectionClipboard}},fD=class extends Mt{constructor(){let t={cursorMoveOnType:!0,findOnType:!0,seedSearchStringFromSelection:"always",autoFindInSelection:"never",globalFindClipboard:!1,addExtraSpaceOnTop:!0,loop:!0,closeOnResult:!1,history:"workspace",replaceHistory:"workspace"};super(50,"find",t,{"editor.find.cursorMoveOnType":{type:"boolean",default:t.cursorMoveOnType,description:p(481,null)},"editor.find.seedSearchStringFromSelection":{type:"string",enum:["never","always","selection"],default:t.seedSearchStringFromSelection,enumDescriptions:[p(404,null),p(403,null),p(405,null)],description:p(487,null)},"editor.find.autoFindInSelection":{type:"string",enum:["never","always","multiline"],default:t.autoFindInSelection,enumDescriptions:[p(398,null),p(396,null),p(397,null)],description:p(479,null)},"editor.find.globalFindClipboard":{type:"boolean",default:t.globalFindClipboard,description:p(483,null),included:pt},"editor.find.addExtraSpaceOnTop":{type:"boolean",default:t.addExtraSpaceOnTop,description:p(478,null)},"editor.find.loop":{type:"boolean",default:t.loop,description:p(485,null)},"editor.find.closeOnResult":{type:"boolean",default:t.closeOnResult,description:p(480,null)},"editor.find.history":{type:"string",enum:["never","workspace"],default:"workspace",enumDescriptions:[p(399,null),p(400,null)],description:p(484,null)},"editor.find.replaceHistory":{type:"string",enum:["never","workspace"],default:"workspace",enumDescriptions:[p(401,null),p(402,null)],description:p(486,null)},"editor.find.findOnType":{type:"boolean",default:t.findOnType,description:p(482,null)}})}validate(t){if(!t||typeof t!="object")return this.defaultValue;let e=t;return{cursorMoveOnType:le(e.cursorMoveOnType,this.defaultValue.cursorMoveOnType),findOnType:le(e.findOnType,this.defaultValue.findOnType),seedSearchStringFromSelection:typeof e.seedSearchStringFromSelection=="boolean"?e.seedSearchStringFromSelection?"always":"never":At(e.seedSearchStringFromSelection,this.defaultValue.seedSearchStringFromSelection,["never","always","selection"]),autoFindInSelection:typeof e.autoFindInSelection=="boolean"?e.autoFindInSelection?"always":"never":At(e.autoFindInSelection,this.defaultValue.autoFindInSelection,["never","always","multiline"]),globalFindClipboard:le(e.globalFindClipboard,this.defaultValue.globalFindClipboard),addExtraSpaceOnTop:le(e.addExtraSpaceOnTop,this.defaultValue.addExtraSpaceOnTop),loop:le(e.loop,this.defaultValue.loop),closeOnResult:le(e.closeOnResult,this.defaultValue.closeOnResult),history:At(e.history,this.defaultValue.history,["never","workspace"]),replaceHistory:At(e.replaceHistory,this.defaultValue.replaceHistory,["never","workspace"])}}},hD=class r extends Mt{static{this.OFF='"liga" off, "calt" off'}static{this.ON='"liga" on, "calt" on'}constructor(){super(60,"fontLigatures",r.OFF,{anyOf:[{type:"boolean",description:p(497,null)},{type:"string",description:p(496,null)}],description:p(498,null),default:!1})}validate(t){return typeof t>"u"?this.defaultValue:typeof t=="string"?t==="false"||t.length===0?r.OFF:t==="true"?r.ON:t:t?r.ON:r.OFF}},vD=class r extends Mt{static{this.OFF=nD}static{this.TRANSLATE=oD}constructor(){super(63,"fontVariations",r.OFF,{anyOf:[{type:"boolean",description:p(500,null)},{type:"string",description:p(501,null)}],description:p(502,null),default:!1})}validate(t){return typeof t>"u"?this.defaultValue:typeof t=="string"?t==="false"?r.OFF:t==="true"?r.TRANSLATE:t:t?r.TRANSLATE:r.OFF}compute(t,e,n){return t.fontInfo.fontVariationSettings}},bD=class extends ls{constructor(){super(59,new NI({pixelRatio:0,fontFamily:"",fontWeight:"",fontSize:0,fontFeatureSettings:"",fontVariationSettings:"",lineHeight:0,letterSpacing:0,isMonospace:!1,typicalHalfwidthCharacterWidth:0,typicalFullwidthCharacterWidth:0,canUseHalfwidthRightwardsArrow:!1,spaceWidth:0,middotWidth:0,wsmiddotWidth:0,maxDigitWidth:0},!1))}compute(t,e,n){return t.fontInfo}},yD=class extends ls{constructor(){super(161,1)}compute(t,e,n){return t.inputMode==="overtype"?e.get(92):e.get(34)}},ID=class extends ls{constructor(){super(170,!1)}compute(t,e){return t.editContextSupported&&e.get(44)}},xD=class extends ls{constructor(){super(172,!1)}compute(t,e){return t.accessibilitySupport===2?e.get(7):e.get(6)}},SD=class extends yl{constructor(){super(61,"fontSize",yi.fontSize,{type:"number",minimum:6,maximum:100,default:yi.fontSize,description:p(499,null)})}validate(t){let e=hr.float(t,this.defaultValue);return e===0?yi.fontSize:hr.clamp(e,6,100)}compute(t,e,n){return t.fontInfo.fontSize}},CD=class r extends Mt{static{this.SUGGESTION_VALUES=["normal","bold","100","200","300","400","500","600","700","800","900"]}static{this.MINIMUM_VALUE=1}static{this.MAXIMUM_VALUE=1e3}constructor(){super(62,"fontWeight",yi.fontWeight,{anyOf:[{type:"number",minimum:r.MINIMUM_VALUE,maximum:r.MAXIMUM_VALUE,errorMessage:p(504,null)},{type:"string",pattern:"^(normal|bold|1000|[1-9][0-9]{0,2})$"},{enum:r.SUGGESTION_VALUES}],default:yi.fontWeight,description:p(503,null)})}validate(t){return t==="normal"||t==="bold"?t:String(dt.clampedInt(t,yi.fontWeight,r.MINIMUM_VALUE,r.MAXIMUM_VALUE))}},TD=class extends Mt{constructor(){let t={multiple:"peek",multipleDefinitions:"peek",multipleTypeDefinitions:"peek",multipleDeclarations:"peek",multipleImplementations:"peek",multipleReferences:"peek",multipleTests:"peek",alternativeDefinitionCommand:"editor.action.goToReferences",alternativeTypeDefinitionCommand:"editor.action.goToReferences",alternativeDeclarationCommand:"editor.action.goToReferences",alternativeImplementationCommand:"",alternativeReferenceCommand:"",alternativeTestsCommand:""},e={type:"string",enum:["peek","gotoAndPeek","goto"],default:t.multiple,enumDescriptions:[p(409,null),p(408,null),p(407,null)]},n=["","editor.action.referenceSearch.trigger","editor.action.goToReferences","editor.action.peekImplementation","editor.action.goToImplementation","editor.action.peekTypeDefinition","editor.action.goToTypeDefinition","editor.action.peekDeclaration","editor.action.revealDeclaration","editor.action.peekDefinition","editor.action.revealDefinitionAside","editor.action.revealDefinition"];super(67,"gotoLocation",t,{"editor.gotoLocation.multiple":{deprecationMessage:p(406,null)},"editor.gotoLocation.multipleDefinitions":{description:p(392,null),...e},"editor.gotoLocation.multipleTypeDefinitions":{description:p(395,null),...e},"editor.gotoLocation.multipleDeclarations":{description:p(391,null),...e},"editor.gotoLocation.multipleImplementations":{description:p(393,null),...e},"editor.gotoLocation.multipleReferences":{description:p(394,null),...e},"editor.gotoLocation.alternativeDefinitionCommand":{type:"string",default:t.alternativeDefinitionCommand,enum:n,description:p(322,null)},"editor.gotoLocation.alternativeTypeDefinitionCommand":{type:"string",default:t.alternativeTypeDefinitionCommand,enum:n,description:p(325,null)},"editor.gotoLocation.alternativeDeclarationCommand":{type:"string",default:t.alternativeDeclarationCommand,enum:n,description:p(321,null)},"editor.gotoLocation.alternativeImplementationCommand":{type:"string",default:t.alternativeImplementationCommand,enum:n,description:p(323,null)},"editor.gotoLocation.alternativeReferenceCommand":{type:"string",default:t.alternativeReferenceCommand,enum:n,description:p(324,null)}})}validate(t){if(!t||typeof t!="object")return this.defaultValue;let e=t;return{multiple:At(e.multiple,this.defaultValue.multiple,["peek","gotoAndPeek","goto"]),multipleDefinitions:At(e.multipleDefinitions,"peek",["peek","gotoAndPeek","goto"]),multipleTypeDefinitions:At(e.multipleTypeDefinitions,"peek",["peek","gotoAndPeek","goto"]),multipleDeclarations:At(e.multipleDeclarations,"peek",["peek","gotoAndPeek","goto"]),multipleImplementations:At(e.multipleImplementations,"peek",["peek","gotoAndPeek","goto"]),multipleReferences:At(e.multipleReferences,"peek",["peek","gotoAndPeek","goto"]),multipleTests:At(e.multipleTests,"peek",["peek","gotoAndPeek","goto"]),alternativeDefinitionCommand:co.string(e.alternativeDefinitionCommand,this.defaultValue.alternativeDefinitionCommand),alternativeTypeDefinitionCommand:co.string(e.alternativeTypeDefinitionCommand,this.defaultValue.alternativeTypeDefinitionCommand),alternativeDeclarationCommand:co.string(e.alternativeDeclarationCommand,this.defaultValue.alternativeDeclarationCommand),alternativeImplementationCommand:co.string(e.alternativeImplementationCommand,this.defaultValue.alternativeImplementationCommand),alternativeReferenceCommand:co.string(e.alternativeReferenceCommand,this.defaultValue.alternativeReferenceCommand),alternativeTestsCommand:co.string(e.alternativeTestsCommand,this.defaultValue.alternativeTestsCommand)}}},ED=class extends Mt{constructor(){let t={enabled:"on",delay:300,hidingDelay:300,sticky:!0,above:!0,showLongLineWarning:!0};super(69,"hover",t,{"editor.hover.enabled":{type:"string",enum:["on","off","onKeyboardModifier"],default:t.enabled,markdownEnumDescriptions:[p(513,null),p(512,null),p(514,null,pt?"Command":"Control")],description:p(511,null)},"editor.hover.delay":{type:"number",default:t.delay,minimum:0,maximum:1e4,description:p(510,null)},"editor.hover.sticky":{type:"boolean",default:t.sticky,description:p(517,null)},"editor.hover.hidingDelay":{type:"integer",minimum:0,default:t.hidingDelay,markdownDescription:p(515,null)},"editor.hover.above":{type:"boolean",default:t.above,description:p(509,null)},"editor.hover.showLongLineWarning":{type:"boolean",default:t.showLongLineWarning,description:p(516,null)}})}validate(t){if(!t||typeof t!="object")return this.defaultValue;let e=t;return{enabled:At(e.enabled,this.defaultValue.enabled,["on","off","onKeyboardModifier"]),delay:dt.clampedInt(e.delay,this.defaultValue.delay,0,1e4),sticky:le(e.sticky,this.defaultValue.sticky),hidingDelay:dt.clampedInt(e.hidingDelay,this.defaultValue.hidingDelay,0,6e5),above:le(e.above,this.defaultValue.above),showLongLineWarning:le(e.showLongLineWarning,this.defaultValue.showLongLineWarning)}}};var wD=class r extends ls{constructor(){super(165,{width:0,height:0,glyphMarginLeft:0,glyphMarginWidth:0,glyphMarginDecorationLaneCount:0,lineNumbersLeft:0,lineNumbersWidth:0,decorationsLeft:0,decorationsWidth:0,contentLeft:0,contentWidth:0,minimap:{renderMinimap:0,minimapLeft:0,minimapWidth:0,minimapHeightIsEditorHeight:!1,minimapIsSampling:!1,minimapScale:1,minimapLineHeight:1,minimapCanvasInnerWidth:0,minimapCanvasInnerHeight:0,minimapCanvasOuterWidth:0,minimapCanvasOuterHeight:0},viewportColumn:0,isWordWrapMinified:!1,isViewportWrapping:!1,wrappingColumn:-1,verticalScrollbarWidth:0,horizontalScrollbarHeight:0,overviewRuler:{top:0,width:0,height:0,right:0}})}compute(t,e,n){return r.computeLayout(e,{memory:t.memory,outerWidth:t.outerWidth,outerHeight:t.outerHeight,isDominatedByLongLines:t.isDominatedByLongLines,lineHeight:t.fontInfo.lineHeight,viewLineCount:t.viewLineCount,lineNumbersDigitCount:t.lineNumbersDigitCount,typicalHalfwidthCharacterWidth:t.fontInfo.typicalHalfwidthCharacterWidth,maxDigitWidth:t.fontInfo.maxDigitWidth,pixelRatio:t.pixelRatio,glyphMarginDecorationLaneCount:t.glyphMarginDecorationLaneCount})}static computeContainedMinimapLineCount(t){let e=t.height/t.lineHeight,n=Math.floor(t.paddingTop/t.lineHeight),o=Math.floor(t.paddingBottom/t.lineHeight);t.scrollBeyondLastLine&&(o=Math.max(o,e-1));let i=(n+t.viewLineCount+o)/(t.pixelRatio*t.height),s=Math.floor(t.viewLineCount/i);return{typicalViewportLineCount:e,extraLinesBeforeFirstLine:n,extraLinesBeyondLastLine:o,desiredRatio:i,minimapLineCount:s}}static _computeMinimapLayout(t,e){let n=t.outerWidth,o=t.outerHeight,i=t.pixelRatio;if(!t.minimap.enabled)return{renderMinimap:0,minimapLeft:0,minimapWidth:0,minimapHeightIsEditorHeight:!1,minimapIsSampling:!1,minimapScale:1,minimapLineHeight:1,minimapCanvasInnerWidth:0,minimapCanvasInnerHeight:Math.floor(i*o),minimapCanvasOuterWidth:0,minimapCanvasOuterHeight:o};let s=e.stableMinimapLayoutInput,a=s&&t.outerHeight===s.outerHeight&&t.lineHeight===s.lineHeight&&t.typicalHalfwidthCharacterWidth===s.typicalHalfwidthCharacterWidth&&t.pixelRatio===s.pixelRatio&&t.scrollBeyondLastLine===s.scrollBeyondLastLine&&t.paddingTop===s.paddingTop&&t.paddingBottom===s.paddingBottom&&t.minimap.enabled===s.minimap.enabled&&t.minimap.side===s.minimap.side&&t.minimap.size===s.minimap.size&&t.minimap.showSlider===s.minimap.showSlider&&t.minimap.renderCharacters===s.minimap.renderCharacters&&t.minimap.maxColumn===s.minimap.maxColumn&&t.minimap.scale===s.minimap.scale&&t.verticalScrollbarWidth===s.verticalScrollbarWidth&&t.isViewportWrapping===s.isViewportWrapping,l=t.lineHeight,d=t.typicalHalfwidthCharacterWidth,c=t.scrollBeyondLastLine,u=t.minimap.renderCharacters,m=i>=2?Math.round(t.minimap.scale*2):t.minimap.scale,g=t.minimap.maxColumn,h=t.minimap.size,f=t.minimap.side,I=t.verticalScrollbarWidth,S=t.viewLineCount,T=t.remainingWidth,P=t.isViewportWrapping,L=u?2:3,q=Math.floor(i*o),N=q/i,B=!1,G=!1,J=L*m,Y=m/i,re=1;if(h==="fill"||h==="fit"){let{typicalViewportLineCount:X,extraLinesBeforeFirstLine:de,extraLinesBeyondLastLine:ge,desiredRatio:Le,minimapLineCount:gt}=r.computeContainedMinimapLineCount({viewLineCount:S,scrollBeyondLastLine:c,paddingTop:t.paddingTop,paddingBottom:t.paddingBottom,height:o,lineHeight:l,pixelRatio:i});if(S/gt>1)B=!0,G=!0,m=1,J=1,Y=m/i;else{let wt=!1,Ht=m+1;if(h==="fit"){let je=Math.ceil((de+S+ge)*J);P&&a&&T<=e.stableFitRemainingWidth?(wt=!0,Ht=e.stableFitMaxMinimapScale):wt=je>q}if(h==="fill"||wt){B=!0;let je=m;J=Math.min(l*i,Math.max(1,Math.floor(1/Le))),P&&a&&T<=e.stableFitRemainingWidth&&(Ht=e.stableFitMaxMinimapScale),m=Math.min(Ht,Math.max(1,Math.floor(J/L))),m>je&&(re=Math.min(2,m/je)),Y=m/i/re,q=Math.ceil(Math.max(X,de+S+ge)*J),P?(e.stableMinimapLayoutInput=t,e.stableFitRemainingWidth=T,e.stableFitMaxMinimapScale=m):(e.stableMinimapLayoutInput=null,e.stableFitRemainingWidth=0)}}}let Pe=Math.floor(g*Y),ot=Math.min(Pe,Math.max(0,Math.floor((T-I-2)*Y/(d+Y)))+u9),rt=Math.floor(i*ot),ne=rt/i;rt=Math.floor(rt*re);let ee=u?1:2,te=f==="left"?0:n-ot-I;return{renderMinimap:ee,minimapLeft:te,minimapWidth:ot,minimapHeightIsEditorHeight:B,minimapIsSampling:G,minimapScale:m,minimapLineHeight:J,minimapCanvasInnerWidth:rt,minimapCanvasInnerHeight:q,minimapCanvasOuterWidth:ne,minimapCanvasOuterHeight:N}}static computeLayout(t,e){let n=e.outerWidth|0,o=e.outerHeight|0,i=e.lineHeight|0,s=e.lineNumbersDigitCount|0,a=e.typicalHalfwidthCharacterWidth,l=e.maxDigitWidth,d=e.pixelRatio,c=e.viewLineCount,u=t.get(154),m=u==="inherit"?t.get(153):u,g=m==="inherit"?t.get(149):m,h=t.get(152),f=e.isDominatedByLongLines,I=t.get(66),S=t.get(76).renderType!==0,T=t.get(77),P=t.get(119),L=t.get(96),q=t.get(81),N=t.get(117),B=N.verticalScrollbarSize,G=N.verticalHasArrows,J=N.arrowSize,Y=N.horizontalScrollbarSize,re=t.get(52),Pe=t.get(126)!=="never",ot=t.get(74);re&&Pe&&(ot+=16);let rt=0;if(S){let _o=Math.max(s,T);rt=Math.round(_o*l)}let ne=0;I&&(ne=i*e.glyphMarginDecorationLaneCount);let ee=0,te=ee+ne,X=te+rt,de=X+ot,ge=n-ne-rt-ot,Le=!1,gt=!1,Ue=-1;t.get(2)===2&&m==="inherit"&&f?(Le=!0,gt=!0):g==="on"||g==="bounded"?gt=!0:g==="wordWrapColumn"&&(Ue=h);let wt=r._computeMinimapLayout({outerWidth:n,outerHeight:o,lineHeight:i,typicalHalfwidthCharacterWidth:a,pixelRatio:d,scrollBeyondLastLine:P,paddingTop:L.top,paddingBottom:L.bottom,minimap:q,verticalScrollbarWidth:B,viewLineCount:c,remainingWidth:ge,isViewportWrapping:gt},e.memory||new cD);wt.renderMinimap!==0&&wt.minimapLeft===0&&(ee+=wt.minimapWidth,te+=wt.minimapWidth,X+=wt.minimapWidth,de+=wt.minimapWidth);let Ht=ge-wt.minimapWidth,je=Math.max(1,Math.floor((Ht-B-2)/a)),_n=G?J:0;return gt&&(Ue=Math.max(1,je),g==="bounded"&&(Ue=Math.min(Ue,h))),{width:n,height:o,glyphMarginLeft:ee,glyphMarginWidth:ne,glyphMarginDecorationLaneCount:e.glyphMarginDecorationLaneCount,lineNumbersLeft:te,lineNumbersWidth:rt,decorationsLeft:X,decorationsWidth:ot,contentLeft:de,contentWidth:Ht,minimap:wt,viewportColumn:je,isWordWrapMinified:Le,isViewportWrapping:gt,wrappingColumn:Ue,verticalScrollbarWidth:B,horizontalScrollbarHeight:Y,overviewRuler:{top:_n,width:B,height:o-2*_n,right:0}}}},kD=class extends Mt{constructor(){super(156,"wrappingStrategy","simple",{"editor.wrappingStrategy":{enumDescriptions:[p(730,null),p(729,null)],type:"string",enum:["simple","advanced"],default:"simple",description:p(728,null)}})}validate(t){return At(t,"simple",["simple","advanced"])}compute(t,e,n){return e.get(2)===2?"advanced":n}};var PD=class extends Mt{constructor(){let t={enabled:"onCode"};super(73,"lightbulb",t,{"editor.lightbulb.enabled":{type:"string",enum:["off","onCode","on"],default:t.enabled,enumDescriptions:[p(430,null),p(432,null),p(431,null)],description:p(469,null)}})}validate(t){return!t||typeof t!="object"?this.defaultValue:{enabled:At(t.enabled,this.defaultValue.enabled,["off","onCode","on"])}}},_D=class extends Mt{constructor(){let t={enabled:!0,maxLineCount:5,defaultModel:"outlineModel",scrollWithEditor:!0};super(131,"stickyScroll",t,{"editor.stickyScroll.enabled":{type:"boolean",default:t.enabled,description:p(434,null)},"editor.stickyScroll.maxLineCount":{type:"number",default:t.maxLineCount,minimum:1,maximum:20,description:p(435,null)},"editor.stickyScroll.defaultModel":{type:"string",enum:["outlineModel","foldingProviderModel","indentationModel"],default:t.defaultModel,description:p(433,null)},"editor.stickyScroll.scrollWithEditor":{type:"boolean",default:t.scrollWithEditor,description:p(436,null)}})}validate(t){if(!t||typeof t!="object")return this.defaultValue;let e=t;return{enabled:le(e.enabled,this.defaultValue.enabled),maxLineCount:dt.clampedInt(e.maxLineCount,this.defaultValue.maxLineCount,1,20),defaultModel:At(e.defaultModel,this.defaultValue.defaultModel,["outlineModel","foldingProviderModel","indentationModel"]),scrollWithEditor:le(e.scrollWithEditor,this.defaultValue.scrollWithEditor)}}},DD=class extends Mt{constructor(){let t={enabled:"on",fontSize:0,fontFamily:"",padding:!1,maximumLength:43};super(159,"inlayHints",t,{"editor.inlayHints.enabled":{type:"string",default:t.enabled,description:p(519,null),enum:["on","onUnlessPressed","offUnlessPressed","off"],markdownEnumDescriptions:[p(426,null),p(427,null,pt?"Ctrl+Option":"Ctrl+Alt"),p(425,null,pt?"Ctrl+Option":"Ctrl+Alt"),p(424,null)]},"editor.inlayHints.fontSize":{type:"number",default:t.fontSize,markdownDescription:p(521,null,"`#editor.fontSize#`","`5`")},"editor.inlayHints.fontFamily":{type:"string",default:t.fontFamily,markdownDescription:p(520,null,"`#editor.fontFamily#`")},"editor.inlayHints.padding":{type:"boolean",default:t.padding,description:p(523,null)},"editor.inlayHints.maximumLength":{type:"number",default:t.maximumLength,markdownDescription:p(522,null)}})}validate(t){if(!t||typeof t!="object")return this.defaultValue;let e=t;return typeof e.enabled=="boolean"&&(e.enabled=e.enabled?"on":"off"),{enabled:At(e.enabled,this.defaultValue.enabled,["on","off","offUnlessPressed","onUnlessPressed"]),fontSize:dt.clampedInt(e.fontSize,this.defaultValue.fontSize,0,100),fontFamily:co.string(e.fontFamily,this.defaultValue.fontFamily),padding:le(e.padding,this.defaultValue.padding),maximumLength:dt.clampedInt(e.maximumLength,this.defaultValue.maximumLength,0,Number.MAX_SAFE_INTEGER)}}},RD=class extends Mt{constructor(){super(74,"lineDecorationsWidth",10)}validate(t){return typeof t=="string"&&/^\d+(\.\d+)?ch$/.test(t)?-parseFloat(t.substring(0,t.length-2)):dt.clampedInt(t,this.defaultValue,0,1e3)}compute(t,e,n){return n<0?dt.clampedInt(-n*t.fontInfo.typicalHalfwidthCharacterWidth,this.defaultValue,0,1e3):n}},AD=class extends hr{constructor(){super(75,"lineHeight",yi.lineHeight,t=>hr.clamp(t,0,150),{markdownDescription:p(545,null)},0,150)}compute(t,e,n){return t.fontInfo.lineHeight}},MD=class extends Mt{constructor(){let t={enabled:!0,size:"proportional",side:"right",showSlider:"mouseover",autohide:"none",renderCharacters:!0,maxColumn:120,scale:1,showRegionSectionHeaders:!0,showMarkSectionHeaders:!0,markSectionHeaderRegex:"\\bMARK:\\s*(?<separator>-?)\\s*(?<label>.*)$",sectionHeaderFontSize:9,sectionHeaderLetterSpacing:1};super(81,"minimap",t,{"editor.minimap.enabled":{type:"boolean",default:t.enabled,description:p(558,null)},"editor.minimap.autohide":{type:"string",enum:["none","mouseover","scroll"],enumDescriptions:[p(556,null),p(555,null),p(557,null)],default:t.autohide,description:p(554,null)},"editor.minimap.size":{type:"string",enum:["proportional","fill","fit"],enumDescriptions:[p(572,null),p(570,null),p(571,null)],default:t.size,description:p(569,null)},"editor.minimap.side":{type:"string",enum:["left","right"],default:t.side,description:p(568,null)},"editor.minimap.showSlider":{type:"string",enum:["always","mouseover"],default:t.showSlider,description:p(567,null)},"editor.minimap.scale":{type:"number",default:t.scale,minimum:1,maximum:3,enum:[1,2,3],description:p(562,null)},"editor.minimap.renderCharacters":{type:"boolean",default:t.renderCharacters,description:p(561,null)},"editor.minimap.maxColumn":{type:"number",default:t.maxColumn,description:p(560,null)},"editor.minimap.showRegionSectionHeaders":{type:"boolean",default:t.showRegionSectionHeaders,description:p(566,null)},"editor.minimap.showMarkSectionHeaders":{type:"boolean",default:t.showMarkSectionHeaders,description:p(565,null)},"editor.minimap.markSectionHeaderRegex":{type:"string",default:t.markSectionHeaderRegex,description:p(559,null)},"editor.minimap.sectionHeaderFontSize":{type:"number",default:t.sectionHeaderFontSize,description:p(563,null)},"editor.minimap.sectionHeaderLetterSpacing":{type:"number",default:t.sectionHeaderLetterSpacing,description:p(564,null)}})}validate(t){if(!t||typeof t!="object")return this.defaultValue;let e=t,n=this.defaultValue.markSectionHeaderRegex,o=e.markSectionHeaderRegex;if(typeof o=="string")try{new RegExp(o,"d"),n=o}catch{}return{enabled:le(e.enabled,this.defaultValue.enabled),autohide:At(e.autohide,this.defaultValue.autohide,["none","mouseover","scroll"]),size:At(e.size,this.defaultValue.size,["proportional","fill","fit"]),side:At(e.side,this.defaultValue.side,["right","left"]),showSlider:At(e.showSlider,this.defaultValue.showSlider,["always","mouseover"]),renderCharacters:le(e.renderCharacters,this.defaultValue.renderCharacters),scale:dt.clampedInt(e.scale,1,1,3),maxColumn:dt.clampedInt(e.maxColumn,this.defaultValue.maxColumn,1,1e4),showRegionSectionHeaders:le(e.showRegionSectionHeaders,this.defaultValue.showRegionSectionHeaders),showMarkSectionHeaders:le(e.showMarkSectionHeaders,this.defaultValue.showMarkSectionHeaders),markSectionHeaderRegex:n,sectionHeaderFontSize:hr.clamp(hr.float(e.sectionHeaderFontSize,this.defaultValue.sectionHeaderFontSize),4,32),sectionHeaderLetterSpacing:hr.clamp(hr.float(e.sectionHeaderLetterSpacing,this.defaultValue.sectionHeaderLetterSpacing),0,5)}}};function f9(r){return r==="ctrlCmd"?pt?"metaKey":"ctrlKey":"altKey"}var LD=class extends Mt{constructor(){super(96,"padding",{top:0,bottom:0},{"editor.padding.top":{type:"number",default:0,minimum:0,maximum:1e3,description:p(597,null)},"editor.padding.bottom":{type:"number",default:0,minimum:0,maximum:1e3,description:p(596,null)}})}validate(t){if(!t||typeof t!="object")return this.defaultValue;let e=t;return{top:dt.clampedInt(e.top,0,0,1e3),bottom:dt.clampedInt(e.bottom,0,0,1e3)}}},OD=class extends Mt{constructor(){let t={enabled:!0,cycle:!0};super(98,"parameterHints",t,{"editor.parameterHints.enabled":{type:"boolean",default:t.enabled,description:p(599,null)},"editor.parameterHints.cycle":{type:"boolean",default:t.cycle,description:p(598,null)}})}validate(t){if(!t||typeof t!="object")return this.defaultValue;let e=t;return{enabled:le(e.enabled,this.defaultValue.enabled),cycle:le(e.cycle,this.defaultValue.cycle)}}},ND=class extends ls{constructor(){super(163,1)}compute(t,e,n){return t.pixelRatio}},UD=class extends Mt{constructor(){super(100,"placeholder",void 0)}validate(t){return typeof t>"u"?this.defaultValue:typeof t=="string"?t:this.defaultValue}},FD=class extends Mt{constructor(){let t={other:"on",comments:"off",strings:"off"},e=[{type:"boolean"},{type:"string",enum:["on","inline","off","offWhenInlineCompletions"],enumDescriptions:[p(592,null),p(524,null),p(590,null),p(591,null)]}];super(102,"quickSuggestions",t,{anyOf:[{type:"boolean"},{type:"string",enum:["on","inline","off","offWhenInlineCompletions"],enumDescriptions:[p(614,null),p(611,null),p(612,null),p(613,null)]},{type:"object",additionalProperties:!1,properties:{strings:{anyOf:e,default:t.strings,description:p(610,null)},comments:{anyOf:e,default:t.comments,description:p(608,null)},other:{anyOf:e,default:t.other,description:p(609,null)}}}],default:t,markdownDescription:p(607,null,"`#editor.suggestOnTriggerCharacters#`"),experiment:{mode:"auto"}}),this.defaultValue=t}validate(t){if(typeof t=="boolean"){let d=t?"on":"off";return{comments:d,strings:d,other:d}}if(typeof t=="string"){let d=["on","inline","off","offWhenInlineCompletions"],c=At(t,this.defaultValue.other,d);return{comments:c,strings:c,other:c}}if(!t||typeof t!="object")return this.defaultValue;let{other:e,comments:n,strings:o}=t,i=["on","inline","off","offWhenInlineCompletions"],s,a,l;return typeof e=="boolean"?s=e?"on":"off":s=At(e,this.defaultValue.other,i),typeof n=="boolean"?a=n?"on":"off":a=At(n,this.defaultValue.comments,i),typeof o=="boolean"?l=o?"on":"off":l=At(o,this.defaultValue.strings,i),{other:s,comments:a,strings:l}}};var HD=class extends Mt{constructor(){super(76,"lineNumbers",{renderType:1,renderFn:null},{type:"string",enum:["off","on","relative","interval"],enumDescriptions:[p(548,null),p(549,null),p(550,null),p(547,null)],default:"on",description:p(546,null)})}validate(t){let e=this.defaultValue.renderType,n=this.defaultValue.renderFn;return typeof t<"u"&&(typeof t=="function"?(e=4,n=t):t==="interval"?e=3:t==="relative"?e=2:t==="on"?e=1:e=0),{renderType:e,renderFn:n}}};var WD=class extends Mt{constructor(){let t=[],e={type:"number",description:p(631,null)};super(116,"rulers",t,{type:"array",items:{anyOf:[e,{type:["object"],properties:{column:e,color:{type:"string",description:p(630,null),format:"color-hex"}}}]},default:t,description:p(629,null)})}validate(t){if(Array.isArray(t)){let e=[];for(let n of t)if(typeof n=="number")e.push({column:dt.clampedInt(n,0,0,1e4),color:null});else if(n&&typeof n=="object"){let o=n;e.push({column:dt.clampedInt(o.column,0,0,1e4),color:o.color})}return e.sort((n,o)=>n.column-o.column),e}return this.defaultValue}},VD=class extends Mt{constructor(){super(105,"readOnlyMessage",void 0)}validate(t){return!t||typeof t!="object"?this.defaultValue:t}};function BF(r,t){if(typeof r!="string")return t;switch(r){case"hidden":return 2;case"visible":return 3;default:return 1}}var BD=class extends Mt{constructor(){let t={vertical:1,horizontal:1,arrowSize:11,useShadows:!0,verticalHasArrows:!1,horizontalHasArrows:!1,horizontalScrollbarSize:12,horizontalSliderSize:12,verticalScrollbarSize:14,verticalSliderSize:14,handleMouseWheel:!0,alwaysConsumeMouseWheel:!0,scrollByPage:!1,ignoreHorizontalScrollbarInContentHeight:!1};super(117,"scrollbar",t,{"editor.scrollbar.vertical":{type:"string",enum:["auto","visible","hidden"],enumDescriptions:[p(641,null),p(643,null),p(642,null)],default:"auto",description:p(640,null)},"editor.scrollbar.horizontal":{type:"string",enum:["auto","visible","hidden"],enumDescriptions:[p(634,null),p(636,null),p(635,null)],default:"auto",description:p(633,null)},"editor.scrollbar.verticalScrollbarSize":{type:"number",default:t.verticalScrollbarSize,description:p(644,null)},"editor.scrollbar.horizontalScrollbarSize":{type:"number",default:t.horizontalScrollbarSize,description:p(637,null)},"editor.scrollbar.scrollByPage":{type:"boolean",default:t.scrollByPage,description:p(639,null)},"editor.scrollbar.ignoreHorizontalScrollbarInContentHeight":{type:"boolean",default:t.ignoreHorizontalScrollbarInContentHeight,description:p(638,null)}})}validate(t){if(!t||typeof t!="object")return this.defaultValue;let e=t,n=dt.clampedInt(e.horizontalScrollbarSize,this.defaultValue.horizontalScrollbarSize,0,1e3),o=dt.clampedInt(e.verticalScrollbarSize,this.defaultValue.verticalScrollbarSize,0,1e3);return{arrowSize:dt.clampedInt(e.arrowSize,this.defaultValue.arrowSize,0,1e3),vertical:BF(e.vertical,this.defaultValue.vertical),horizontal:BF(e.horizontal,this.defaultValue.horizontal),useShadows:le(e.useShadows,this.defaultValue.useShadows),verticalHasArrows:le(e.verticalHasArrows,this.defaultValue.verticalHasArrows),horizontalHasArrows:le(e.horizontalHasArrows,this.defaultValue.horizontalHasArrows),handleMouseWheel:le(e.handleMouseWheel,this.defaultValue.handleMouseWheel),alwaysConsumeMouseWheel:le(e.alwaysConsumeMouseWheel,this.defaultValue.alwaysConsumeMouseWheel),horizontalScrollbarSize:n,horizontalSliderSize:dt.clampedInt(e.horizontalSliderSize,n,0,1e3),verticalScrollbarSize:o,verticalSliderSize:dt.clampedInt(e.verticalSliderSize,o,0,1e3),scrollByPage:le(e.scrollByPage,this.defaultValue.scrollByPage),ignoreHorizontalScrollbarInContentHeight:le(e.ignoreHorizontalScrollbarInContentHeight,this.defaultValue.ignoreHorizontalScrollbarInContentHeight)}}},xi="inUntrustedWorkspace",cc={allowedCharacters:"editor.unicodeHighlight.allowedCharacters",invisibleCharacters:"editor.unicodeHighlight.invisibleCharacters",nonBasicASCII:"editor.unicodeHighlight.nonBasicASCII",ambiguousCharacters:"editor.unicodeHighlight.ambiguousCharacters",includeComments:"editor.unicodeHighlight.includeComments",includeStrings:"editor.unicodeHighlight.includeStrings",allowedLocales:"editor.unicodeHighlight.allowedLocales"},$D=class extends Mt{constructor(){let t={nonBasicASCII:xi,invisibleCharacters:!0,ambiguousCharacters:!0,includeComments:xi,includeStrings:!0,allowedCharacters:{},allowedLocales:{_os:!0,_vscode:!0}};super(142,"unicodeHighlight",t,{[cc.nonBasicASCII]:{restricted:!0,type:["boolean","string"],enum:[!0,!1,xi],default:t.nonBasicASCII,description:p(705,null)},[cc.invisibleCharacters]:{restricted:!0,type:"boolean",default:t.invisibleCharacters,description:p(704,null)},[cc.ambiguousCharacters]:{restricted:!0,type:"boolean",default:t.ambiguousCharacters,description:p(701,null)},[cc.includeComments]:{restricted:!0,type:["boolean","string"],enum:[!0,!1,xi],default:t.includeComments,description:p(702,null)},[cc.includeStrings]:{restricted:!0,type:["boolean","string"],enum:[!0,!1,xi],default:t.includeStrings,description:p(703,null)},[cc.allowedCharacters]:{restricted:!0,type:"object",default:t.allowedCharacters,description:p(699,null),additionalProperties:{type:"boolean"}},[cc.allowedLocales]:{restricted:!0,type:"object",additionalProperties:{type:"boolean"},default:t.allowedLocales,description:p(700,null)}})}applyUpdate(t,e){let n=!1;e.allowedCharacters&&t&&(qt(t.allowedCharacters,e.allowedCharacters)||(t={...t,allowedCharacters:e.allowedCharacters},n=!0)),e.allowedLocales&&t&&(qt(t.allowedLocales,e.allowedLocales)||(t={...t,allowedLocales:e.allowedLocales},n=!0));let o=super.applyUpdate(t,e);return n?new yp(o.newValue,!0):o}validate(t){if(!t||typeof t!="object")return this.defaultValue;let e=t;return{nonBasicASCII:Ip(e.nonBasicASCII,xi,[!0,!1,xi]),invisibleCharacters:le(e.invisibleCharacters,this.defaultValue.invisibleCharacters),ambiguousCharacters:le(e.ambiguousCharacters,this.defaultValue.ambiguousCharacters),includeComments:Ip(e.includeComments,xi,[!0,!1,xi]),includeStrings:Ip(e.includeStrings,xi,[!0,!1,xi]),allowedCharacters:this.validateBooleanMap(e.allowedCharacters,this.defaultValue.allowedCharacters),allowedLocales:this.validateBooleanMap(e.allowedLocales,this.defaultValue.allowedLocales)}}validateBooleanMap(t,e){if(typeof t!="object"||!t)return e;let n={};for(let[o,i]of Object.entries(t))i===!0&&(n[o]=!0);return n}},zD=class extends Mt{constructor(){let t={enabled:!0,mode:"subwordSmart",showToolbar:"onHover",suppressSuggestions:!1,keepOnBlur:!1,fontFamily:"default",syntaxHighlightingEnabled:!0,minShowDelay:0,suppressInSnippetMode:!0,edits:{enabled:!0,showCollapsed:!1,renderSideBySide:"auto",allowCodeShifting:"always",showLongDistanceHint:!0},triggerCommandOnProviderChange:!1,experimental:{suppressInlineSuggestions:"",showOnSuggestConflict:"never",emptyResponseInformation:!0}};super(71,"inlineSuggest",t,{"editor.inlineSuggest.enabled":{type:"boolean",default:t.enabled,description:p(531,null)},"editor.inlineSuggest.showToolbar":{type:"string",default:t.showToolbar,enum:["always","onHover","never"],enumDescriptions:[p(536,null),p(538,null),p(537,null)],description:p(535,null)},"editor.inlineSuggest.syntaxHighlightingEnabled":{type:"boolean",default:t.syntaxHighlightingEnabled,description:p(542,null)},"editor.inlineSuggest.suppressSuggestions":{type:"boolean",default:t.suppressSuggestions,description:p(541,null)},"editor.inlineSuggest.suppressInSnippetMode":{type:"boolean",default:t.suppressInSnippetMode,description:p(540,null)},"editor.inlineSuggest.minShowDelay":{type:"number",default:0,minimum:0,maximum:1e4,description:p(533,null)},"editor.inlineSuggest.experimental.suppressInlineSuggestions":{type:"string",default:t.experimental.suppressInlineSuggestions,tags:["experimental"],description:p(539,null),experiment:{mode:"auto"}},"editor.inlineSuggest.experimental.emptyResponseInformation":{type:"boolean",default:t.experimental.emptyResponseInformation,tags:["experimental"],description:p(530,null),experiment:{mode:"auto"}},"editor.inlineSuggest.triggerCommandOnProviderChange":{type:"boolean",default:t.triggerCommandOnProviderChange,tags:["experimental"],description:p(543,null),experiment:{mode:"auto"}},"editor.inlineSuggest.experimental.showOnSuggestConflict":{type:"string",default:t.experimental.showOnSuggestConflict,tags:["experimental"],enum:["always","never","whenSuggestListIsIncomplete"],description:p(534,null),experiment:{mode:"auto"}},"editor.inlineSuggest.fontFamily":{type:"string",default:t.fontFamily,description:p(532,null)},"editor.inlineSuggest.edits.allowCodeShifting":{type:"string",default:t.edits.allowCodeShifting,description:p(526,null),enum:["always","horizontal","never"],tags:["nextEditSuggestions"]},"editor.inlineSuggest.edits.showLongDistanceHint":{type:"boolean",default:t.edits.showLongDistanceHint,description:p(529,null),tags:["nextEditSuggestions","experimental"]},"editor.inlineSuggest.edits.renderSideBySide":{type:"string",default:t.edits.renderSideBySide,description:p(527,null),enum:["auto","never"],enumDescriptions:[p(428,null),p(429,null)],tags:["nextEditSuggestions"]},"editor.inlineSuggest.edits.showCollapsed":{type:"boolean",default:t.edits.showCollapsed,description:p(528,null),tags:["nextEditSuggestions"]}})}validate(t){if(!t||typeof t!="object")return this.defaultValue;let e=t;return{enabled:le(e.enabled,this.defaultValue.enabled),mode:At(e.mode,this.defaultValue.mode,["prefix","subword","subwordSmart"]),showToolbar:At(e.showToolbar,this.defaultValue.showToolbar,["always","onHover","never"]),suppressSuggestions:le(e.suppressSuggestions,this.defaultValue.suppressSuggestions),keepOnBlur:le(e.keepOnBlur,this.defaultValue.keepOnBlur),fontFamily:co.string(e.fontFamily,this.defaultValue.fontFamily),syntaxHighlightingEnabled:le(e.syntaxHighlightingEnabled,this.defaultValue.syntaxHighlightingEnabled),minShowDelay:dt.clampedInt(e.minShowDelay,0,0,1e4),suppressInSnippetMode:le(e.suppressInSnippetMode,this.defaultValue.suppressInSnippetMode),edits:this._validateEdits(e.edits),triggerCommandOnProviderChange:le(e.triggerCommandOnProviderChange,this.defaultValue.triggerCommandOnProviderChange),experimental:this._validateExperimental(e.experimental)}}_validateEdits(t){if(!t||typeof t!="object")return this.defaultValue.edits;let e=t;return{enabled:le(e.enabled,this.defaultValue.edits.enabled),showCollapsed:le(e.showCollapsed,this.defaultValue.edits.showCollapsed),allowCodeShifting:At(e.allowCodeShifting,this.defaultValue.edits.allowCodeShifting,["always","horizontal","never"]),showLongDistanceHint:le(e.showLongDistanceHint,this.defaultValue.edits.showLongDistanceHint),renderSideBySide:At(e.renderSideBySide,this.defaultValue.edits.renderSideBySide,["never","auto"])}}_validateExperimental(t){if(!t||typeof t!="object")return this.defaultValue.experimental;let e=t;return{suppressInlineSuggestions:co.string(e.suppressInlineSuggestions,this.defaultValue.experimental.suppressInlineSuggestions),showOnSuggestConflict:At(e.showOnSuggestConflict,this.defaultValue.experimental.showOnSuggestConflict,["always","never","whenSuggestListIsIncomplete"]),emptyResponseInformation:le(e.emptyResponseInformation,this.defaultValue.experimental.emptyResponseInformation)}}},qD=class extends Mt{constructor(){let t={enabled:rD.bracketPairColorizationOptions.enabled,independentColorPoolPerBracketType:rD.bracketPairColorizationOptions.independentColorPoolPerBracketType};super(21,"bracketPairColorization",t,{"editor.bracketPairColorization.enabled":{type:"boolean",default:t.enabled,markdownDescription:p(335,null,"`#workbench.colorCustomizations#`")},"editor.bracketPairColorization.independentColorPoolPerBracketType":{type:"boolean",default:t.independentColorPoolPerBracketType,description:p(336,null)}})}validate(t){if(!t||typeof t!="object")return this.defaultValue;let e=t;return{enabled:le(e.enabled,this.defaultValue.enabled),independentColorPoolPerBracketType:le(e.independentColorPoolPerBracketType,this.defaultValue.independentColorPoolPerBracketType)}}},KD=class extends Mt{constructor(){let t={bracketPairs:!1,bracketPairsHorizontal:"active",highlightActiveBracketPair:!0,indentation:!0,highlightActiveIndentation:!0};super(22,"guides",t,{"editor.guides.bracketPairs":{type:["boolean","string"],enum:[!0,"active",!1],enumDescriptions:[p(413,null),p(411,null),p(412,null)],default:t.bracketPairs,description:p(410,null)},"editor.guides.bracketPairsHorizontal":{type:["boolean","string"],enum:[!0,"active",!1],enumDescriptions:[p(417,null),p(415,null),p(416,null)],default:t.bracketPairsHorizontal,description:p(414,null)},"editor.guides.highlightActiveBracketPair":{type:"boolean",default:t.highlightActiveBracketPair,description:p(418,null)},"editor.guides.indentation":{type:"boolean",default:t.indentation,description:p(423,null)},"editor.guides.highlightActiveIndentation":{type:["boolean","string"],enum:[!0,"always",!1],enumDescriptions:[p(422,null),p(420,null),p(421,null)],default:t.highlightActiveIndentation,description:p(419,null)}})}validate(t){if(!t||typeof t!="object")return this.defaultValue;let e=t;return{bracketPairs:Ip(e.bracketPairs,this.defaultValue.bracketPairs,[!0,!1,"active"]),bracketPairsHorizontal:Ip(e.bracketPairsHorizontal,this.defaultValue.bracketPairsHorizontal,[!0,!1,"active"]),highlightActiveBracketPair:le(e.highlightActiveBracketPair,this.defaultValue.highlightActiveBracketPair),indentation:le(e.indentation,this.defaultValue.indentation),highlightActiveIndentation:Ip(e.highlightActiveIndentation,this.defaultValue.highlightActiveIndentation,[!0,!1,"always"])}}};function Ip(r,t,e){let n=e.indexOf(r);return n===-1?t:e[n]}var jD=class extends Mt{constructor(){let t={insertMode:"insert",filterGraceful:!0,snippetsPreventQuickSuggestions:!1,localityBonus:!1,shareSuggestSelections:!1,selectionMode:"always",showIcons:!0,showStatusBar:!1,preview:!1,previewMode:"subwordSmart",showInlineDetails:!0,showMethods:!0,showFunctions:!0,showConstructors:!0,showDeprecated:!0,matchOnWordStartOnly:!0,showFields:!0,showVariables:!0,showClasses:!0,showStructs:!0,showInterfaces:!0,showModules:!0,showProperties:!0,showEvents:!0,showOperators:!0,showUnits:!0,showValues:!0,showConstants:!0,showEnums:!0,showEnumMembers:!0,showKeywords:!0,showWords:!0,showColors:!0,showFiles:!0,showReferences:!0,showFolders:!0,showTypeParameters:!0,showSnippets:!0,showUsers:!0,showIssues:!0};super(134,"suggest",t,{"editor.suggest.insertMode":{type:"string",enum:["insert","replace"],enumDescriptions:[p(671,null),p(673,null)],default:t.insertMode,description:p(669,null)},"editor.suggest.filterGraceful":{type:"boolean",default:t.filterGraceful,description:p(668,null)},"editor.suggest.localityBonus":{type:"boolean",default:t.localityBonus,description:p(676,null)},"editor.suggest.shareSuggestSelections":{type:"boolean",default:t.shareSuggestSelections,markdownDescription:p(680,null)},"editor.suggest.selectionMode":{type:"string",enum:["always","never","whenTriggerCharacter","whenQuickSuggestion"],enumDescriptions:[p(670,null),p(672,null),p(675,null),p(674,null)],default:t.selectionMode,markdownDescription:p(679,null,"`#editor.quickSuggestions#`","`#editor.suggestOnTriggerCharacters#`")},"editor.suggest.snippetsPreventQuickSuggestions":{type:"boolean",default:t.snippetsPreventQuickSuggestions,description:p(684,null)},"editor.suggest.showIcons":{type:"boolean",default:t.showIcons,description:p(681,null)},"editor.suggest.showStatusBar":{type:"boolean",default:t.showStatusBar,description:p(683,null)},"editor.suggest.preview":{type:"boolean",default:t.preview,description:p(678,null)},"editor.suggest.showInlineDetails":{type:"boolean",default:t.showInlineDetails,description:p(682,null)},"editor.suggest.maxVisibleSuggestions":{type:"number",deprecationMessage:p(677,null)},"editor.suggest.filteredTypes":{type:"object",deprecationMessage:p(361,null)},"editor.suggest.showMethods":{type:"boolean",default:!0,markdownDescription:p(454,null)},"editor.suggest.showFunctions":{type:"boolean",default:!0,markdownDescription:p(450,null)},"editor.suggest.showConstructors":{type:"boolean",default:!0,markdownDescription:p(441,null)},"editor.suggest.showDeprecated":{type:"boolean",default:!0,markdownDescription:p(443,null)},"editor.suggest.matchOnWordStartOnly":{type:"boolean",default:!0,markdownDescription:p(437,null)},"editor.suggest.showFields":{type:"boolean",default:!0,markdownDescription:p(447,null)},"editor.suggest.showVariables":{type:"boolean",default:!0,markdownDescription:p(466,null)},"editor.suggest.showClasses":{type:"boolean",default:!0,markdownDescription:p(438,null)},"editor.suggest.showStructs":{type:"boolean",default:!0,markdownDescription:p(460,null)},"editor.suggest.showInterfaces":{type:"boolean",default:!0,markdownDescription:p(451,null)},"editor.suggest.showModules":{type:"boolean",default:!0,markdownDescription:p(455,null)},"editor.suggest.showProperties":{type:"boolean",default:!0,markdownDescription:p(457,null)},"editor.suggest.showEvents":{type:"boolean",default:!0,markdownDescription:p(446,null)},"editor.suggest.showOperators":{type:"boolean",default:!0,markdownDescription:p(456,null)},"editor.suggest.showUnits":{type:"boolean",default:!0,markdownDescription:p(463,null)},"editor.suggest.showValues":{type:"boolean",default:!0,markdownDescription:p(465,null)},"editor.suggest.showConstants":{type:"boolean",default:!0,markdownDescription:p(440,null)},"editor.suggest.showEnums":{type:"boolean",default:!0,markdownDescription:p(445,null)},"editor.suggest.showEnumMembers":{type:"boolean",default:!0,markdownDescription:p(444,null)},"editor.suggest.showKeywords":{type:"boolean",default:!0,markdownDescription:p(453,null)},"editor.suggest.showWords":{type:"boolean",default:!0,markdownDescription:p(461,null)},"editor.suggest.showColors":{type:"boolean",default:!0,markdownDescription:p(439,null)},"editor.suggest.showFiles":{type:"boolean",default:!0,markdownDescription:p(448,null)},"editor.suggest.showReferences":{type:"boolean",default:!0,markdownDescription:p(458,null)},"editor.suggest.showCustomcolors":{type:"boolean",default:!0,markdownDescription:p(442,null)},"editor.suggest.showFolders":{type:"boolean",default:!0,markdownDescription:p(449,null)},"editor.suggest.showTypeParameters":{type:"boolean",default:!0,markdownDescription:p(462,null)},"editor.suggest.showSnippets":{type:"boolean",default:!0,markdownDescription:p(459,null)},"editor.suggest.showUsers":{type:"boolean",default:!0,markdownDescription:p(464,null)},"editor.suggest.showIssues":{type:"boolean",default:!0,markdownDescription:p(452,null)}})}validate(t){if(!t||typeof t!="object")return this.defaultValue;let e=t;return{insertMode:At(e.insertMode,this.defaultValue.insertMode,["insert","replace"]),filterGraceful:le(e.filterGraceful,this.defaultValue.filterGraceful),snippetsPreventQuickSuggestions:le(e.snippetsPreventQuickSuggestions,this.defaultValue.filterGraceful),localityBonus:le(e.localityBonus,this.defaultValue.localityBonus),shareSuggestSelections:le(e.shareSuggestSelections,this.defaultValue.shareSuggestSelections),selectionMode:At(e.selectionMode,this.defaultValue.selectionMode,["always","never","whenQuickSuggestion","whenTriggerCharacter"]),showIcons:le(e.showIcons,this.defaultValue.showIcons),showStatusBar:le(e.showStatusBar,this.defaultValue.showStatusBar),preview:le(e.preview,this.defaultValue.preview),previewMode:At(e.previewMode,this.defaultValue.previewMode,["prefix","subword","subwordSmart"]),showInlineDetails:le(e.showInlineDetails,this.defaultValue.showInlineDetails),showMethods:le(e.showMethods,this.defaultValue.showMethods),showFunctions:le(e.showFunctions,this.defaultValue.showFunctions),showConstructors:le(e.showConstructors,this.defaultValue.showConstructors),showDeprecated:le(e.showDeprecated,this.defaultValue.showDeprecated),matchOnWordStartOnly:le(e.matchOnWordStartOnly,this.defaultValue.matchOnWordStartOnly),showFields:le(e.showFields,this.defaultValue.showFields),showVariables:le(e.showVariables,this.defaultValue.showVariables),showClasses:le(e.showClasses,this.defaultValue.showClasses),showStructs:le(e.showStructs,this.defaultValue.showStructs),showInterfaces:le(e.showInterfaces,this.defaultValue.showInterfaces),showModules:le(e.showModules,this.defaultValue.showModules),showProperties:le(e.showProperties,this.defaultValue.showProperties),showEvents:le(e.showEvents,this.defaultValue.showEvents),showOperators:le(e.showOperators,this.defaultValue.showOperators),showUnits:le(e.showUnits,this.defaultValue.showUnits),showValues:le(e.showValues,this.defaultValue.showValues),showConstants:le(e.showConstants,this.defaultValue.showConstants),showEnums:le(e.showEnums,this.defaultValue.showEnums),showEnumMembers:le(e.showEnumMembers,this.defaultValue.showEnumMembers),showKeywords:le(e.showKeywords,this.defaultValue.showKeywords),showWords:le(e.showWords,this.defaultValue.showWords),showColors:le(e.showColors,this.defaultValue.showColors),showFiles:le(e.showFiles,this.defaultValue.showFiles),showReferences:le(e.showReferences,this.defaultValue.showReferences),showFolders:le(e.showFolders,this.defaultValue.showFolders),showTypeParameters:le(e.showTypeParameters,this.defaultValue.showTypeParameters),showSnippets:le(e.showSnippets,this.defaultValue.showSnippets),showUsers:le(e.showUsers,this.defaultValue.showUsers),showIssues:le(e.showIssues,this.defaultValue.showIssues)}}},GD=class extends Mt{constructor(){super(129,"smartSelect",{selectLeadingAndTrailingWhitespace:!0,selectSubwords:!0},{"editor.smartSelect.selectLeadingAndTrailingWhitespace":{description:p(653,null),default:!0,type:"boolean"},"editor.smartSelect.selectSubwords":{description:p(654,null),default:!0,type:"boolean"}})}validate(t){return!t||typeof t!="object"?this.defaultValue:{selectLeadingAndTrailingWhitespace:le(t.selectLeadingAndTrailingWhitespace,this.defaultValue.selectLeadingAndTrailingWhitespace),selectSubwords:le(t.selectSubwords,this.defaultValue.selectSubwords)}}},QD=class extends Mt{constructor(){let t=[];super(147,"wordSegmenterLocales",t,{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}],description:p(714,null),type:"array",items:{type:"string"},default:t})}validate(t){if(typeof t=="string"&&(t=[t]),Array.isArray(t)){let e=[];for(let n of t)if(typeof n=="string")try{Intl.Segmenter.supportedLocalesOf(n).length>0&&e.push(n)}catch{}return e}return this.defaultValue}};var JD=class extends Mt{constructor(){super(155,"wrappingIndent",1,{"editor.wrappingIndent":{type:"string",enum:["none","same","indent","deepIndent"],enumDescriptions:[p(726,null),p(727,null),p(725,null),p(724,null)],description:p(723,null),default:"same"}})}validate(t){switch(t){case"none":return 0;case"same":return 1;case"indent":return 2;case"deepIndent":return 3}return 1}compute(t,e,n){return e.get(2)===2?0:n}},YD=class extends ls{constructor(){super(166,{isDominatedByLongLines:!1,isWordWrapMinified:!1,isViewportWrapping:!1,wrappingColumn:-1})}compute(t,e,n){let o=e.get(165);return{isDominatedByLongLines:t.isDominatedByLongLines,isWordWrapMinified:o.isWordWrapMinified,isViewportWrapping:o.isViewportWrapping,wrappingColumn:o.wrappingColumn}}},XD=class extends Mt{constructor(){let t={enabled:!0,showDropSelector:"afterDrop"};super(43,"dropIntoEditor",t,{"editor.dropIntoEditor.enabled":{type:"boolean",default:t.enabled,markdownDescription:p(364,null)},"editor.dropIntoEditor.showDropSelector":{type:"string",markdownDescription:p(365,null),enum:["afterDrop","never"],enumDescriptions:[p(366,null),p(367,null)],default:"afterDrop"}})}validate(t){if(!t||typeof t!="object")return this.defaultValue;let e=t;return{enabled:le(e.enabled,this.defaultValue.enabled),showDropSelector:At(e.showDropSelector,this.defaultValue.showDropSelector,["afterDrop","never"])}}},ZD=class extends Mt{constructor(){let t={enabled:!0,showPasteSelector:"afterPaste"};super(97,"pasteAs",t,{"editor.pasteAs.enabled":{type:"boolean",default:t.enabled,markdownDescription:p(600,null)},"editor.pasteAs.showPasteSelector":{type:"string",markdownDescription:p(601,null),enum:["afterPaste","never"],enumDescriptions:[p(602,null),p(603,null)],default:"afterPaste"}})}validate(t){if(!t||typeof t!="object")return this.defaultValue;let e=t;return{enabled:le(e.enabled,this.defaultValue.enabled),showPasteSelector:At(e.showPasteSelector,this.defaultValue.showPasteSelector,["afterPaste","never"])}}},h9=[];function U(r){return h9[r.id]=r,r}var kte={acceptSuggestionOnCommitCharacter:U(new Te(0,"acceptSuggestionOnCommitCharacter",!0,{markdownDescription:p(310,null)})),acceptSuggestionOnEnter:U(new Rt(1,"acceptSuggestionOnEnter","on",["on","smart","off"],{markdownEnumDescriptions:["",p(312,null),""],markdownDescription:p(311,null)})),accessibilitySupport:U(new uD),accessibilityPageSize:U(new dt(3,"accessibilityPageSize",500,1,1073741824,{description:p(313,null),tags:["accessibility"]})),allowOverflow:U(new Te(4,"allowOverflow",!0)),allowVariableLineHeights:U(new Te(5,"allowVariableLineHeights",!0,{description:p(320,null)})),allowVariableFonts:U(new Te(6,"allowVariableFonts",!0,{description:p(318,null)})),allowVariableFontsInAccessibilityMode:U(new Te(7,"allowVariableFontsInAccessibilityMode",!1,{description:p(319,null),tags:["accessibility"]})),ariaLabel:U(new co(8,"ariaLabel",p(467,null))),ariaRequired:U(new Te(9,"ariaRequired",!1,void 0)),screenReaderAnnounceInlineSuggestion:U(new Te(12,"screenReaderAnnounceInlineSuggestion",!0,{description:p(632,null),tags:["accessibility"]})),autoClosingBrackets:U(new Rt(10,"autoClosingBrackets","languageDefined",["always","languageDefined","beforeWhitespace","never"],{enumDescriptions:["",p(370,null),p(369,null),""],description:p(326,null)})),autoClosingComments:U(new Rt(11,"autoClosingComments","languageDefined",["always","languageDefined","beforeWhitespace","never"],{enumDescriptions:["",p(372,null),p(371,null),""],description:p(327,null)})),autoClosingDelete:U(new Rt(13,"autoClosingDelete","auto",["always","auto","never"],{enumDescriptions:["",p(373,null),""],description:p(328,null)})),autoClosingOvertype:U(new Rt(14,"autoClosingOvertype","auto",["always","auto","never"],{enumDescriptions:["",p(374,null),""],description:p(329,null)})),autoClosingQuotes:U(new Rt(15,"autoClosingQuotes","languageDefined",["always","languageDefined","beforeWhitespace","never"],{enumDescriptions:["",p(376,null),p(375,null),""],description:p(330,null)})),autoIndent:U(new uc(16,"autoIndent",4,"full",["none","keep","brackets","advanced","full"],m9,{enumDescriptions:[p(381,null),p(380,null),p(378,null),p(377,null),p(379,null)],description:p(331,null)})),autoIndentOnPaste:U(new Te(17,"autoIndentOnPaste",!1,{description:p(332,null)})),autoIndentOnPasteWithinString:U(new Te(18,"autoIndentOnPasteWithinString",!0,{description:p(333,null)})),automaticLayout:U(new Te(19,"automaticLayout",!1)),autoSurround:U(new Rt(20,"autoSurround","languageDefined",["languageDefined","quotes","brackets","never"],{enumDescriptions:[p(383,null),p(384,null),p(382,null),""],description:p(334,null)})),bracketPairColorization:U(new qD),bracketPairGuides:U(new KD),stickyTabStops:U(new Te(132,"stickyTabStops",!1,{description:p(667,null)})),codeLens:U(new Te(23,"codeLens",!0,{description:p(337,null)})),codeLensFontFamily:U(new co(24,"codeLensFontFamily","",{description:p(338,null)})),codeLensFontSize:U(new dt(25,"codeLensFontSize",0,0,100,{type:"number",default:0,minimum:0,maximum:100,markdownDescription:p(339,null)})),colorDecorators:U(new Te(26,"colorDecorators",!0,{description:p(341,null)})),colorDecoratorActivatedOn:U(new Rt(168,"colorDecoratorsActivatedOn","clickAndHover",["clickAndHover","hover","click"],{enumDescriptions:[p(386,null),p(387,null),p(385,null)],description:p(340,null)})),colorDecoratorsLimit:U(new dt(27,"colorDecoratorsLimit",500,1,1e6,{markdownDescription:p(342,null)})),columnSelection:U(new Te(28,"columnSelection",!1,{description:p(343,null)})),comments:U(new pD),contextmenu:U(new Te(30,"contextmenu",!0)),copyWithSyntaxHighlighting:U(new Te(31,"copyWithSyntaxHighlighting",!0,{description:p(346,null)})),cursorBlinking:U(new uc(32,"cursorBlinking",1,"blink",["blink","smooth","phase","expand","solid"],g9,{description:p(347,null)})),cursorSmoothCaretAnimation:U(new Rt(33,"cursorSmoothCaretAnimation","off",["off","explicit","on"],{enumDescriptions:[p(351,null),p(350,null),p(352,null)],description:p(349,null)})),cursorStyle:U(new uc(34,"cursorStyle",1,"line",["line","block","underline","line-thin","block-outline","underline-thin"],VF,{description:p(353,null)})),overtypeCursorStyle:U(new uc(92,"overtypeCursorStyle",2,"block",["line","block","underline","line-thin","block-outline","underline-thin"],VF,{description:p(593,null)})),cursorSurroundingLines:U(new dt(35,"cursorSurroundingLines",0,0,1073741824,{description:p(354,null)})),cursorSurroundingLinesStyle:U(new Rt(36,"cursorSurroundingLinesStyle","default",["default","all"],{enumDescriptions:[p(357,null),p(356,null)],markdownDescription:p(355,null)})),cursorWidth:U(new dt(37,"cursorWidth",0,0,1073741824,{markdownDescription:p(358,null)})),cursorHeight:U(new dt(38,"cursorHeight",0,0,1073741824,{markdownDescription:p(348,null)})),disableLayerHinting:U(new Te(39,"disableLayerHinting",!1)),disableMonospaceOptimizations:U(new Te(40,"disableMonospaceOptimizations",!1)),domReadOnly:U(new Te(41,"domReadOnly",!1)),doubleClickSelectsBlock:U(new Te(173,"doubleClickSelectsBlock",!0,{description:p(362,null)})),dragAndDrop:U(new Te(42,"dragAndDrop",!0,{description:p(363,null)})),emptySelectionClipboard:U(new gD),dropIntoEditor:U(new XD),editContext:U(new Te(44,"editContext",!0,{description:p(368,null),included:ph||eI||Jy})),renderRichScreenReaderContent:U(new Te(107,"renderRichScreenReaderContent",!1,{markdownDescription:p(623,null)})),stickyScroll:U(new _D),experimentalGpuAcceleration:U(new Rt(46,"experimentalGpuAcceleration","off",["off","on"],{tags:["experimental"],enumDescriptions:[p(471,null),p(472,null)],description:p(470,null)})),experimentalWhitespaceRendering:U(new Rt(47,"experimentalWhitespaceRendering","svg",["svg","font","off"],{enumDescriptions:[p(476,null),p(474,null),p(475,null)],description:p(473,null)})),extraEditorClassName:U(new co(48,"extraEditorClassName","")),fastScrollSensitivity:U(new hr(49,"fastScrollSensitivity",5,r=>r<=0?5:r,{markdownDescription:p(477,null)})),find:U(new fD),fixedOverflowWidgets:U(new Te(51,"fixedOverflowWidgets",!1)),folding:U(new Te(52,"folding",!0,{description:p(488,null)})),foldingStrategy:U(new Rt(53,"foldingStrategy","auto",["auto","indentation"],{enumDescriptions:[p(493,null),p(494,null)],description:p(492,null)})),foldingHighlight:U(new Te(54,"foldingHighlight",!0,{description:p(489,null)})),foldingImportsByDefault:U(new Te(55,"foldingImportsByDefault",!1,{description:p(490,null)})),foldingMaximumRegions:U(new dt(56,"foldingMaximumRegions",5e3,10,65e3,{description:p(491,null)})),unfoldOnClickAfterEndOfLine:U(new Te(57,"unfoldOnClickAfterEndOfLine",!1,{description:p(698,null)})),fontFamily:U(new co(58,"fontFamily",yi.fontFamily,{description:p(495,null)})),fontInfo:U(new bD),fontLigatures2:U(new hD),fontSize:U(new SD),fontWeight:U(new CD),fontVariations:U(new vD),formatOnPaste:U(new Te(64,"formatOnPaste",!1,{description:p(505,null)})),formatOnType:U(new Te(65,"formatOnType",!1,{description:p(506,null)})),glyphMargin:U(new Te(66,"glyphMargin",!0,{description:p(507,null)})),gotoLocation:U(new TD),hideCursorInOverviewRuler:U(new Te(68,"hideCursorInOverviewRuler",!1,{description:p(508,null)})),hover:U(new ED),inDiffEditor:U(new Te(70,"inDiffEditor",!1)),inertialScroll:U(new Te(158,"inertialScroll",!1,{description:p(518,null)})),letterSpacing:U(new hr(72,"letterSpacing",yi.letterSpacing,r=>hr.clamp(r,-5,20),{description:p(544,null)})),lightbulb:U(new PD),lineDecorationsWidth:U(new RD),lineHeight:U(new AD),lineNumbers:U(new HD),lineNumbersMinChars:U(new dt(77,"lineNumbersMinChars",5,1,300)),linkedEditing:U(new Te(78,"linkedEditing",!1,{description:p(551,null)})),links:U(new Te(79,"links",!0,{description:p(552,null)})),matchBrackets:U(new Rt(80,"matchBrackets","always",["always","near","never"],{description:p(553,null)})),minimap:U(new MD),mouseStyle:U(new Rt(82,"mouseStyle","text",["text","default","copy"])),mouseWheelScrollSensitivity:U(new hr(83,"mouseWheelScrollSensitivity",1,r=>r===0?1:r,{markdownDescription:p(574,null)})),mouseWheelZoom:U(new Te(84,"mouseWheelZoom",!1,{markdownDescription:pt?p(576,null):p(575,null)})),multiCursorMergeOverlapping:U(new Te(85,"multiCursorMergeOverlapping",!0,{description:p(578,null)})),multiCursorModifier:U(new uc(86,"multiCursorModifier","altKey","alt",["ctrlCmd","alt"],f9,{markdownEnumDescriptions:[p(581,null),p(580,null)],markdownDescription:p(579,null)})),mouseMiddleClickAction:U(new Rt(87,"mouseMiddleClickAction","default",["default","openLink","ctrlLeftClick"],{description:p(573,null)})),multiCursorPaste:U(new Rt(88,"multiCursorPaste","spread",["spread","full"],{markdownEnumDescriptions:[p(584,null),p(583,null)],markdownDescription:p(582,null)})),multiCursorLimit:U(new dt(89,"multiCursorLimit",1e4,1,1e5,{markdownDescription:p(577,null)})),occurrencesHighlight:U(new Rt(90,"occurrencesHighlight","singleFile",["off","singleFile","multiFile"],{markdownEnumDescriptions:[p(587,null),p(588,null),p(586,null)],markdownDescription:p(585,null)})),occurrencesHighlightDelay:U(new dt(91,"occurrencesHighlightDelay",0,0,2e3,{description:p(589,null),tags:["preview"]})),overtypeOnPaste:U(new Te(93,"overtypeOnPaste",!0,{description:p(594,null)})),overviewRulerBorder:U(new Te(94,"overviewRulerBorder",!0,{description:p(595,null)})),overviewRulerLanes:U(new dt(95,"overviewRulerLanes",3,0,3)),padding:U(new LD),pasteAs:U(new ZD),parameterHints:U(new OD),peekWidgetDefaultFocus:U(new Rt(99,"peekWidgetDefaultFocus","tree",["tree","editor"],{enumDescriptions:[p(606,null),p(605,null)],description:p(604,null)})),placeholder:U(new UD),definitionLinkOpensInPeek:U(new Te(101,"definitionLinkOpensInPeek",!1,{description:p(360,null)})),quickSuggestions:U(new FD),quickSuggestionsDelay:U(new dt(103,"quickSuggestionsDelay",10,0,1073741824,{description:p(615,null),experiment:{mode:"auto"}})),readOnly:U(new Te(104,"readOnly",!1)),readOnlyMessage:U(new VD),renameOnType:U(new Te(106,"renameOnType",!1,{description:p(616,null),markdownDeprecationMessage:p(617,null)})),renderControlCharacters:U(new Te(108,"renderControlCharacters",!0,{description:p(618,null),restricted:!0})),renderFinalNewline:U(new Rt(109,"renderFinalNewline",Qe?"dimmed":"on",["off","on","dimmed"],{description:p(619,null)})),renderLineHighlight:U(new Rt(110,"renderLineHighlight","line",["none","gutter","line","all"],{enumDescriptions:["","","",p(621,null)],description:p(620,null)})),renderLineHighlightOnlyWhenFocus:U(new Te(111,"renderLineHighlightOnlyWhenFocus",!1,{description:p(622,null)})),renderValidationDecorations:U(new Rt(112,"renderValidationDecorations","editable",["editable","on","off"])),renderWhitespace:U(new Rt(113,"renderWhitespace","selection",["none","boundary","selection","trailing","all"],{enumDescriptions:["",p(625,null),p(626,null),p(627,null),""],description:p(624,null)})),revealHorizontalRightPadding:U(new dt(114,"revealHorizontalRightPadding",15,0,1e3)),roundedSelection:U(new Te(115,"roundedSelection",!0,{description:p(628,null)})),rulers:U(new WD),scrollbar:U(new BD),scrollBeyondLastColumn:U(new dt(118,"scrollBeyondLastColumn",4,0,1073741824,{description:p(645,null)})),scrollBeyondLastLine:U(new Te(119,"scrollBeyondLastLine",!0,{description:p(646,null)})),scrollOnMiddleClick:U(new Te(171,"scrollOnMiddleClick",!1,{description:p(647,null)})),scrollPredominantAxis:U(new Te(120,"scrollPredominantAxis",!0,{description:p(648,null)})),selectionClipboard:U(new Te(121,"selectionClipboard",!0,{description:p(649,null),included:Qe})),selectionHighlight:U(new Te(122,"selectionHighlight",!0,{description:p(650,null)})),selectionHighlightMaxLength:U(new dt(123,"selectionHighlightMaxLength",200,0,1073741824,{description:p(651,null)})),selectionHighlightMultiline:U(new Te(124,"selectionHighlightMultiline",!1,{description:p(652,null)})),selectOnLineNumbers:U(new Te(125,"selectOnLineNumbers",!0)),showFoldingControls:U(new Rt(126,"showFoldingControls","mouseover",["always","never","mouseover"],{enumDescriptions:[p(657,null),p(659,null),p(658,null)],description:p(656,null)})),showUnused:U(new Te(127,"showUnused",!0,{description:p(660,null)})),showDeprecated:U(new Te(157,"showDeprecated",!0,{description:p(655,null)})),inlayHints:U(new DD),snippetSuggestions:U(new Rt(128,"snippetSuggestions","inline",["top","bottom","inline","none"],{enumDescriptions:[p(666,null),p(663,null),p(664,null),p(665,null)],description:p(662,null)})),smartSelect:U(new GD),smoothScrolling:U(new Te(130,"smoothScrolling",!1,{description:p(661,null)})),stopRenderingLineAfter:U(new dt(133,"stopRenderingLineAfter",1e4,-1,1073741824)),suggest:U(new jD),inlineSuggest:U(new zD),inlineCompletionsAccessibilityVerbose:U(new Te(169,"inlineCompletionsAccessibilityVerbose",!1,{description:p(525,null)})),suggestFontSize:U(new dt(135,"suggestFontSize",0,0,1e3,{markdownDescription:p(685,null,"`0`","`#editor.fontSize#`")})),suggestLineHeight:U(new dt(136,"suggestLineHeight",0,0,1e3,{markdownDescription:p(686,null,"`0`","`#editor.lineHeight#`")})),suggestOnTriggerCharacters:U(new Te(137,"suggestOnTriggerCharacters",!0,{description:p(687,null)})),suggestSelection:U(new Rt(138,"suggestSelection","first",["first","recentlyUsed","recentlyUsedByPrefix"],{markdownEnumDescriptions:[p(689,null),p(690,null),p(691,null)],description:p(688,null)})),tabCompletion:U(new Rt(139,"tabCompletion","off",["on","off","onlySnippets"],{enumDescriptions:[p(694,null),p(693,null),p(695,null)],description:p(692,null)})),tabIndex:U(new dt(140,"tabIndex",0,-1,1073741824)),trimWhitespaceOnDelete:U(new Te(141,"trimWhitespaceOnDelete",!1,{description:p(697,null)})),unicodeHighlight:U(new $D),unusualLineTerminators:U(new Rt(143,"unusualLineTerminators","prompt",["auto","off","prompt"],{enumDescriptions:[p(707,null),p(708,null),p(709,null)],description:p(706,null)})),useShadowDOM:U(new Te(144,"useShadowDOM",!0)),useTabStops:U(new Te(145,"useTabStops",!0,{description:p(710,null)})),wordBreak:U(new Rt(146,"wordBreak","normal",["normal","keepAll"],{markdownEnumDescriptions:[p(713,null),p(712,null)],description:p(711,null)})),wordSegmenterLocales:U(new QD),wordSeparators:U(new co(148,"wordSeparators",iD,{description:p(715,null)})),wordWrap:U(new Rt(149,"wordWrap","off",["off","on","wordWrapColumn","bounded"],{markdownEnumDescriptions:[p(718,null),p(719,null),p(720,null),p(717,null)],description:p(716,null)})),wordWrapBreakAfterCharacters:U(new co(150,"wordWrapBreakAfterCharacters"," 	})]?|/&.,;\xA2\xB0\u2032\u2033\u2030\u2103\u3001\u3002\uFF61\uFF64\uFFE0\uFF0C\uFF0E\uFF1A\uFF1B\uFF1F\uFF01\uFF05\u30FB\uFF65\u309D\u309E\u30FD\u30FE\u30FC\u30A1\u30A3\u30A5\u30A7\u30A9\u30C3\u30E3\u30E5\u30E7\u30EE\u30F5\u30F6\u3041\u3043\u3045\u3047\u3049\u3063\u3083\u3085\u3087\u308E\u3095\u3096\u31F0\u31F1\u31F2\u31F3\u31F4\u31F5\u31F6\u31F7\u31F8\u31F9\u31FA\u31FB\u31FC\u31FD\u31FE\u31FF\u3005\u303B\uFF67\uFF68\uFF69\uFF6A\uFF6B\uFF6C\uFF6D\uFF6E\uFF6F\uFF70\u201D\u3009\u300B\u300D\u300F\u3011\u3015\uFF09\uFF3D\uFF5D\uFF63")),wordWrapBreakBeforeCharacters:U(new co(151,"wordWrapBreakBeforeCharacters","([{\u2018\u201C\u3008\u300A\u300C\u300E\u3010\u3014\uFF08\uFF3B\uFF5B\uFF62\xA3\xA5\uFF04\uFFE1\uFFE5+\uFF0B")),wordWrapColumn:U(new dt(152,"wordWrapColumn",80,1,1073741824,{markdownDescription:p(721,null)})),wordWrapOverride1:U(new Rt(153,"wordWrapOverride1","inherit",["off","on","inherit"])),wordWrapOverride2:U(new Rt(154,"wordWrapOverride2","inherit",["off","on","inherit"])),wrapOnEscapedLineFeeds:U(new Te(160,"wrapOnEscapedLineFeeds",!1,{markdownDescription:p(722,null)})),effectiveCursorStyle:U(new yD),editorClassName:U(new mD),defaultColorDecorators:U(new Rt(167,"defaultColorDecorators","auto",["auto","always","never"],{enumDescriptions:[p(389,null),p(388,null),p(390,null)],description:p(359,null)})),pixelRatio:U(new ND),tabFocusMode:U(new Te(164,"tabFocusMode",!1,{markdownDescription:p(696,null)})),layoutInfo:U(new wD),wrappingInfo:U(new YD),wrappingIndent:U(new JD),wrappingStrategy:U(new kD),effectiveEditContextEnabled:U(new ID),effectiveAllowVariableFonts:U(new xD)};var vr,tR=globalThis.vscode;if(typeof tR<"u"&&typeof tR.context<"u"){let r=tR.context.configuration();if(r)vr=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){if(vr=globalThis._VSCODE_PRODUCT_JSON,Do.VSCODE_DEV&&Object.assign(vr,{nameShort:`${vr.nameShort} Dev`,nameLong:`${vr.nameLong} Dev`,dataFolderName:`${vr.dataFolderName}-dev`,serverDataFolderName:vr.serverDataFolderName?`${vr.serverDataFolderName}-dev`:void 0}),!vr.version){let r=globalThis._VSCODE_PACKAGE_JSON;Object.assign(vr,{version:r.version})}}else vr={quality:"stable",extensionsGallery:{serviceUrl:"https://open-vsx.org/vscode/gallery",itemUrl:"https://open-vsx.org/vscode/item"},linkProtectionTrustedDomains:["https://open-vsx.org"],documentationUrl:"https://code.visualstudio.com/docs",requestFeatureUrl:"https://github.com/Microsoft/vscode/issues",introductoryVideosUrl:"https://go.microsoft.com/fwlink/?linkid=832146",tipsAndTricksUrl:"https://go.microsoft.com/fwlink/?linkid=852118",keyboardShortcutsUrlLinux:"https://go.microsoft.com/fwlink/?linkid=832144",commit:"e7fb5e96c0730b9deb70b33781f98e2f35975036",date:"2026-04-01T09:27:11Z",nameShort:"Code - OSS",nameLong:"Code - OSS",applicationName:"code-oss",dataFolderName:".vscode-oss",win32MutexName:"vscodeoss",licenseName:"MIT",licenseUrl:"https://github.com/microsoft/vscode/blob/main/LICENSE.txt",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:"Microsoft Code OSS",win32NameVersion:"Microsoft Code OSS",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:"Microsoft.CodeOSS",win32ShellNameShort:"C&ode - OSS",win32TunnelServiceMutex:"vscodeoss-tunnelservice",win32TunnelMutex:"vscodeoss-tunnel",darwinBundleIdentifier:"com.visualstudio.code.oss",darwinProfileUUID:"47827DD9-4734-49A0-AF80-7E19B11495CC",darwinProfilePayloadUUID:"CF808BE7-53F3-46C6-A7E2-7EDB98A5E959",linuxIconName:"code-oss",licenseFileName:"LICENSE.txt",reportIssueUrl:"https://github.com/microsoft/vscode/issues/new",nodejsRepository:"https://nodejs.org",urlProtocol:"code-oss",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.112.0",sha256:"c24322931434940938f8cf76ebc3dac1e95a5539b9625b165b6672d7f7eafea8",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.10",sha256:"7361748ddf9fd09d8a2ed1f2a2d7376a2cf9aae708692820b799708385c38e08",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",publicCodeMatchesUrl:"https://aka.ms/github-copilot-match-public-code",manageSettingsUrl:"https://aka.ms/github-copilot-settings",managePlanUrl:"https://aka.ms/github-copilot-manage-plan",manageOverageUrl:"https://aka.ms/github-copilot-manage-overage",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.com"},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",completionsRefreshTokenCommand:"github.copilot.signIn",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"},trustedExtensionAuthAccess:{github:["GitHub.copilot-chat"],"github-enterprise":["GitHub.copilot-chat"]},version:"1.114.0"},Object.keys(vr).length===0&&Object.assign(vr,{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 Yo=vr;var Vh=class r{constructor(t){this._proxyIdentifierBrand=void 0;this.sid=t,this.nid=++r.count}static{this.count=0}},$F=[];function W(r){let t=new Vh(r);return $F[t.nid]=t,t}function Bh(r){return $F[r].sid}var Gt=class{constructor(t){this.value=t}};var nR=(o=>(o[o.None=0]="None",o[o.Process=1]="Process",o[o.Output=2]="Output",o[o.Hybrid=3]="Hybrid",o))(nR||{}),zF=class r{static{this._n=0}static mixin(t){return t._id=r._n++,t}};var F={MainThreadAuthentication:W("MainThreadAuthentication"),MainThreadBulkEdits:W("MainThreadBulkEdits"),MainThreadLanguageModels:W("MainThreadLanguageModels"),MainThreadEmbeddings:W("MainThreadEmbeddings"),MainThreadChatAgents2:W("MainThreadChatAgents2"),MainThreadCodeMapper:W("MainThreadCodeMapper"),MainThreadLanguageModelTools:W("MainThreadChatSkills"),MainThreadGitExtension:W("MainThreadGitExtension"),MainThreadClipboard:W("MainThreadClipboard"),MainThreadCommands:W("MainThreadCommands"),MainThreadComments:W("MainThreadComments"),MainThreadConfiguration:W("MainThreadConfiguration"),MainThreadConsole:W("MainThreadConsole"),MainThreadDebugService:W("MainThreadDebugService"),MainThreadDecorations:W("MainThreadDecorations"),MainThreadDiagnostics:W("MainThreadDiagnostics"),MainThreadDialogs:W("MainThreadDiaglogs"),MainThreadDocuments:W("MainThreadDocuments"),MainThreadDocumentContentProviders:W("MainThreadDocumentContentProviders"),MainThreadTextEditors:W("MainThreadTextEditors"),MainThreadEditorInsets:W("MainThreadEditorInsets"),MainThreadEditorTabs:W("MainThreadEditorTabs"),MainThreadErrors:W("MainThreadErrors"),MainThreadTreeViews:W("MainThreadTreeViews"),MainThreadDownloadService:W("MainThreadDownloadService"),MainThreadLanguageFeatures:W("MainThreadLanguageFeatures"),MainThreadLanguages:W("MainThreadLanguages"),MainThreadLogger:W("MainThreadLogger"),MainThreadMessageService:W("MainThreadMessageService"),MainThreadOutputService:W("MainThreadOutputService"),MainThreadProgress:W("MainThreadProgress"),MainThreadQuickDiff:W("MainThreadQuickDiff"),MainThreadQuickOpen:W("MainThreadQuickOpen"),MainThreadStatusBar:W("MainThreadStatusBar"),MainThreadSecretState:W("MainThreadSecretState"),MainThreadStorage:W("MainThreadStorage"),MainThreadSpeech:W("MainThreadSpeechProvider"),MainThreadTelemetry:W("MainThreadTelemetry"),MainThreadMeteredConnection:W("MainThreadMeteredConnection"),MainThreadTerminalService:W("MainThreadTerminalService"),MainThreadTerminalShellIntegration:W("MainThreadTerminalShellIntegration"),MainThreadWebviews:W("MainThreadWebviews"),MainThreadWebviewPanels:W("MainThreadWebviewPanels"),MainThreadWebviewViews:W("MainThreadWebviewViews"),MainThreadCustomEditors:W("MainThreadCustomEditors"),MainThreadUrls:W("MainThreadUrls"),MainThreadUriOpeners:W("MainThreadUriOpeners"),MainThreadProfileContentHandlers:W("MainThreadProfileContentHandlers"),MainThreadWorkspace:W("MainThreadWorkspace"),MainThreadFileSystem:W("MainThreadFileSystem"),MainThreadFileSystemEventService:W("MainThreadFileSystemEventService"),MainThreadExtensionService:W("MainThreadExtensionService"),MainThreadSCM:W("MainThreadSCM"),MainThreadSearch:W("MainThreadSearch"),MainThreadShare:W("MainThreadShare"),MainThreadTask:W("MainThreadTask"),MainThreadWindow:W("MainThreadWindow"),MainThreadPower:W("MainThreadPower"),MainThreadLabelService:W("MainThreadLabelService"),MainThreadNotebook:W("MainThreadNotebook"),MainThreadNotebookDocuments:W("MainThreadNotebookDocumentsShape"),MainThreadNotebookEditors:W("MainThreadNotebookEditorsShape"),MainThreadNotebookKernels:W("MainThreadNotebookKernels"),MainThreadNotebookRenderers:W("MainThreadNotebookRenderers"),MainThreadInteractive:W("MainThreadInteractive"),MainThreadTheming:W("MainThreadTheming"),MainThreadTunnelService:W("MainThreadTunnelService"),MainThreadManagedSockets:W("MainThreadManagedSockets"),MainThreadTimeline:W("MainThreadTimeline"),MainThreadTesting:W("MainThreadTesting"),MainThreadLocalization:W("MainThreadLocalizationShape"),MainThreadMcp:W("MainThreadMcpShape"),MainThreadAiRelatedInformation:W("MainThreadAiRelatedInformation"),MainThreadAiEmbeddingVector:W("MainThreadAiEmbeddingVector"),MainThreadChatStatus:W("MainThreadChatStatus"),MainThreadAiSettingsSearch:W("MainThreadAiSettingsSearch"),MainThreadDataChannels:W("MainThreadDataChannels"),MainThreadChatSessions:W("MainThreadChatSessions"),MainThreadChatOutputRenderer:W("MainThreadChatOutputRenderer"),MainThreadChatContext:W("MainThreadChatContext"),MainThreadChatDebug:W("MainThreadChatDebug"),MainThreadBrowsers:W("MainThreadBrowsers")},pe={ExtHostCodeMapper:W("ExtHostCodeMapper"),ExtHostCommands:W("ExtHostCommands"),ExtHostConfiguration:W("ExtHostConfiguration"),ExtHostDiagnostics:W("ExtHostDiagnostics"),ExtHostDebugService:W("ExtHostDebugService"),ExtHostDecorations:W("ExtHostDecorations"),ExtHostDocumentsAndEditors:W("ExtHostDocumentsAndEditors"),ExtHostDocuments:W("ExtHostDocuments"),ExtHostDocumentContentProviders:W("ExtHostDocumentContentProviders"),ExtHostDocumentSaveParticipant:W("ExtHostDocumentSaveParticipant"),ExtHostEditors:W("ExtHostEditors"),ExtHostTreeViews:W("ExtHostTreeViews"),ExtHostFileSystem:W("ExtHostFileSystem"),ExtHostFileSystemInfo:W("ExtHostFileSystemInfo"),ExtHostFileSystemEventService:W("ExtHostFileSystemEventService"),ExtHostLanguages:W("ExtHostLanguages"),ExtHostLanguageFeatures:W("ExtHostLanguageFeatures"),ExtHostQuickOpen:W("ExtHostQuickOpen"),ExtHostQuickDiff:W("ExtHostQuickDiff"),ExtHostStatusBar:W("ExtHostStatusBar"),ExtHostShare:W("ExtHostShare"),ExtHostExtensionService:W("ExtHostExtensionService"),ExtHostLogLevelServiceShape:W("ExtHostLogLevelServiceShape"),ExtHostTerminalService:W("ExtHostTerminalService"),ExtHostTerminalShellIntegration:W("ExtHostTerminalShellIntegration"),ExtHostSCM:W("ExtHostSCM"),ExtHostSearch:W("ExtHostSearch"),ExtHostTask:W("ExtHostTask"),ExtHostWorkspace:W("ExtHostWorkspace"),ExtHostWindow:W("ExtHostWindow"),ExtHostPower:W("ExtHostPower"),ExtHostWebviews:W("ExtHostWebviews"),ExtHostWebviewPanels:W("ExtHostWebviewPanels"),ExtHostCustomEditors:W("ExtHostCustomEditors"),ExtHostWebviewViews:W("ExtHostWebviewViews"),ExtHostEditorInsets:W("ExtHostEditorInsets"),ExtHostEditorTabs:W("ExtHostEditorTabs"),ExtHostProgress:W("ExtHostProgress"),ExtHostComments:W("ExtHostComments"),ExtHostSecretState:W("ExtHostSecretState"),ExtHostStorage:W("ExtHostStorage"),ExtHostUrls:W("ExtHostUrls"),ExtHostUriOpeners:W("ExtHostUriOpeners"),ExtHostChatOutputRenderer:W("ExtHostChatOutputRenderer"),ExtHostProfileContentHandlers:W("ExtHostProfileContentHandlers"),ExtHostOutputService:W("ExtHostOutputService"),ExtHostLabelService:W("ExtHostLabelService"),ExtHostNotebook:W("ExtHostNotebook"),ExtHostNotebookDocuments:W("ExtHostNotebookDocuments"),ExtHostNotebookEditors:W("ExtHostNotebookEditors"),ExtHostNotebookKernels:W("ExtHostNotebookKernels"),ExtHostNotebookRenderers:W("ExtHostNotebookRenderers"),ExtHostNotebookDocumentSaveParticipant:W("ExtHostNotebookDocumentSaveParticipant"),ExtHostInteractive:W("ExtHostInteractive"),ExtHostChatAgents2:W("ExtHostChatAgents"),ExtHostLanguageModelTools:W("ExtHostChatSkills"),ExtHostChatProvider:W("ExtHostChatProvider"),ExtHostChatContext:W("ExtHostChatContext"),ExtHostChatDebug:W("ExtHostChatDebug"),ExtHostSpeech:W("ExtHostSpeech"),ExtHostEmbeddings:W("ExtHostEmbeddings"),ExtHostAiRelatedInformation:W("ExtHostAiRelatedInformation"),ExtHostAiEmbeddingVector:W("ExtHostAiEmbeddingVector"),ExtHostAiSettingsSearch:W("ExtHostAiSettingsSearch"),ExtHostTheming:W("ExtHostTheming"),ExtHostTunnelService:W("ExtHostTunnelService"),ExtHostManagedSockets:W("ExtHostManagedSockets"),ExtHostAuthentication:W("ExtHostAuthentication"),ExtHostTimeline:W("ExtHostTimeline"),ExtHostTesting:W("ExtHostTesting"),ExtHostTelemetry:W("ExtHostTelemetry"),ExtHostMeteredConnection:W("ExtHostMeteredConnection"),ExtHostLocalization:W("ExtHostLocalization"),ExtHostMcp:W("ExtHostMcp"),ExtHostDataChannels:W("ExtHostDataChannels"),ExtHostChatSessions:W("ExtHostChatSessions"),ExtHostGitExtension:W("ExtHostGitExtension"),ExtHostBrowsers:W("ExtHostBrowsers")};function qF(r){return r.toJSON()}var $I=class{constructor(t){this._uriTransformer=t}transformIncoming(t){let e=this._uriTransformer.transformIncoming(t);return e===t?t:qF(b.from(e))}transformOutgoing(t){let e=this._uriTransformer.transformOutgoing(t);return e===t?t:qF(b.from(e))}transformOutgoingURI(t){let e=this._uriTransformer.transformOutgoing(t);return e===t?t:b.from(e)}transformOutgoingScheme(t){return this._uriTransformer.transformOutgoingScheme(t)}},Wte=new class{transformIncoming(r){return r}transformOutgoing(r){return r}transformOutgoingURI(r){return r}transformOutgoingScheme(r){return r}};function KF(r,t,e,n){if(!r||n>200)return null;if(typeof r=="object"){if(r.$mid===1)return e?b.revive(t.transformIncoming(r)):t.transformIncoming(r);if(r instanceof H)return null;for(let o in r)if(Object.hasOwnProperty.call(r,o)){let i=KF(r[o],t,e,n+1);i!==null&&(r[o]=i)}}return null}function xp(r,t){let e=KF(r,t,!1,0);return e===null?r:e}var $h=class{constructor(){this._actual=null,this._actualOk=null,this._actualErr=null,this._hasValue=!1,this._value=null,this._hasErr=!1,this._err=null}get[Symbol.toStringTag](){return this.toString()}_ensureActual(){return this._actual||(this._actual=new Promise((t,e)=>{this._actualOk=t,this._actualErr=e,this._hasValue&&this._actualOk(this._value),this._hasErr&&this._actualErr(this._err)})),this._actual}resolveOk(t){this._hasValue||this._hasErr||(this._hasValue=!0,this._value=t,this._actual&&this._actualOk(t))}resolveErr(t){this._hasValue||this._hasErr||(this._hasErr=!0,this._err=t,this._actual?this._actualErr(t):ze(t))}then(t,e){return this._ensureActual().then(t,e)}catch(t){return this._ensureActual().then(void 0,t)}finally(t){return this._ensureActual().finally(t)}},zI=class extends $h{constructor(){super(),this._hasErr=!0,this._err=new Be}};function oR(r,t){try{return JSON.stringify(r,t)}catch{return"null"}}var iR="$$ref$$",v9={[iR]:-1};function jF(r,t=null,e=!1){let n=[];return{jsonString:(e?oR:JSON.stringify)(r,(i,s)=>{if(typeof s>"u")return v9;if(typeof s=="object"){if(s instanceof H){let a=n.push(s)-1;return{[iR]:a}}if(t)return t(i,s)}return s}),referencedBuffers:n}}function YF(r,t,e){return JSON.parse(r,(n,o)=>{if(o){let i=o[iR];if(typeof i=="number")return t[i];if(e&&o.$mid===1)return e.transformIncoming(o)}return o})}function GF(r,t){return JSON.stringify(r,t)}function b9(r){return r?(t,e)=>e&&e.$mid===1?r.transformOutgoing(e):e:null}var y9=()=>{},I9=Symbol.for("rpcProtocol"),x9=Symbol.for("rpcProxy"),QF,JF,qI=class r extends(JF=O,QF=I9,JF){constructor(e,n=null,o=null){super();this[QF]=!0;this._onDidChangeResponsiveState=this._register(new E);this.onDidChangeResponsiveState=this._onDidChangeResponsiveState.event;this._protocol=e,this._logger=n,this._uriTransformer=o,this._uriReplacer=b9(this._uriTransformer),this._isDisposed=!1,this._locals=[],this._proxies=[];for(let i=0,s=Vh.count;i<s;i++)this._locals[i]=null,this._proxies[i]=null;this._lastMessageId=0,this._cancelInvokedHandlers=Object.create(null),this._pendingRPCReplies={},this._responsiveState=0,this._unacknowledgedCount=0,this._unresponsiveTime=0,this._asyncCheckUresponsive=this._register(new jn(()=>this._checkUnresponsive(),1e3)),this._register(this._protocol.onMessage(i=>this._receiveOneMessage(i)))}static{this.UNRESPONSIVE_TIME=3*1e3}dispose(){this._isDisposed=!0,Object.keys(this._pendingRPCReplies).forEach(e=>{let n=this._pendingRPCReplies[e];delete this._pendingRPCReplies[e],n.resolveErr(Ys())}),super.dispose()}drain(){return typeof this._protocol.drain=="function"?this._protocol.drain():Promise.resolve()}_onWillSendRequest(e){this._unacknowledgedCount===0&&(this._unresponsiveTime=Date.now()+r.UNRESPONSIVE_TIME),this._unacknowledgedCount++,this._asyncCheckUresponsive.isScheduled()||this._asyncCheckUresponsive.schedule()}_onDidReceiveAcknowledge(e){this._unresponsiveTime=Date.now()+r.UNRESPONSIVE_TIME,this._unacknowledgedCount--,this._unacknowledgedCount===0&&this._asyncCheckUresponsive.cancel(),this._setResponsiveState(0)}_checkUnresponsive(){this._unacknowledgedCount!==0&&(Date.now()>this._unresponsiveTime?this._setResponsiveState(1):this._asyncCheckUresponsive.schedule())}_setResponsiveState(e){this._responsiveState!==e&&(this._responsiveState=e,this._onDidChangeResponsiveState.fire(this._responsiveState))}get responsiveState(){return this._responsiveState}transformIncomingURIs(e){return this._uriTransformer?xp(e,this._uriTransformer):e}getProxy(e){let{nid:n,sid:o}=e;return this._proxies[n]||(this._proxies[n]=this._createProxy(n,o)),this._proxies[n]}_createProxy(e,n){let o={get:(i,s)=>(typeof s=="string"&&!i[s]&&s.charCodeAt(0)===36&&(i[s]=(...a)=>this._remoteCall(e,s,a)),s===x9?n:i[s])};return new Proxy(Object.create(null),o)}set(e,n){return this._locals[e.nid]=n,n}assertRegistered(e){for(let n=0,o=e.length;n<o;n++){let i=e[n];if(!this._locals[i.nid])throw new Error(`Missing proxy instance ${i.sid}`)}}_receiveOneMessage(e){if(this._isDisposed)return;let n=e.byteLength,o=vn.read(e,0),i=o.readUInt8(),s=o.readUInt32();switch(i){case 1:case 2:{let{rpcId:a,method:l,args:d}=br.deserializeRequestJSONArgs(o);this._uriTransformer&&(d=xp(d,this._uriTransformer)),this._receiveRequest(n,s,a,l,d,i===2);break}case 3:case 4:{let{rpcId:a,method:l,args:d}=br.deserializeRequestMixedArgs(o);this._uriTransformer&&(d=xp(d,this._uriTransformer)),this._receiveRequest(n,s,a,l,d,i===4);break}case 5:{this._logger?.logIncoming(n,s,0,"ack"),this._onDidReceiveAcknowledge(s);break}case 6:{this._receiveCancel(n,s);break}case 7:{this._receiveReply(n,s,void 0);break}case 9:{let a=br.deserializeReplyOKJSON(o);this._uriTransformer&&(a=xp(a,this._uriTransformer)),this._receiveReply(n,s,a);break}case 10:{let a=br.deserializeReplyOKJSONWithBuffers(o,this._uriTransformer);this._receiveReply(n,s,a);break}case 8:{let a=br.deserializeReplyOKVSBuffer(o);this._receiveReply(n,s,a);break}case 11:{let a=br.deserializeReplyErrError(o);this._uriTransformer&&(a=xp(a,this._uriTransformer)),this._receiveReplyErr(n,s,a);break}case 12:{this._receiveReplyErr(n,s,void 0);break}default:console.error("received unexpected message"),console.error(e)}}_receiveRequest(e,n,o,i,s,a){this._logger?.logIncoming(e,n,1,`receiveRequest ${Bh(o)}.${i}(`,s);let l=String(n),d,c;if(a){let m=new Ce;s.push(m.token),d=this._invokeHandler(o,i,s),c=()=>m.cancel()}else d=this._invokeHandler(o,i,s),c=y9;this._cancelInvokedHandlers[l]=c;let u=br.serializeAcknowledged(n);this._logger?.logOutgoing(u.byteLength,n,1,"ack"),this._protocol.send(u),d.then(m=>{delete this._cancelInvokedHandlers[l];let g=br.serializeReplyOK(n,m,this._uriReplacer);this._logger?.logOutgoing(g.byteLength,n,1,"reply:",m),this._protocol.send(g)},m=>{delete this._cancelInvokedHandlers[l];let g=br.serializeReplyErr(n,m);this._logger?.logOutgoing(g.byteLength,n,1,"replyErr:",m),this._protocol.send(g)})}_receiveCancel(e,n){this._logger?.logIncoming(e,n,1,"receiveCancel");let o=String(n);this._cancelInvokedHandlers[o]?.()}_receiveReply(e,n,o){this._logger?.logIncoming(e,n,0,"receiveReply:",o);let i=String(n);if(!this._pendingRPCReplies.hasOwnProperty(i))return;let s=this._pendingRPCReplies[i];delete this._pendingRPCReplies[i],s.resolveOk(o)}_receiveReplyErr(e,n,o){this._logger?.logIncoming(e,n,0,"receiveReplyErr:",o);let i=String(n);if(!this._pendingRPCReplies.hasOwnProperty(i))return;let s=this._pendingRPCReplies[i];delete this._pendingRPCReplies[i];let a;o&&(o.$isError?(a=new Error,a.name=o.name,a.message=o.message,a.stack=o.stack):a=o),s.resolveErr(a)}_invokeHandler(e,n,o){try{return Promise.resolve(this._doInvokeHandler(e,n,o))}catch(i){return Promise.reject(i)}}_doInvokeHandler(e,n,o){let i=this._locals[e];if(!i)throw new Error("Unknown actor "+Bh(e));let s=i[n];if(typeof s!="function")throw new Error("Unknown method "+n+" on actor "+Bh(e));return s.apply(i,o)}_remoteCall(e,n,o){if(this._isDisposed)return new zI;let i=null;if(o.length>0&&ve.isCancellationToken(o[o.length-1])&&(i=o.pop()),i&&i.isCancellationRequested)return Promise.reject(Ys());let s=br.serializeRequestArguments(o,this._uriReplacer),a=++this._lastMessageId,l=String(a),d=new $h,c=new $;i&&c.add(i.onCancellationRequested(()=>{let m=br.serializeCancel(a);this._logger?.logOutgoing(m.byteLength,a,0,"cancel"),this._protocol.send(m)})),this._pendingRPCReplies[l]=new rR(d,c),this._onWillSendRequest(a);let u=br.serializeRequest(a,e,n,s,!!i);return this._logger?.logOutgoing(u.byteLength,a,0,`request: ${Bh(e)}.${n}(`,o),this._protocol.send(u),d}},rR=class{constructor(t,e){this._promise=t;this._disposable=e}resolveOk(t){this._promise.resolveOk(t),this._disposable.dispose()}resolveErr(t){this._promise.resolveErr(t),this._disposable.dispose()}},vn=class r{static alloc(t,e,n){let o=new r(H.alloc(n+1+4),0);return o.writeUInt8(t),o.writeUInt32(e),o}static read(t,e){return new r(t,e)}get buffer(){return this._buff}constructor(t,e){this._buff=t,this._offset=e}static sizeUInt8(){return 1}static{this.sizeUInt32=4}writeUInt8(t){this._buff.writeUInt8(t,this._offset),this._offset+=1}readUInt8(){let t=this._buff.readUInt8(this._offset);return this._offset+=1,t}writeUInt32(t){this._buff.writeUInt32BE(t,this._offset),this._offset+=4}readUInt32(){let t=this._buff.readUInt32BE(this._offset);return this._offset+=4,t}static sizeShortString(t){return 1+t.byteLength}writeShortString(t){this._buff.writeUInt8(t.byteLength,this._offset),this._offset+=1,this._buff.set(t,this._offset),this._offset+=t.byteLength}readShortString(){let t=this._buff.readUInt8(this._offset);this._offset+=1;let n=this._buff.slice(this._offset,this._offset+t).toString();return this._offset+=t,n}static sizeLongString(t){return 4+t.byteLength}writeLongString(t){this._buff.writeUInt32BE(t.byteLength,this._offset),this._offset+=4,this._buff.set(t,this._offset),this._offset+=t.byteLength}readLongString(){let t=this._buff.readUInt32BE(this._offset);this._offset+=4;let n=this._buff.slice(this._offset,this._offset+t).toString();return this._offset+=t,n}writeBuffer(t){this._buff.writeUInt32BE(t.byteLength,this._offset),this._offset+=4,this._buff.set(t,this._offset),this._offset+=t.byteLength}static sizeVSBuffer(t){return 4+t.byteLength}writeVSBuffer(t){this._buff.writeUInt32BE(t.byteLength,this._offset),this._offset+=4,this._buff.set(t,this._offset),this._offset+=t.byteLength}readVSBuffer(){let t=this._buff.readUInt32BE(this._offset);this._offset+=4;let e=this._buff.slice(this._offset,this._offset+t);return this._offset+=t,e}static sizeMixedArray(t){let e=0;e+=1;for(let n=0,o=t.length;n<o;n++){let i=t[n];switch(e+=1,i.type){case 1:e+=this.sizeLongString(i.value);break;case 2:e+=this.sizeVSBuffer(i.value);break;case 3:e+=this.sizeUInt32,e+=this.sizeLongString(i.value);for(let s=0;s<i.buffers.length;++s)e+=this.sizeVSBuffer(i.buffers[s]);break;case 4:break}}return e}writeMixedArray(t){this._buff.writeUInt8(t.length,this._offset),this._offset+=1;for(let e=0,n=t.length;e<n;e++){let o=t[e];switch(o.type){case 1:this.writeUInt8(1),this.writeLongString(o.value);break;case 2:this.writeUInt8(2),this.writeVSBuffer(o.value);break;case 3:this.writeUInt8(3),this.writeUInt32(o.buffers.length),this.writeLongString(o.value);for(let i=0;i<o.buffers.length;++i)this.writeBuffer(o.buffers[i]);break;case 4:this.writeUInt8(4);break}}}readMixedArray(){let t=this._buff.readUInt8(this._offset);this._offset+=1;let e=new Array(t);for(let n=0;n<t;n++)switch(this.readUInt8()){case 1:e[n]=this.readLongString();break;case 2:e[n]=this.readVSBuffer();break;case 3:{let i=this.readUInt32(),s=this.readLongString(),a=[];for(let l=0;l<i;++l)a.push(this.readVSBuffer());e[n]=new Gt(YF(s,a,null));break}case 4:e[n]=void 0;break}return e}};var br=class{static _useMixedArgSerialization(t){for(let e=0,n=t.length;e<n;e++)if(t[e]instanceof H||t[e]instanceof Gt||typeof t[e]>"u")return!0;return!1}static serializeRequestArguments(t,e){if(this._useMixedArgSerialization(t)){let n=[];for(let o=0,i=t.length;o<i;o++){let s=t[o];if(s instanceof H)n[o]={type:2,value:s};else if(typeof s>"u")n[o]={type:4};else if(s instanceof Gt){let{jsonString:a,referencedBuffers:l}=jF(s.value,e);n[o]={type:3,value:H.fromString(a),buffers:l}}else n[o]={type:1,value:H.fromString(GF(s,e))}}return{type:1,args:n}}return{type:0,args:GF(t,e)}}static serializeRequest(t,e,n,o,i){switch(o.type){case 0:return this._requestJSONArgs(t,e,n,o.args,i);case 1:return this._requestMixedArgs(t,e,n,o.args,i)}}static _requestJSONArgs(t,e,n,o,i){let s=H.fromString(n),a=H.fromString(o),l=0;l+=vn.sizeUInt8(),l+=vn.sizeShortString(s),l+=vn.sizeLongString(a);let d=vn.alloc(i?2:1,t,l);return d.writeUInt8(e),d.writeShortString(s),d.writeLongString(a),d.buffer}static deserializeRequestJSONArgs(t){let e=t.readUInt8(),n=t.readShortString(),o=t.readLongString();return{rpcId:e,method:n,args:JSON.parse(o)}}static _requestMixedArgs(t,e,n,o,i){let s=H.fromString(n),a=0;a+=vn.sizeUInt8(),a+=vn.sizeShortString(s),a+=vn.sizeMixedArray(o);let l=vn.alloc(i?4:3,t,a);return l.writeUInt8(e),l.writeShortString(s),l.writeMixedArray(o),l.buffer}static deserializeRequestMixedArgs(t){let e=t.readUInt8(),n=t.readShortString(),o=t.readMixedArray(),i=new Array(o.length);for(let s=0,a=o.length;s<a;s++){let l=o[s];typeof l=="string"?i[s]=JSON.parse(l):i[s]=l}return{rpcId:e,method:n,args:i}}static serializeAcknowledged(t){return vn.alloc(5,t,0).buffer}static serializeCancel(t){return vn.alloc(6,t,0).buffer}static serializeReplyOK(t,e,n){if(typeof e>"u")return this._serializeReplyOKEmpty(t);if(e instanceof H)return this._serializeReplyOKVSBuffer(t,e);if(e instanceof Gt){let{jsonString:o,referencedBuffers:i}=jF(e.value,n,!0);return this._serializeReplyOKJSONWithBuffers(t,o,i)}else return this._serializeReplyOKJSON(t,oR(e,n))}static _serializeReplyOKEmpty(t){return vn.alloc(7,t,0).buffer}static _serializeReplyOKVSBuffer(t,e){let n=0;n+=vn.sizeVSBuffer(e);let o=vn.alloc(8,t,n);return o.writeVSBuffer(e),o.buffer}static deserializeReplyOKVSBuffer(t){return t.readVSBuffer()}static _serializeReplyOKJSON(t,e){let n=H.fromString(e),o=0;o+=vn.sizeLongString(n);let i=vn.alloc(9,t,o);return i.writeLongString(n),i.buffer}static _serializeReplyOKJSONWithBuffers(t,e,n){let o=H.fromString(e),i=0;i+=vn.sizeUInt32,i+=vn.sizeLongString(o);for(let a of n)i+=vn.sizeVSBuffer(a);let s=vn.alloc(10,t,i);s.writeUInt32(n.length),s.writeLongString(o);for(let a of n)s.writeBuffer(a);return s.buffer}static deserializeReplyOKJSON(t){let e=t.readLongString();return JSON.parse(e)}static deserializeReplyOKJSONWithBuffers(t,e){let n=t.readUInt32(),o=t.readLongString(),i=[];for(let s=0;s<n;++s)i.push(t.readVSBuffer());return new Gt(YF(o,i,e))}static serializeReplyErr(t,e){let n=e?oR(Yi(e),null):void 0;if(typeof n!="string")return this._serializeReplyErrEmpty(t);let o=H.fromString(n),i=0;i+=vn.sizeLongString(o);let s=vn.alloc(11,t,i);return s.writeLongString(o),s.buffer}static deserializeReplyErrError(t){let e=t.readLongString();return JSON.parse(e)}static _serializeReplyErrEmpty(t){return vn.alloc(12,t,0).buffer}};function zh(r){if(!r)return;let t=r.indexOf("+");return t<0?r:r.substr(0,t)}var KI=["AI","Azure","Chat","Data Science","Debuggers","Extension Packs","Education","Formatters","Keymaps","Language Packs","Linters","Machine Learning","Notebooks","Programming Languages","SCM Providers","Snippets","Testing","Themes","Visualization","Other"];var Ee=class{constructor(t){this.value=t,this._lower=t.toLowerCase()}static equals(t,e){if(typeof t>"u"||t===null)return typeof e>"u"||e===null;if(typeof e>"u"||e===null)return!1;if(typeof t=="string"||typeof e=="string"){let n=typeof t=="string"?t:t.value,o=typeof e=="string"?e:e.value;return wn(n,o)}return t._lower===e._lower}static toKey(t){return typeof t=="string"?t.toLowerCase():t._lower}},No=class{constructor(t){this._set=new Set;if(t)for(let e of t)this.add(e)}get size(){return this._set.size}add(t){this._set.add(Ee.toKey(t))}delete(t){return this._set.delete(Ee.toKey(t))}has(t){return this._set.has(Ee.toKey(t))}},uo=class{constructor(){this._map=new Map}clear(){this._map.clear()}delete(t){this._map.delete(Ee.toKey(t))}get(t){return this._map.get(Ee.toKey(t))}has(t){return this._map.has(Ee.toKey(t))}set(t,e){this._map.set(Ee.toKey(t),e)}values(){return this._map.values()}forEach(t){this._map.forEach(t)}[Symbol.iterator](){return this._map[Symbol.iterator]()}},Sp=class extends Error{constructor(t,e,n){super(`Error in extension ${Ee.toKey(t)}: ${n??e.message}`,{cause:e}),this.name="ExtensionError",this.extension=t}};var une=R("IBuiltinExtensionsScannerService");function sR(r,t){return t&&(r.stack||r.stacktrace)?p(116,null,ZF(r),XF(r.stack)||XF(r.stacktrace)):ZF(r)}function XF(r){return Array.isArray(r)?r.join(`
`):r}function ZF(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"?p(115,null,r.message):r.message||p(113,null)}function Io(r=null,t=!1){if(!r)return p(113,null);if(Array.isArray(r)){let e=tt(r),n=Io(e[0],t);return e.length>1?p(114,null,n,e.length):n}if(De(r))return r;if(r.detail){let e=r.detail;if(e.error)return sR(e.error,t);if(e.exception)return sR(e.exception,t)}return r.stack?sR(r,t):r.message?r.message:p(113,null)}function Gn(r){return lR(r,0)}function lR(r,t){switch(typeof r){case"object":return r===null?sa(349,t):Array.isArray(r)?C9(r,t):T9(r,t);case"string":return jI(r,t);case"boolean":return S9(r,t);case"number":return sa(r,t);case"undefined":return sa(937,t);default:return sa(617,t)}}function sa(r,t){return(t<<5)-t+r|0}function S9(r,t){return sa(r?433:863,t)}function jI(r,t){t=sa(149417,t);for(let e=0,n=r.length;e<n;e++)t=sa(r.charCodeAt(e),t);return t}function C9(r,t){return t=sa(104579,t),r.reduce((e,n)=>lR(n,e),t)}function T9(r,t){return t=sa(181387,t),Object.keys(r).sort().reduce((e,n)=>(e=jI(n,e),lR(r[n],e)),t)}function aR(r,t,e=32){let n=e-t,o=~((1<<n)-1);return(r<<t|(o&r)>>>n)>>>0}function qh(r,t=32){return r instanceof ArrayBuffer?gl(H.wrap(new Uint8Array(r))):(r>>>0).toString(16).padStart(t/4,"0")}var e2=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(t){let e=t.length;if(e===0)return;let n=this._buff,o=this._buffLen,i=this._leftoverHighSurrogate,s,a;for(i!==0?(s=i,a=-1,i=0):(s=t.charCodeAt(0),a=0);;){let l=s;if(ec(s))if(a+1<e){let d=t.charCodeAt(a+1);gh(d)?(a++,l=gI(s,d)):l=65533}else{i=s;break}else gh(s)&&(l=65533);if(o=this._push(n,o,l),a++,a<e)s=t.charCodeAt(a);else break}this._buffLen=o,this._leftoverHighSurrogate=i}_push(t,e,n){return n<128?t[e++]=n:n<2048?(t[e++]=192|(n&1984)>>>6,t[e++]=128|(n&63)>>>0):n<65536?(t[e++]=224|(n&61440)>>>12,t[e++]=128|(n&4032)>>>6,t[e++]=128|(n&63)>>>0):(t[e++]=240|(n&1835008)>>>18,t[e++]=128|(n&258048)>>>12,t[e++]=128|(n&4032)>>>6,t[e++]=128|(n&63)>>>0),e>=64&&(this._step(),e-=64,this._totalLen+=64,t[0]=t[64],t[1]=t[65],t[2]=t[66]),e}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()),qh(this._h0)+qh(this._h1)+qh(this._h2)+qh(this._h3)+qh(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 t=8*this._totalLen;this._buffDV.setUint32(56,Math.floor(t/4294967296),!1),this._buffDV.setUint32(60,t%4294967296,!1),this._step()}_step(){let t=r._bigBlock32,e=this._buffDV;for(let u=0;u<64;u+=4)t.setUint32(u,e.getUint32(u,!1),!1);for(let u=64;u<320;u+=4)t.setUint32(u,aR(t.getUint32(u-12,!1)^t.getUint32(u-32,!1)^t.getUint32(u-56,!1)^t.getUint32(u-64,!1),1),!1);let n=this._h0,o=this._h1,i=this._h2,s=this._h3,a=this._h4,l,d,c;for(let u=0;u<80;u++)u<20?(l=o&i|~o&s,d=1518500249):u<40?(l=o^i^s,d=1859775393):u<60?(l=o&i|o&s|i&s,d=2400959708):(l=o^i^s,d=3395469782),c=aR(n,5)+l+a+d+t.getUint32(u*4,!1)&4294967295,a=s,s=i,i=aR(o,30),o=n,n=c;this._h0=this._h0+n&4294967295,this._h1=this._h1+o&4294967295,this._h2=this._h2+i&4294967295,this._h3=this._h3+s&4294967295,this._h4=this._h4+a&4294967295}};var oe=R("logService"),Xo=R("loggerService");var aa=(s=>(s[s.Off=0]="Off",s[s.Trace=1]="Trace",s[s.Debug=2]="Debug",s[s.Info=3]="Info",s[s.Warning=4]="Warning",s[s.Error=5]="Error",s))(aa||{}),E9=3;function YI(r,t){return r!==0&&r<=t}function t2(r,t,e){switch(t){case 1:r.trace(e);break;case 2:r.debug(e);break;case 3:r.info(e);break;case 4:r.warn(e);break;case 5:r.error(e);break;case 0:break;default:throw new Error(`Invalid log level ${t}`)}}function Cp(r,t=!1){let e="";for(let n=0;n<r.length;n++){let o=r[n];if(o instanceof Error&&(o=Io(o,t)),typeof o=="object")try{o=JSON.stringify(o)}catch{}e+=(n>0?" ":"")+o}return e}var GI=class extends O{constructor(){super(...arguments);this.level=E9;this._onDidChangeLogLevel=this._register(new E)}get onDidChangeLogLevel(){return this._onDidChangeLogLevel.event}setLevel(e){this.level!==e&&(this.level=e,this._onDidChangeLogLevel.fire(this.level))}getLevel(){return this.level}checkLogLevel(e){return YI(this.level,e)}canLog(e){return this._store.isDisposed?!1:this.checkLogLevel(e)}},Il=class extends GI{constructor(e){super();this.logAlways=e}checkLogLevel(e){return this.logAlways||super.checkLogLevel(e)}trace(e,...n){this.canLog(1)&&this.log(1,Cp([e,...n],!0))}debug(e,...n){this.canLog(2)&&this.log(2,Cp([e,...n]))}info(e,...n){this.canLog(3)&&this.log(3,Cp([e,...n]))}warn(e,...n){this.canLog(4)&&this.log(4,Cp([e,...n]))}error(e,...n){if(this.canLog(5))if(e instanceof Error){let o=Array.prototype.slice.call(arguments);o[0]=e.stack,this.log(5,Cp(o))}else this.log(5,Cp([e,...n]))}flush(){}};var QI=class extends GI{constructor(e){super();this.loggers=e;e.length&&this.setLevel(e[0].getLevel())}setLevel(e){for(let n of this.loggers)n.setLevel(e);super.setLevel(e)}trace(e,...n){for(let o of this.loggers)o.trace(e,...n)}debug(e,...n){for(let o of this.loggers)o.debug(e,...n)}info(e,...n){for(let o of this.loggers)o.info(e,...n)}warn(e,...n){for(let o of this.loggers)o.warn(e,...n)}error(e,...n){for(let o of this.loggers)o.error(e,...n)}flush(){for(let e of this.loggers)e.flush()}dispose(){for(let e of this.loggers)e.dispose();super.dispose()}},JI=class extends O{constructor(e,n,o){super();this.logLevel=e;this.logsHome=n;this._loggers=new Ke;this._onDidChangeLoggers=this._register(new E);this.onDidChangeLoggers=this._onDidChangeLoggers.event;this._onDidChangeLogLevel=this._register(new E);this.onDidChangeLogLevel=this._onDidChangeLogLevel.event;this._onDidChangeVisibility=this._register(new E);this.onDidChangeVisibility=this._onDidChangeVisibility.event;if(o)for(let i of o)this._loggers.set(i.resource,{logger:void 0,info:i})}getLoggerEntry(e){return De(e)?[...this._loggers.values()].find(n=>n.info.id===e):this._loggers.get(e)}getLogger(e){return this.getLoggerEntry(e)?.logger}createLogger(e,n){let o=this.toResource(e),i=De(e)?e:n?.id??Gn(o.toString()).toString(16),s=this._loggers.get(o)?.logger,a=n?.logLevel==="always"?1:n?.logLevel;s||(s=this.doCreateLogger(o,a??this.getLogLevel(o)??this.logLevel,{...n,id:i}));let l={logger:s,info:{resource:o,id:i,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(o,l),s}toResource(e){return De(e)?Et(this.logsHome,`${e.replace(/[\\/:\*\?"<>\|]/g,"")}.log`):e}setLogLevel(e,n){if(b.isUri(e)){let o=e,i=n,s=this._loggers.get(o);s&&i!==s.info.logLevel&&(s.info.logLevel=i===this.logLevel?void 0:i,s.logger?.setLevel(i),this._loggers.set(s.info.resource,s),this._onDidChangeLogLevel.fire([o,i]))}else{this.logLevel=e;for(let[o,i]of this._loggers.entries())this._loggers.get(o)?.info.logLevel===void 0&&i.logger?.setLevel(this.logLevel);this._onDidChangeLogLevel.fire(this.logLevel)}}setVisibility(e,n){let o=this.getLoggerEntry(e);o&&n!==!o.info.hidden&&(o.info.hidden=!n,this._loggers.set(o.info.resource,o),this._onDidChangeVisibility.fire([o.info.resource,n]))}getLogLevel(e){let n;return e&&(n=this._loggers.get(e)?.info.logLevel),n??this.logLevel}registerLogger(e){let n=this._loggers.get(e.resource);n?n.info.hidden!==e.hidden&&this.setVisibility(e.resource,!e.hidden):(this._loggers.set(e.resource,{info:e,logger:void 0}),this._onDidChangeLoggers.fire({added:[e],removed:[]}))}deregisterLogger(e){let n=this.toResource(e),o=this._loggers.get(n);o&&(o.logger&&o.logger.dispose(),this._loggers.delete(n),this._onDidChangeLoggers.fire({added:[],removed:[o.info]}))}*getRegisteredLoggers(){for(let e of this._loggers.values())yield e.info}getRegisteredLogger(e){return this._loggers.get(e)?.info}dispose(){this._loggers.forEach(e=>e.logger?.dispose()),this._loggers.clear(),super.dispose()}};function w9(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"}}var Dne=new w("logLevel",w9(3));var Zo=class{constructor(t,e=[],n=!1){this.ctor=t,this.staticArguments=e,this.supportsDelayedInstantiation=n}};var n2=[];function qe(r,t,e){t instanceof Zo||(t=new Zo(t,[],!!e)),n2.push([r,t])}function o2(){return n2}var xl=class{constructor(...t){this._entries=new Map;for(let[e,n]of t)this.set(e,n)}set(t,e){let n=this._entries.get(t);return this._entries.set(t,e),n}has(t){return this._entries.has(t)}get(t){return this._entries.get(t)}};var Ye=R("IExtHostInitDataService");var dR=class{constructor(t,e){this.key=t;this.data=e;this.incoming=new Map;this.outgoing=new Map}},Kh=class{constructor(t){this._hashFn=t;this._nodes=new Map}roots(){let t=[];for(let e of this._nodes.values())e.outgoing.size===0&&t.push(e);return t}insertEdge(t,e){let n=this.lookupOrInsertNode(t),o=this.lookupOrInsertNode(e);n.outgoing.set(o.key,o),o.incoming.set(n.key,n)}removeNode(t){let e=this._hashFn(t);this._nodes.delete(e);for(let n of this._nodes.values())n.outgoing.delete(e),n.incoming.delete(e)}lookupOrInsertNode(t){let e=this._hashFn(t),n=this._nodes.get(e);return n||(n=new dR(e,t),this._nodes.set(e,n)),n}lookup(t){return this._nodes.get(this._hashFn(t))}isEmpty(){return this._nodes.size===0}toString(){let t=[];for(let[e,n]of this._nodes)t.push(`${e}
	(-> incoming)[${[...n.incoming.keys()].join(", ")}]
	(outgoing ->)[${[...n.outgoing.keys()].join(",")}]
`);return t.join(`
`)}findCycleSlow(){for(let[t,e]of this._nodes){let n=new Set([t]),o=this._findCycle(e,n);if(o)return o}}_findCycle(t,e){for(let[n,o]of t.outgoing){if(e.has(n))return[...e,n].join(" -> ");e.add(n);let i=this._findCycle(o,e);if(i)return i;e.delete(n)}}};var k9=!1,XI=class extends Error{constructor(t){super("cyclic dependency between services"),this.message=t.findCycleSlow()??`UNABLE to detect cycle, dumping graph: 
${t.toString()}`}},ZI=class r{constructor(t=new xl,e=!1,n,o=k9){this._services=t;this._strict=e;this._parent=n;this._enableTracing=o;this._isDisposed=!1;this._servicesToMaybeDispose=new Set;this._children=new Set;this._activeInstantiations=new Set;this._services.set(Jo,this),this._globalGraph=o?n?._globalGraph??new Kh(i=>i):void 0}dispose(){if(!this._isDisposed){this._isDisposed=!0,Cn(this._children),this._children.clear();for(let t of this._servicesToMaybeDispose)qy(t)&&t.dispose();this._servicesToMaybeDispose.clear()}}_throwIfDisposed(){if(this._isDisposed)throw new Error("InstantiationService has been disposed")}createChild(t,e){this._throwIfDisposed();let n=this,o=new class extends r{dispose(){n._children.delete(o),super.dispose()}}(t,this._strict,this,this._enableTracing);return this._children.add(o),e?.add(o),o}invokeFunction(t,...e){this._throwIfDisposed();let n=jh.traceInvocation(this._enableTracing,t),o=!1;try{return t({get:s=>{if(o)throw Qu("service accessor is only valid during the invocation of its target method");let a=this._getOrCreateServiceInstance(s,n);return a||this._throwIfStrict(`[invokeFunction] unknown service '${s}'`,!1),a}},...e)}finally{o=!0,n.stop()}}createInstance(t,...e){this._throwIfDisposed();let n,o;return t instanceof Zo?(n=jh.traceCreation(this._enableTracing,t.ctor),o=this._createInstance(t.ctor,t.staticArguments.concat(e),n)):(n=jh.traceCreation(this._enableTracing,t),o=this._createInstance(t,e,n)),n.stop(),o}_createInstance(t,e=[],n){let o=Ii.getServiceDependencies(t).sort((a,l)=>a.index-l.index),i=[];for(let a of o){let l=this._getOrCreateServiceInstance(a.id,n);l||this._throwIfStrict(`[createInstance] ${t.name} depends on UNKNOWN service ${a.id}.`,!1),i.push(l)}let s=o.length>0?o[0].index:e.length;if(e.length!==s){console.trace(`[createInstance] First service dependency of ${t.name} at position ${s+1} conflicts with ${e.length} static arguments`);let a=s-e.length;a>0?e=e.concat(new Array(a)):e=e.slice(0,s)}return Reflect.construct(t,e.concat(i))}_setCreatedServiceInstance(t,e){if(this._services.get(t)instanceof Zo)this._services.set(t,e);else if(this._parent)this._parent._setCreatedServiceInstance(t,e);else throw new Error("illegalState - setting UNKNOWN service instance")}_getServiceInstanceOrDescriptor(t){let e=this._services.get(t);return!e&&this._parent?this._parent._getServiceInstanceOrDescriptor(t):e}_getOrCreateServiceInstance(t,e){this._globalGraph&&this._globalGraphImplicitDependency&&this._globalGraph.insertEdge(this._globalGraphImplicitDependency,String(t));let n=this._getServiceInstanceOrDescriptor(t);return n instanceof Zo?this._safeCreateAndCacheServiceInstance(t,n,e.branch(t,!0)):(e.branch(t,!1),n)}_safeCreateAndCacheServiceInstance(t,e,n){if(this._activeInstantiations.has(t))throw new Error(`illegal state - RECURSIVELY instantiating service '${t}'`);this._activeInstantiations.add(t);try{return this._createAndCacheServiceInstance(t,e,n)}finally{this._activeInstantiations.delete(t)}}_createAndCacheServiceInstance(t,e,n){let o=new Kh(l=>l.id.toString()),i=0,s=[{id:t,desc:e,_trace:n}],a=new Set;for(;s.length;){let l=s.pop();if(!a.has(String(l.id))){if(a.add(String(l.id)),o.lookupOrInsertNode(l),i++>1e3)throw new XI(o);for(let d of Ii.getServiceDependencies(l.desc.ctor)){let c=this._getServiceInstanceOrDescriptor(d.id);if(c||this._throwIfStrict(`[createInstance] ${t} depends on ${d.id} which is NOT registered.`,!0),this._globalGraph?.insertEdge(String(l.id),String(d.id)),c instanceof Zo){let u={id:d.id,desc:c,_trace:l._trace.branch(d.id,!0)};o.insertEdge(l,u),s.push(u)}}}}for(;;){let l=o.roots();if(l.length===0){if(!o.isEmpty())throw new XI(o);break}for(let{data:d}of l){if(this._getServiceInstanceOrDescriptor(d.id)instanceof Zo){let u=this._createServiceInstanceWithOwner(d.id,d.desc.ctor,d.desc.staticArguments,d.desc.supportsDelayedInstantiation,d._trace);this._setCreatedServiceInstance(d.id,u)}o.removeNode(d)}}return this._getServiceInstanceOrDescriptor(t)}_createServiceInstanceWithOwner(t,e,n=[],o,i){if(this._services.get(t)instanceof Zo)return this._createServiceInstance(t,e,n,o,i,this._servicesToMaybeDispose);if(this._parent)return this._parent._createServiceInstanceWithOwner(t,e,n,o,i);throw new Error(`illegalState - creating UNKNOWN service instance ${e.name}`)}_createServiceInstance(t,e,n=[],o,i,s){if(o){let a=new r(void 0,this._strict,this,this._enableTracing);a._globalGraphImplicitDependency=String(t);let l=new Map,d=new EI(()=>{let c=a._createInstance(e,n,i);for(let[u,m]of l){let g=c[u];if(typeof g=="function")for(let h of m)h.disposable=g.apply(c,h.listener)}return l.clear(),s.add(c),c});return new Proxy(Object.create(null),{get(c,u){if(!d.isInitialized&&typeof u=="string"&&(u.startsWith("onDid")||u.startsWith("onWill"))){let h=l.get(u);return h||(h=new ao,l.set(u,h)),(I,S,T)=>{if(d.isInitialized)return d.value[u](I,S,T);{let P={listener:[I,S,T],disposable:void 0},L=h.push(P);return K(()=>{L(),P.disposable?.dispose()})}}}if(u in c)return c[u];let m=d.value,g=m[u];return typeof g!="function"||(g=g.bind(m),c[u]=g),g},set(c,u,m){return d.value[u]=m,!0},getPrototypeOf(c){return e.prototype}})}else{let a=this._createInstance(e,n,i);return s.add(a),a}}_throwIfStrict(t,e){if(e&&console.warn(t),this._strict)throw new Error(t)}};var jh=class r{constructor(t,e){this.type=t;this.name=e;this._start=Date.now();this._dep=[]}static{this.all=new Set}static{this._None=new class extends r{constructor(){super(0,null)}stop(){}branch(){return this}}}static traceInvocation(t,e){return t?new r(2,e.name||new Error().stack.split(`
`).slice(3,4).join(`
`)):r._None}static traceCreation(t,e){return t?new r(1,e.name):r._None}static{this._totals=0}branch(t,e){let n=new r(3,t.toString());return this._dep.push([t,e,n]),n}stop(){let t=Date.now()-this._start;r._totals+=t;let e=!1;function n(i,s){let a=[],l=new Array(i+1).join("	");for(let[d,c,u]of s._dep)if(c&&u){e=!0,a.push(`${l}CREATES -> ${d}`);let m=n(i+1,u);m&&a.push(m)}else a.push(`${l}uses -> ${d}`);return a.join(`
`)}let o=[`${this.type===1?"CREATE":"CALL"} ${this.name}`,`${n(1,this)}`,`DONE, took ${t.toFixed(2)}ms (grand total ${r._totals.toFixed(2)}ms)`];(t>2||e)&&r.all.add(o.join(`
`))}};var se=R("IExtHostRpcService"),ex=class{constructor(t){this.getProxy=t.getProxy.bind(t),this.set=t.set.bind(t),this.dispose=t.dispose.bind(t),this.assertRegistered=t.assertRegistered.bind(t),this.drain=t.drain.bind(t)}};var ds=R("IURITransformerService"),tx=class{constructor(t){t?(this.transformIncoming=t.transformIncoming.bind(t),this.transformOutgoing=t.transformOutgoing.bind(t),this.transformOutgoingURI=t.transformOutgoingURI.bind(t),this.transformOutgoingScheme=t.transformOutgoingScheme.bind(t)):(this.transformIncoming=e=>e,this.transformOutgoing=e=>e,this.transformOutgoingURI=e=>e,this.transformOutgoingScheme=e=>e)}};var cR=class{constructor(){this._value="";this._pos=0}reset(t){return this._value=t,this._pos=0,this}next(){return this._pos+=1,this}hasNext(){return this._pos<this._value.length-1}cmp(t){let e=t.charCodeAt(0),n=this._value.charCodeAt(this._pos);return e-n}value(){return this._value[this._pos]}},uR=class{constructor(t=!0){this._caseSensitive=t}reset(t){return this._value=t,this._from=0,this._to=0,this.next()}hasNext(){return this._to<this._value.length}next(){this._from=this._to;let t=!0;for(;this._to<this._value.length;this._to++)if(this._value.charCodeAt(this._to)===46)if(t)this._from++;else break;else t=!1;return this}cmp(t){return this._caseSensitive?mI(t,this._value,0,t.length,this._from,this._to):Zd(t,this._value,0,t.length,this._from,this._to)}value(){return this._value.substring(this._from,this._to)}},nx=class{constructor(t=!0,e=!0){this._splitOnBackslash=t;this._caseSensitive=e}reset(t){this._from=0,this._to=0,this._value=t,this._valueLen=t.length;for(let e=t.length-1;e>=0;e--,this._valueLen--){let n=this._value.charCodeAt(e);if(!(n===47||this._splitOnBackslash&&n===92))break}return this.next()}hasNext(){return this._to<this._valueLen}next(){this._from=this._to;let t=!0;for(;this._to<this._valueLen;this._to++){let e=this._value.charCodeAt(this._to);if(e===47||this._splitOnBackslash&&e===92)if(t)this._from++;else break;else t=!1}return this}cmp(t){return this._caseSensitive?mI(t,this._value,0,t.length,this._from,this._to):Zd(t,this._value,0,t.length,this._from,this._to)}value(){return this._value.substring(this._from,this._to)}};var Gh=class{constructor(t,e){this._ignorePathCasing=t;this._ignoreQueryAndFragment=e;this._states=[];this._stateIdx=0}reset(t){return this._value=t,this._states=[],this._value.scheme&&this._states.push(1),this._value.authority&&this._states.push(2),this._value.path&&(this._pathIterator=new nx(!1,!this._ignorePathCasing(t)),this._pathIterator.reset(t.path),this._pathIterator.value()&&this._states.push(3)),this._ignoreQueryAndFragment(t)||(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(t){if(this._states[this._stateIdx]===1)return mh(t,this._value.scheme);if(this._states[this._stateIdx]===2)return mh(t,this._value.authority);if(this._states[this._stateIdx]===3)return this._pathIterator.cmp(t);if(this._states[this._stateIdx]===4)return fi(t,this._value.query);if(this._states[this._stateIdx]===5)return fi(t,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}},la=class r{static{this.Val=Symbol("undefined_placeholder")}static wrap(t){return t===void 0?r.Val:t}static unwrap(t){return t===r.Val?void 0:t}},Tp=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 t=this.right;return this.right=t.left,t.left=this,this.updateHeight(),t.updateHeight(),t}rotateRight(){let t=this.left;return this.left=t.right,t.right=this,this.updateHeight(),t.updateHeight(),t}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 er=class r{static forUris(t=()=>!1,e=()=>!1){return new r(new Gh(t,e))}static forPaths(t=!1){return new r(new nx(void 0,!t))}static forStrings(){return new r(new cR)}static forConfigKeys(){return new r(new uR)}constructor(t){this._iter=t}clear(){this._root=void 0}fill(t,e){if(e){let n=e.slice(0);AP(n);for(let o of n)this.set(o,t)}else{let n=t.slice(0);AP(n);for(let o of n)this.set(o[0],o[1])}}set(t,e){let n=this._iter.reset(t),o;this._root||(this._root=new Tp,this._root.segment=n.value());let i=[];for(o=this._root;;){let a=n.cmp(o.segment);if(a>0)o.left||(o.left=new Tp,o.left.segment=n.value()),i.push([-1,o]),o=o.left;else if(a<0)o.right||(o.right=new Tp,o.right.segment=n.value()),i.push([1,o]),o=o.right;else if(n.hasNext())n.next(),o.mid||(o.mid=new Tp,o.mid.segment=n.value()),i.push([0,o]),o=o.mid;else break}let s=la.unwrap(o.value);o.value=la.wrap(e),o.key=t;for(let a=i.length-1;a>=0;a--){let l=i[a][1];l.updateHeight();let d=l.balanceFactor();if(d<-1||d>1){let c=i[a][0],u=i[a+1][0];if(c===1&&u===1)i[a][1]=l.rotateLeft();else if(c===-1&&u===-1)i[a][1]=l.rotateRight();else if(c===1&&u===-1)l.right=i[a+1][1]=i[a+1][1].rotateRight(),i[a][1]=l.rotateLeft();else if(c===-1&&u===1)l.left=i[a+1][1]=i[a+1][1].rotateLeft(),i[a][1]=l.rotateRight();else throw new Error;if(a>0)switch(i[a-1][0]){case-1:i[a-1][1].left=i[a][1];break;case 1:i[a-1][1].right=i[a][1];break;case 0:i[a-1][1].mid=i[a][1];break}else this._root=i[0][1]}}return s}get(t){return la.unwrap(this._getNode(t)?.value)}_getNode(t){let e=this._iter.reset(t),n=this._root;for(;n;){let o=e.cmp(n.segment);if(o>0)n=n.left;else if(o<0)n=n.right;else if(e.hasNext())e.next(),n=n.mid;else break}return n}has(t){let e=this._getNode(t);return!(e?.value===void 0&&e?.mid===void 0)}delete(t){return this._delete(t,!1)}deleteSuperstr(t){return this._delete(t,!0)}_delete(t,e){let n=this._iter.reset(t),o=[],i=this._root;for(;i;){let s=n.cmp(i.segment);if(s>0)o.push([-1,i]),i=i.left;else if(s<0)o.push([1,i]),i=i.right;else if(n.hasNext())n.next(),o.push([0,i]),i=i.mid;else break}if(i){if(e?(i.left=void 0,i.mid=void 0,i.right=void 0,i.height=1):(i.key=void 0,i.value=void 0),!i.mid&&!i.value)if(i.left&&i.right){let s=[[1,i]],a=this._min(i.right,s);if(a.key){i.key=a.key,i.value=a.value,i.segment=a.segment;let l=a.right;if(s.length>1){let[c,u]=s[s.length-1];switch(c){case-1:u.left=l;break;case 0:Xu(!1);case 1:Xu(!1)}}else i.right=l;let d=this._balanceByStack(s);if(o.length>0){let[c,u]=o[o.length-1];switch(c){case-1:u.left=d;break;case 0:u.mid=d;break;case 1:u.right=d;break}}else this._root=d}}else{let s=i.left??i.right;if(o.length>0){let[a,l]=o[o.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(o)??this._root}}_min(t,e){for(;t.left;)e.push([-1,t]),t=t.left;return t}_balanceByStack(t){for(let e=t.length-1;e>=0;e--){let n=t[e][1];n.updateHeight();let o=n.balanceFactor();if(o>1?(n.right.balanceFactor()>=0||(n.right=n.right.rotateRight()),t[e][1]=n.rotateLeft()):o<-1&&(n.left.balanceFactor()<=0||(n.left=n.left.rotateLeft()),t[e][1]=n.rotateRight()),e>0)switch(t[e-1][0]){case-1:t[e-1][1].left=t[e][1];break;case 1:t[e-1][1].right=t[e][1];break;case 0:t[e-1][1].mid=t[e][1];break}else return t[0][1]}}findSubstr(t){let e=this._iter.reset(t),n=this._root,o;for(;n;){let i=e.cmp(n.segment);if(i>0)n=n.left;else if(i<0)n=n.right;else if(e.hasNext())e.next(),o=la.unwrap(n.value)||o,n=n.mid;else break}return n&&la.unwrap(n.value)||o}findSuperstr(t){return this._findSuperstrOrElement(t,!1)}_findSuperstrOrElement(t,e){let n=this._iter.reset(t),o=this._root;for(;o;){let i=n.cmp(o.segment);if(i>0)o=o.left;else if(i<0)o=o.right;else if(n.hasNext())n.next(),o=o.mid;else return o.mid?this._entries(o.mid):e?la.unwrap(o.value):void 0}}hasElementOrSubtree(t){return this._findSuperstrOrElement(t,!0)!==void 0}forEach(t){for(let[e,n]of this)t(n,e)}*[Symbol.iterator](){yield*this._entries(this._root)}_entries(t){let e=[];return this._dfsEntries(t,e),e[Symbol.iterator]()}_dfsEntries(t,e){t&&(t.left&&this._dfsEntries(t.left,e),t.value!==void 0&&e.push([t.key,la.unwrap(t.value)]),t.mid&&this._dfsEntries(t.mid,e),t.right&&this._dfsEntries(t.right,e))}_isBalanced(){let t=e=>{if(!e)return!0;let n=e.balanceFactor();return n<-1||n>1?!1:t(e.left)&&t(e.right)};return t(this._root)}};function r2(r,t,e){return Math.min(Math.max(r,t),e)}var ox=class{constructor(){this._next=0}getNext(){return this._next++}},rx=class{constructor(){this._n=1;this._val=0}update(t){return this._val=this._val+(t-this._val)/this._n,this._n+=1,this._val}get value(){return this._val}};var da=R("fileService");function mc(r){return r.create===!0}var gc=(o=>(o[o.Unknown=0]="Unknown",o[o.File=1]="File",o[o.Directory=2]="Directory",o[o.SymbolicLink=64]="SymbolicLink",o))(gc||{}),fc=(n=>(n[n.Readonly=1]="Readonly",n[n.Locked=2]="Locked",n[n.Executable=4]="Executable",n))(fc||{});var Sl=class r extends Error{constructor(e,n){super(e);this.code=n}static create(e,n){let o=new r(e.toString(),n);return pR(o,n),o}};function Si(r,t){return Sl.create(r,t)}function s2(r){return r||Si(p(2130,null),"Unknown")}function pR(r,t){return r.name=t?`${t} (FileSystemError)`:"FileSystemError",r}function Ep(r){if(!r)return"Unknown";if(r instanceof Sl)return r.code;let t=/^(.+) \(FileSystemError\)$/.exec(r.name);if(!t)return"Unknown";switch(t[1]){case"EntryExists":return"EntryExists";case"EntryIsADirectory":return"EntryIsADirectory";case"EntryNotADirectory":return"EntryNotADirectory";case"EntryNotFound":return"EntryNotFound";case"EntryTooLarge":return"EntryTooLarge";case"EntryWriteLocked":return"EntryWriteLocked";case"NoPermissions":return"NoPermissions";case"Unavailable":return"Unavailable"}return"Unknown"}function a2(r){if(r instanceof Cl)return r.fileOperationResult;switch(Ep(r)){case"EntryNotFound":return 1;case"EntryIsADirectory":return 0;case"EntryNotADirectory":return 9;case"EntryWriteLocked":return 5;case"NoPermissions":return 6;case"EntryExists":return 4;case"EntryTooLarge":return 7;default:return 10}}var i2=class r{constructor(t,e){this.ignorePathCasing=e;this.correlationId=void 0;this.added=new mt(()=>{let t=er.forUris(()=>this.ignorePathCasing);return t.fill(this.rawAdded.map(e=>[e,!0])),t});this.updated=new mt(()=>{let t=er.forUris(()=>this.ignorePathCasing);return t.fill(this.rawUpdated.map(e=>[e,!0])),t});this.deleted=new mt(()=>{let t=er.forUris(()=>this.ignorePathCasing);return t.fill(this.rawDeleted.map(e=>[e,!0])),t});this.rawAdded=[];this.rawUpdated=[];this.rawDeleted=[];for(let n of t){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(t,...e){return this.doContains(t,{includeChildren:!1},...e)}affects(t,...e){return this.doContains(t,{includeChildren:!0},...e)}doContains(t,e,...n){if(!t)return!1;let o=n.length>0;return!!((!o||n.includes(1))&&(this.added.value.get(t)||e.includeChildren&&this.added.value.findSuperstr(t))||(!o||n.includes(0))&&(this.updated.value.get(t)||e.includeChildren&&this.updated.value.findSuperstr(t))||(!o||n.includes(2))&&(this.deleted.value.findSubstr(t)||e.includeChildren&&this.deleted.value.findSuperstr(t)))}gotAdded(){return this.rawAdded.length>0}gotDeleted(){return this.rawDeleted.length>0}gotUpdated(){return this.rawUpdated.length>0}correlates(t){return this.correlationId===t}hasCorrelation(){return typeof this.correlationId=="number"}};function l2(r,t,e){return!r||!t||r===t||t.length>r.length?!1:(t.charAt(t.length-1)!==xt&&(t+=xt),e?na(r,t):r.indexOf(t)===0)}var Cl=class extends Error{constructor(e,n,o){super(e);this.fileOperationResult=n;this.options=o}};var d2="";function mR(r){if(!(typeof r.size!="number"||typeof r.mtime!="number"))return r.mtime.toString(29)+r.size.toString(31)}var pc=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(t){return Un(t)||(t=0),t<r.KB?p(2125,null,t.toFixed(0)):t<r.MB?p(2127,null,(t/r.KB).toFixed(2)):t<r.GB?p(2128,null,(t/r.MB).toFixed(2)):t<r.TB?p(2126,null,(t/r.GB).toFixed(2)):p(2129,null,(t/r.TB).toFixed(2))}};var sx=(o=>(o[o.Ignore=0]="Ignore",o[o.Info=1]="Info",o[o.Warning=2]="Warning",o[o.Error=3]="Error",o))(sx||{});(a=>{let r="error",t="warning",e="warn",n="info",o="ignore";function i(l){return l?wn(r,l)?3:wn(t,l)||wn(e,l)?2:wn(n,l)?1:0:0}a.fromValue=i;function s(l){switch(l){case 3:return r;case 2:return t;case 1:return n;default:return o}}a.toString=s})(sx||={});var Xe=sx;var c2=Xe,Poe=R("notificationService");var cs=R("contextService");function u2(r){let t=r;return typeof t?.id=="string"&&b.isUri(t.uri)}function p2(r){let t=r;return typeof t?.id=="string"&&b.isUri(t.configPath)}var ax=class{constructor(t,e,n,o,i){this._id=t;this._transient=n;this._configuration=o;this.ignorePathCasing=i;this.foldersMap=er.forUris(this.ignorePathCasing,()=>!0),this.folders=e}get folders(){return this._folders}set folders(t){this._folders=t,this.updateFoldersMap()}update(t){this._id=t.id,this._configuration=t.configuration,this._transient=t.transient,this.ignorePathCasing=t.ignorePathCasing,this.folders=t.folders}get id(){return this._id}get transient(){return this._transient}get configuration(){return this._configuration}set configuration(t){this._configuration=t}getFolder(t){return t&&this.foldersMap.findSubstr(t)||null}updateFoldersMap(){this.foldersMap=er.forUris(this.ignorePathCasing,()=>!0);for(let t of this.folders)this.foldersMap.set(t.uri,t)}toJSON(){return{id:this.id,folders:this.folders,transient:this.transient,configuration:this.configuration}}},hc=class{constructor(t,e){this.raw=e;this.uri=t.uri,this.index=t.index,this.name=t.name}toResource(t){return Et(this.uri,t)}toJSON(){return{uri:this.uri,name:this.name,index:this.index}}};function Qh(r){return new hc({uri:r,index:0,name:vh(r)},{uri:r.toString()})}var m2="code-workspace",P9=`.${m2}`,Foe=[{name:p(2801,null),extensions:[m2]}];function g2(r){return(typeof r=="string"?al(r):xI(r))===P9}var lx=class{constructor(){this._systemSchemes=new Set(Object.keys(V));this._providerInfo=new Map;this.extUri=new ss(t=>{let e=this._providerInfo.get(t.scheme);return!(e===void 0||e&1024)})}$acceptProviderInfos(t,e){e===null?this._providerInfo.delete(t.scheme):this._providerInfo.set(t.scheme,e)}isFreeScheme(t){return!this._providerInfo.has(t)&&!this._systemSchemes.has(t)}getCapabilities(t){return this._providerInfo.get(t)}},Gr=R("IExtHostFileSystemInfo");var dx=Object.freeze({create:r=>Br(r.map(t=>t.toString())).join(`\r
`),split:r=>r.split(`\r
`),parse:r=>dx.split(r).filter(t=>!t.startsWith("#"))});var Joe=new Uint32Array(10);var Yoe=new Uint8Array([114,82,115,101,69,102,97,113,81,116,84,100,119,87,99,122,120,118,103]),Xoe=new Uint16Array([107,111,105,79,106,112,117,80,104,27496,28520,27752,121,110,27246,28782,27758,98,109,27757,108]),Zoe=new Uint16Array([114,82,29810,115,30579,26483,101,102,29286,24934,29030,29798,30822,30310,26470,97,113,29809,116,84,100,119,99,122,120,118,103]),ere=new Uint16Array([114,82,29810,115,30579,26483,101,69,102,29286,24934,29030,29798,30822,30310,26470,97,113,81,29809,116,84,100,119,87,99,122,120,118,103,107,111,105,79,106,112,117,80,104,27496,28520,27752,121,110,27246,28782,27758,98,109,27757,108]);function h2(...r){return function(t,e){for(let n=0,o=r.length;n<o;n++){let i=r[n](t,e);if(i)return i}return null}}var dre=v2.bind(void 0,!1),ux=v2.bind(void 0,!0);function v2(r,t,e){if(!e||e.length<t.length)return null;let n;return r?n=na(e,t):n=e.indexOf(t)===0,n?t.length>0?[{start:0,end:t.length}]:[]:null}function _9(r,t){if(r.length>t.length)return null;let e=t.toLowerCase().indexOf(r.toLowerCase());return e===-1?null:[{start:e,end:e+r.length}]}function D9(r,t){return r.length>t.length?null:gR(r.toLowerCase(),t.toLowerCase(),0,0)}function gR(r,t,e,n){if(e===r.length)return[];if(n===t.length)return null;if(r[e]===t[n]){let o=null;return(o=gR(r,t,e+1,n+1))?y2({start:n,end:n+1},o):null}return gR(r,t,e,n+1)}function hR(r){return 97<=r&&r<=122}function wp(r){return 65<=r&&r<=90}function vR(r){return 48<=r&&r<=57}function R9(r){return r===32||r===9||r===10||r===13}var A9=new Set;"()[]{}<>`'\"-/;:,.?!".split("").forEach(r=>A9.add(r.charCodeAt(0)));function b2(r){return hR(r)||wp(r)||vR(r)}function y2(r,t){return t.length===0?t=[r]:r.end===t[0].start?t[0].start=r.start:t.unshift(r),t}function I2(r,t){for(let e=t;e<r.length;e++){let n=r.charCodeAt(e);if(wp(n)||vR(n)||e>0&&!b2(r.charCodeAt(e-1)))return e}return r.length}function fR(r,t,e,n){if(e===r.length)return[];if(n===t.length)return null;if(r[e]!==t[n].toLowerCase())return null;{let o=null,i=n+1;for(o=fR(r,t,e+1,n+1);!o&&(i=I2(t,i))<t.length;)o=fR(r,t,e+1,i),i++;return o===null?null:y2({start:n,end:n+1},o)}}function M9(r){let t=0,e=0,n=0,o=0,i=0;for(let c=0;c<r.length;c++)i=r.charCodeAt(c),wp(i)&&t++,hR(i)&&e++,b2(i)&&n++,vR(i)&&o++;let s=t/r.length,a=e/r.length,l=n/r.length,d=o/r.length;return{upperPercent:s,lowerPercent:a,alphaPercent:l,numericPercent:d}}function L9(r){let{upperPercent:t,lowerPercent:e}=r;return e===0&&t>.6}function O9(r){let{upperPercent:t,lowerPercent:e,alphaPercent:n,numericPercent:o}=r;return e>.2&&t<.8&&n>.6&&o<.2}function N9(r){let t=0,e=0,n=0,o=0;for(let i=0;i<r.length;i++)n=r.charCodeAt(i),wp(n)&&t++,hR(n)&&e++,R9(n)&&o++;return(t===0||e===0)&&o===0?r.length<=30:t<=5}function x2(r,t){if(!t||(t=t.trim(),t.length===0)||!N9(r))return null;t.length>60&&(t=t.substring(0,60));let e=M9(t);if(!O9(e)){if(!L9(e))return null;t=t.toLowerCase()}let n=null,o=0;for(r=r.toLowerCase();o<t.length&&(n=fR(r,t,0,o))===null;)o=I2(t,o+1);return n}var cre=h2(ux,x2,_9),ure=h2(ux,x2,D9),pre=new $r(1e4);var cx=128;function bR(){let r=[],t=[];for(let e=0;e<=cx;e++)t[e]=0;for(let e=0;e<=cx;e++)r.push(t.slice(0));return r}function S2(r){let t=[];for(let e=0;e<=r;e++)t[e]=0;return t}var mre=S2(2*cx),gre=S2(2*cx),fre=bR(),hre=bR(),vre=bR();var U9;(e=>{e.Default=[-100,0];function t(n){return!n||n.length===2&&n[0]===-100&&n[1]===0}e.isDefault=t})(U9||={});var f2=class{constructor(t,e){this.firstMatchCanBeWeak=t;this.boostFullMatch=e}static{this.default={boostFullMatch:!0,firstMatchCanBeWeak:!1}}};var yR=Object.create(null);function v(r,t){if(De(t)){let e=yR[t];if(e===void 0)throw new Error(`${r} references an unknown codicon: ${t}`);t=e}return yR[r]=t,{id:r}}function C2(){return yR}var T2={add:v("add",6e4),plus:v("plus",6e4),gistNew:v("gist-new",6e4),repoCreate:v("repo-create",6e4),lightbulb:v("lightbulb",60001),lightBulb:v("light-bulb",60001),repo:v("repo",60002),repoDelete:v("repo-delete",60002),gistFork:v("gist-fork",60003),repoForked:v("repo-forked",60003),gitPullRequest:v("git-pull-request",60004),gitPullRequestAbandoned:v("git-pull-request-abandoned",60004),recordKeys:v("record-keys",60005),keyboard:v("keyboard",60005),tag:v("tag",60006),gitPullRequestLabel:v("git-pull-request-label",60006),tagAdd:v("tag-add",60006),tagRemove:v("tag-remove",60006),person:v("person",60007),personFollow:v("person-follow",60007),personOutline:v("person-outline",60007),personFilled:v("person-filled",60007),sourceControl:v("source-control",60008),mirror:v("mirror",60009),mirrorPublic:v("mirror-public",60009),star:v("star",60010),starAdd:v("star-add",60010),starDelete:v("star-delete",60010),starEmpty:v("star-empty",60010),comment:v("comment",60011),commentAdd:v("comment-add",60011),alert:v("alert",60012),warning:v("warning",60012),search:v("search",60013),searchSave:v("search-save",60013),logOut:v("log-out",60014),signOut:v("sign-out",60014),logIn:v("log-in",60015),signIn:v("sign-in",60015),eye:v("eye",60016),eyeUnwatch:v("eye-unwatch",60016),eyeWatch:v("eye-watch",60016),circleFilled:v("circle-filled",60017),primitiveDot:v("primitive-dot",60017),closeDirty:v("close-dirty",60017),debugBreakpoint:v("debug-breakpoint",60017),debugBreakpointDisabled:v("debug-breakpoint-disabled",60017),debugHint:v("debug-hint",60017),terminalDecorationSuccess:v("terminal-decoration-success",60017),primitiveSquare:v("primitive-square",60018),edit:v("edit",60019),pencil:v("pencil",60019),info:v("info",60020),issueOpened:v("issue-opened",60020),gistPrivate:v("gist-private",60021),gitForkPrivate:v("git-fork-private",60021),lock:v("lock",60021),mirrorPrivate:v("mirror-private",60021),close:v("close",60022),removeClose:v("remove-close",60022),x:v("x",60022),repoSync:v("repo-sync",60023),sync:v("sync",60023),clone:v("clone",60024),desktopDownload:v("desktop-download",60024),beaker:v("beaker",60025),microscope:v("microscope",60025),vm:v("vm",60026),deviceDesktop:v("device-desktop",60026),file:v("file",60027),more:v("more",60028),ellipsis:v("ellipsis",60028),kebabHorizontal:v("kebab-horizontal",60028),mailReply:v("mail-reply",60029),reply:v("reply",60029),organization:v("organization",60030),organizationFilled:v("organization-filled",60030),organizationOutline:v("organization-outline",60030),newFile:v("new-file",60031),fileAdd:v("file-add",60031),newFolder:v("new-folder",60032),fileDirectoryCreate:v("file-directory-create",60032),trash:v("trash",60033),trashcan:v("trashcan",60033),history:v("history",60034),clock:v("clock",60034),folder:v("folder",60035),fileDirectory:v("file-directory",60035),symbolFolder:v("symbol-folder",60035),logoGithub:v("logo-github",60036),markGithub:v("mark-github",60036),github:v("github",60036),terminal:v("terminal",60037),console:v("console",60037),repl:v("repl",60037),zap:v("zap",60038),symbolEvent:v("symbol-event",60038),error:v("error",60039),stop:v("stop",60039),variable:v("variable",60040),symbolVariable:v("symbol-variable",60040),array:v("array",60042),symbolArray:v("symbol-array",60042),symbolModule:v("symbol-module",60043),symbolPackage:v("symbol-package",60043),symbolNamespace:v("symbol-namespace",60043),symbolObject:v("symbol-object",60043),symbolMethod:v("symbol-method",60044),symbolFunction:v("symbol-function",60044),symbolConstructor:v("symbol-constructor",60044),symbolBoolean:v("symbol-boolean",60047),symbolNull:v("symbol-null",60047),symbolNumeric:v("symbol-numeric",60048),symbolNumber:v("symbol-number",60048),symbolStructure:v("symbol-structure",60049),symbolStruct:v("symbol-struct",60049),symbolParameter:v("symbol-parameter",60050),symbolTypeParameter:v("symbol-type-parameter",60050),symbolKey:v("symbol-key",60051),symbolText:v("symbol-text",60051),symbolReference:v("symbol-reference",60052),goToFile:v("go-to-file",60052),symbolEnum:v("symbol-enum",60053),symbolValue:v("symbol-value",60053),symbolRuler:v("symbol-ruler",60054),symbolUnit:v("symbol-unit",60054),activateBreakpoints:v("activate-breakpoints",60055),archive:v("archive",60056),arrowBoth:v("arrow-both",60057),arrowDown:v("arrow-down",60058),arrowLeft:v("arrow-left",60059),arrowRight:v("arrow-right",60060),arrowSmallDown:v("arrow-small-down",60061),arrowSmallLeft:v("arrow-small-left",60062),arrowSmallRight:v("arrow-small-right",60063),arrowSmallUp:v("arrow-small-up",60064),arrowUp:v("arrow-up",60065),bell:v("bell",60066),bold:v("bold",60067),book:v("book",60068),bookmark:v("bookmark",60069),debugBreakpointConditionalUnverified:v("debug-breakpoint-conditional-unverified",60070),debugBreakpointConditional:v("debug-breakpoint-conditional",60071),debugBreakpointConditionalDisabled:v("debug-breakpoint-conditional-disabled",60071),debugBreakpointDataUnverified:v("debug-breakpoint-data-unverified",60072),debugBreakpointData:v("debug-breakpoint-data",60073),debugBreakpointDataDisabled:v("debug-breakpoint-data-disabled",60073),debugBreakpointLogUnverified:v("debug-breakpoint-log-unverified",60074),debugBreakpointLog:v("debug-breakpoint-log",60075),debugBreakpointLogDisabled:v("debug-breakpoint-log-disabled",60075),briefcase:v("briefcase",60076),broadcast:v("broadcast",60077),browser:v("browser",60078),bug:v("bug",60079),calendar:v("calendar",60080),caseSensitive:v("case-sensitive",60081),check:v("check",60082),checklist:v("checklist",60083),chevronDown:v("chevron-down",60084),chevronLeft:v("chevron-left",60085),chevronRight:v("chevron-right",60086),chevronUp:v("chevron-up",60087),chromeClose:v("chrome-close",60088),chromeMaximize:v("chrome-maximize",60089),chromeMinimize:v("chrome-minimize",60090),chromeRestore:v("chrome-restore",60091),circleOutline:v("circle-outline",60092),circle:v("circle",60092),debugBreakpointUnverified:v("debug-breakpoint-unverified",60092),terminalDecorationIncomplete:v("terminal-decoration-incomplete",60092),circleSlash:v("circle-slash",60093),circuitBoard:v("circuit-board",60094),clearAll:v("clear-all",60095),clippy:v("clippy",60096),closeAll:v("close-all",60097),cloudDownload:v("cloud-download",60098),cloudUpload:v("cloud-upload",60099),code:v("code",60100),collapseAll:v("collapse-all",60101),colorMode:v("color-mode",60102),commentDiscussion:v("comment-discussion",60103),creditCard:v("credit-card",60105),dash:v("dash",60108),dashboard:v("dashboard",60109),database:v("database",60110),debugContinue:v("debug-continue",60111),debugDisconnect:v("debug-disconnect",60112),debugPause:v("debug-pause",60113),debugRestart:v("debug-restart",60114),debugStart:v("debug-start",60115),debugStepInto:v("debug-step-into",60116),debugStepOut:v("debug-step-out",60117),debugStepOver:v("debug-step-over",60118),debugStop:v("debug-stop",60119),debug:v("debug",60120),deviceCameraVideo:v("device-camera-video",60121),deviceCamera:v("device-camera",60122),deviceMobile:v("device-mobile",60123),diffAdded:v("diff-added",60124),diffIgnored:v("diff-ignored",60125),diffModified:v("diff-modified",60126),diffRemoved:v("diff-removed",60127),diffRenamed:v("diff-renamed",60128),diff:v("diff",60129),diffSidebyside:v("diff-sidebyside",60129),discard:v("discard",60130),editorLayout:v("editor-layout",60131),emptyWindow:v("empty-window",60132),exclude:v("exclude",60133),extensions:v("extensions",60134),eyeClosed:v("eye-closed",60135),fileBinary:v("file-binary",60136),fileCode:v("file-code",60137),fileMedia:v("file-media",60138),filePdf:v("file-pdf",60139),fileSubmodule:v("file-submodule",60140),fileSymlinkDirectory:v("file-symlink-directory",60141),fileSymlinkFile:v("file-symlink-file",60142),fileZip:v("file-zip",60143),files:v("files",60144),filter:v("filter",60145),flame:v("flame",60146),foldDown:v("fold-down",60147),foldUp:v("fold-up",60148),fold:v("fold",60149),folderActive:v("folder-active",60150),folderOpened:v("folder-opened",60151),gear:v("gear",60152),gift:v("gift",60153),gistSecret:v("gist-secret",60154),gist:v("gist",60155),gitCommit:v("git-commit",60156),gitCompare:v("git-compare",60157),compareChanges:v("compare-changes",60157),gitMerge:v("git-merge",60158),githubAction:v("github-action",60159),githubAlt:v("github-alt",60160),globe:v("globe",60161),grabber:v("grabber",60162),graph:v("graph",60163),gripper:v("gripper",60164),heart:v("heart",60165),home:v("home",60166),horizontalRule:v("horizontal-rule",60167),hubot:v("hubot",60168),inbox:v("inbox",60169),issueReopened:v("issue-reopened",60171),issues:v("issues",60172),italic:v("italic",60173),jersey:v("jersey",60174),json:v("json",60175),bracket:v("bracket",60175),kebabVertical:v("kebab-vertical",60176),key:v("key",60177),law:v("law",60178),lightbulbAutofix:v("lightbulb-autofix",60179),linkExternal:v("link-external",60180),link:v("link",60181),listOrdered:v("list-ordered",60182),listUnordered:v("list-unordered",60183),liveShare:v("live-share",60184),loading:v("loading",60185),location:v("location",60186),mailRead:v("mail-read",60187),mail:v("mail",60188),markdown:v("markdown",60189),megaphone:v("megaphone",60190),mention:v("mention",60191),milestone:v("milestone",60192),gitPullRequestMilestone:v("git-pull-request-milestone",60192),mortarBoard:v("mortar-board",60193),move:v("move",60194),multipleWindows:v("multiple-windows",60195),mute:v("mute",60196),noNewline:v("no-newline",60197),note:v("note",60198),octoface:v("octoface",60199),openPreview:v("open-preview",60200),package:v("package",60201),paintcan:v("paintcan",60202),pin:v("pin",60203),play:v("play",60204),run:v("run",60204),plug:v("plug",60205),preserveCase:v("preserve-case",60206),preview:v("preview",60207),project:v("project",60208),pulse:v("pulse",60209),question:v("question",60210),quote:v("quote",60211),radioTower:v("radio-tower",60212),reactions:v("reactions",60213),references:v("references",60214),refresh:v("refresh",60215),regex:v("regex",60216),remoteExplorer:v("remote-explorer",60217),remote:v("remote",60218),remove:v("remove",60219),replaceAll:v("replace-all",60220),replace:v("replace",60221),repoClone:v("repo-clone",60222),repoForcePush:v("repo-force-push",60223),repoPull:v("repo-pull",60224),repoPush:v("repo-push",60225),report:v("report",60226),requestChanges:v("request-changes",60227),rocket:v("rocket",60228),rootFolderOpened:v("root-folder-opened",60229),rootFolder:v("root-folder",60230),rss:v("rss",60231),ruby:v("ruby",60232),saveAll:v("save-all",60233),saveAs:v("save-as",60234),save:v("save",60235),screenFull:v("screen-full",60236),screenNormal:v("screen-normal",60237),searchStop:v("search-stop",60238),server:v("server",60240),settingsGear:v("settings-gear",60241),settings:v("settings",60242),shield:v("shield",60243),smiley:v("smiley",60244),sortPrecedence:v("sort-precedence",60245),splitHorizontal:v("split-horizontal",60246),splitVertical:v("split-vertical",60247),squirrel:v("squirrel",60248),starFull:v("star-full",60249),starHalf:v("star-half",60250),symbolClass:v("symbol-class",60251),symbolColor:v("symbol-color",60252),symbolConstant:v("symbol-constant",60253),symbolEnumMember:v("symbol-enum-member",60254),symbolField:v("symbol-field",60255),symbolFile:v("symbol-file",60256),symbolInterface:v("symbol-interface",60257),symbolKeyword:v("symbol-keyword",60258),symbolMisc:v("symbol-misc",60259),symbolOperator:v("symbol-operator",60260),symbolProperty:v("symbol-property",60261),wrench:v("wrench",60261),wrenchSubaction:v("wrench-subaction",60261),symbolSnippet:v("symbol-snippet",60262),tasklist:v("tasklist",60263),telescope:v("telescope",60264),textSize:v("text-size",60265),threeBars:v("three-bars",60266),thumbsdown:v("thumbsdown",60267),thumbsup:v("thumbsup",60268),tools:v("tools",60269),triangleDown:v("triangle-down",60270),triangleLeft:v("triangle-left",60271),triangleRight:v("triangle-right",60272),triangleUp:v("triangle-up",60273),twitter:v("twitter",60274),unfold:v("unfold",60275),unlock:v("unlock",60276),unmute:v("unmute",60277),unverified:v("unverified",60278),verified:v("verified",60279),versions:v("versions",60280),vmActive:v("vm-active",60281),vmOutline:v("vm-outline",60282),vmRunning:v("vm-running",60283),watch:v("watch",60284),whitespace:v("whitespace",60285),wholeWord:v("whole-word",60286),window:v("window",60287),wordWrap:v("word-wrap",60288),zoomIn:v("zoom-in",60289),zoomOut:v("zoom-out",60290),listFilter:v("list-filter",60291),listFlat:v("list-flat",60292),listSelection:v("list-selection",60293),selection:v("selection",60293),listTree:v("list-tree",60294),debugBreakpointFunctionUnverified:v("debug-breakpoint-function-unverified",60295),debugBreakpointFunction:v("debug-breakpoint-function",60296),debugBreakpointFunctionDisabled:v("debug-breakpoint-function-disabled",60296),debugStackframeActive:v("debug-stackframe-active",60297),circleSmallFilled:v("circle-small-filled",60298),debugStackframeDot:v("debug-stackframe-dot",60298),terminalDecorationMark:v("terminal-decoration-mark",60298),debugStackframe:v("debug-stackframe",60299),debugStackframeFocused:v("debug-stackframe-focused",60299),debugBreakpointUnsupported:v("debug-breakpoint-unsupported",60300),symbolString:v("symbol-string",60301),debugReverseContinue:v("debug-reverse-continue",60302),debugStepBack:v("debug-step-back",60303),debugRestartFrame:v("debug-restart-frame",60304),debugAlt:v("debug-alt",60305),callIncoming:v("call-incoming",60306),callOutgoing:v("call-outgoing",60307),menu:v("menu",60308),expandAll:v("expand-all",60309),feedback:v("feedback",60310),gitPullRequestReviewer:v("git-pull-request-reviewer",60310),groupByRefType:v("group-by-ref-type",60311),ungroupByRefType:v("ungroup-by-ref-type",60312),account:v("account",60313),gitPullRequestAssignee:v("git-pull-request-assignee",60313),bellDot:v("bell-dot",60314),debugConsole:v("debug-console",60315),library:v("library",60316),output:v("output",60317),runAll:v("run-all",60318),syncIgnored:v("sync-ignored",60319),pinned:v("pinned",60320),githubInverted:v("github-inverted",60321),serverProcess:v("server-process",60322),serverEnvironment:v("server-environment",60323),pass:v("pass",60324),issueClosed:v("issue-closed",60324),stopCircle:v("stop-circle",60325),playCircle:v("play-circle",60326),record:v("record",60327),debugAltSmall:v("debug-alt-small",60328),vmConnect:v("vm-connect",60329),cloud:v("cloud",60330),merge:v("merge",60331),export:v("export",60332),graphLeft:v("graph-left",60333),magnet:v("magnet",60334),notebook:v("notebook",60335),redo:v("redo",60336),checkAll:v("check-all",60337),pinnedDirty:v("pinned-dirty",60338),passFilled:v("pass-filled",60339),circleLargeFilled:v("circle-large-filled",60340),circleLarge:v("circle-large",60341),circleLargeOutline:v("circle-large-outline",60341),combine:v("combine",60342),gather:v("gather",60342),table:v("table",60343),variableGroup:v("variable-group",60344),typeHierarchy:v("type-hierarchy",60345),typeHierarchySub:v("type-hierarchy-sub",60346),typeHierarchySuper:v("type-hierarchy-super",60347),gitPullRequestCreate:v("git-pull-request-create",60348),runAbove:v("run-above",60349),runBelow:v("run-below",60350),notebookTemplate:v("notebook-template",60351),debugRerun:v("debug-rerun",60352),workspaceTrusted:v("workspace-trusted",60353),workspaceUntrusted:v("workspace-untrusted",60354),workspaceUnknown:v("workspace-unknown",60355),terminalCmd:v("terminal-cmd",60356),terminalDebian:v("terminal-debian",60357),terminalLinux:v("terminal-linux",60358),terminalPowershell:v("terminal-powershell",60359),terminalTmux:v("terminal-tmux",60360),terminalUbuntu:v("terminal-ubuntu",60361),terminalBash:v("terminal-bash",60362),arrowSwap:v("arrow-swap",60363),copy:v("copy",60364),personAdd:v("person-add",60365),filterFilled:v("filter-filled",60366),wand:v("wand",60367),debugLineByLine:v("debug-line-by-line",60368),inspect:v("inspect",60369),layers:v("layers",60370),layersDot:v("layers-dot",60371),layersActive:v("layers-active",60372),compass:v("compass",60373),compassDot:v("compass-dot",60374),compassActive:v("compass-active",60375),azure:v("azure",60376),issueDraft:v("issue-draft",60377),gitPullRequestClosed:v("git-pull-request-closed",60378),gitPullRequestDraft:v("git-pull-request-draft",60379),debugAll:v("debug-all",60380),debugCoverage:v("debug-coverage",60381),runErrors:v("run-errors",60382),folderLibrary:v("folder-library",60383),debugContinueSmall:v("debug-continue-small",60384),beakerStop:v("beaker-stop",60385),graphLine:v("graph-line",60386),graphScatter:v("graph-scatter",60387),pieChart:v("pie-chart",60388),bracketDot:v("bracket-dot",60389),bracketError:v("bracket-error",60390),lockSmall:v("lock-small",60391),azureDevops:v("azure-devops",60392),verifiedFilled:v("verified-filled",60393),newline:v("newline",60394),layout:v("layout",60395),layoutActivitybarLeft:v("layout-activitybar-left",60396),layoutActivitybarRight:v("layout-activitybar-right",60397),layoutPanelLeft:v("layout-panel-left",60398),layoutPanelCenter:v("layout-panel-center",60399),layoutPanelJustify:v("layout-panel-justify",60400),layoutPanelRight:v("layout-panel-right",60401),layoutPanel:v("layout-panel",60402),layoutSidebarLeft:v("layout-sidebar-left",60403),layoutSidebarRight:v("layout-sidebar-right",60404),layoutStatusbar:v("layout-statusbar",60405),layoutMenubar:v("layout-menubar",60406),layoutCentered:v("layout-centered",60407),target:v("target",60408),indent:v("indent",60409),recordSmall:v("record-small",60410),errorSmall:v("error-small",60411),terminalDecorationError:v("terminal-decoration-error",60411),arrowCircleDown:v("arrow-circle-down",60412),arrowCircleLeft:v("arrow-circle-left",60413),arrowCircleRight:v("arrow-circle-right",60414),arrowCircleUp:v("arrow-circle-up",60415),layoutSidebarRightOff:v("layout-sidebar-right-off",60416),layoutPanelOff:v("layout-panel-off",60417),layoutSidebarLeftOff:v("layout-sidebar-left-off",60418),blank:v("blank",60419),heartFilled:v("heart-filled",60420),map:v("map",60421),mapHorizontal:v("map-horizontal",60421),foldHorizontal:v("fold-horizontal",60421),mapFilled:v("map-filled",60422),mapHorizontalFilled:v("map-horizontal-filled",60422),foldHorizontalFilled:v("fold-horizontal-filled",60422),circleSmall:v("circle-small",60423),bellSlash:v("bell-slash",60424),bellSlashDot:v("bell-slash-dot",60425),commentUnresolved:v("comment-unresolved",60426),gitPullRequestGoToChanges:v("git-pull-request-go-to-changes",60427),gitPullRequestNewChanges:v("git-pull-request-new-changes",60428),searchFuzzy:v("search-fuzzy",60429),commentDraft:v("comment-draft",60430),send:v("send",60431),sparkle:v("sparkle",60432),insert:v("insert",60433),mic:v("mic",60434),thumbsdownFilled:v("thumbsdown-filled",60435),thumbsupFilled:v("thumbsup-filled",60436),coffee:v("coffee",60437),snake:v("snake",60438),game:v("game",60439),vr:v("vr",60440),chip:v("chip",60441),piano:v("piano",60442),music:v("music",60443),micFilled:v("mic-filled",60444),repoFetch:v("repo-fetch",60445),copilot:v("copilot",60446),lightbulbSparkle:v("lightbulb-sparkle",60447),robot:v("robot",60448),sparkleFilled:v("sparkle-filled",60449),diffSingle:v("diff-single",60450),diffMultiple:v("diff-multiple",60451),surroundWith:v("surround-with",60452),share:v("share",60453),gitStash:v("git-stash",60454),gitStashApply:v("git-stash-apply",60455),gitStashPop:v("git-stash-pop",60456),vscode:v("vscode",60457),vscodeInsiders:v("vscode-insiders",60458),codeOss:v("code-oss",60459),runCoverage:v("run-coverage",60460),runAllCoverage:v("run-all-coverage",60461),coverage:v("coverage",60462),githubProject:v("github-project",60463),mapVertical:v("map-vertical",60464),foldVertical:v("fold-vertical",60464),mapVerticalFilled:v("map-vertical-filled",60465),foldVerticalFilled:v("fold-vertical-filled",60465),goToSearch:v("go-to-search",60466),percentage:v("percentage",60467),sortPercentage:v("sort-percentage",60467),attach:v("attach",60468),goToEditingSession:v("go-to-editing-session",60469),editSession:v("edit-session",60470),codeReview:v("code-review",60471),copilotWarning:v("copilot-warning",60472),python:v("python",60473),copilotLarge:v("copilot-large",60474),copilotWarningLarge:v("copilot-warning-large",60475),keyboardTab:v("keyboard-tab",60476),copilotBlocked:v("copilot-blocked",60477),copilotNotConnected:v("copilot-not-connected",60478),flag:v("flag",60479),lightbulbEmpty:v("lightbulb-empty",60480),symbolMethodArrow:v("symbol-method-arrow",60481),copilotUnavailable:v("copilot-unavailable",60482),repoPinned:v("repo-pinned",60483),keyboardTabAbove:v("keyboard-tab-above",60484),keyboardTabBelow:v("keyboard-tab-below",60485),gitPullRequestDone:v("git-pull-request-done",60486),mcp:v("mcp",60487),extensionsLarge:v("extensions-large",60488),layoutPanelDock:v("layout-panel-dock",60489),layoutSidebarLeftDock:v("layout-sidebar-left-dock",60490),layoutSidebarRightDock:v("layout-sidebar-right-dock",60491),copilotInProgress:v("copilot-in-progress",60492),copilotError:v("copilot-error",60493),copilotSuccess:v("copilot-success",60494),chatSparkle:v("chat-sparkle",60495),searchSparkle:v("search-sparkle",60496),editSparkle:v("edit-sparkle",60497),copilotSnooze:v("copilot-snooze",60498),sendToRemoteAgent:v("send-to-remote-agent",60499),commentDiscussionSparkle:v("comment-discussion-sparkle",60500),chatSparkleWarning:v("chat-sparkle-warning",60501),chatSparkleError:v("chat-sparkle-error",60502),collection:v("collection",60503),newCollection:v("new-collection",60504),thinking:v("thinking",60505),build:v("build",60506),commentDiscussionQuote:v("comment-discussion-quote",60507),cursor:v("cursor",60508),eraser:v("eraser",60509),fileText:v("file-text",60510),quotes:v("quotes",60512),rename:v("rename",60513),runWithDeps:v("run-with-deps",60514),debugConnected:v("debug-connected",60515),strikethrough:v("strikethrough",60516),openInProduct:v("open-in-product",60517),indexZero:v("index-zero",60518),agent:v("agent",60519),editCode:v("edit-code",60520),repoSelected:v("repo-selected",60521),skip:v("skip",60522),mergeInto:v("merge-into",60523),gitBranchChanges:v("git-branch-changes",60524),gitBranchStagedChanges:v("git-branch-staged-changes",60525),gitBranchConflicts:v("git-branch-conflicts",60526),gitBranch:v("git-branch",60527),gitBranchCreate:v("git-branch-create",60527),gitBranchDelete:v("git-branch-delete",60527),searchLarge:v("search-large",60528),terminalGitBash:v("terminal-git-bash",60529),windowActive:v("window-active",60530),forward:v("forward",60531),download:v("download",60532),clockface:v("clockface",60533),unarchive:v("unarchive",60534),sessionInProgress:v("session-in-progress",60535),collectionSmall:v("collection-small",60536),vmSmall:v("vm-small",60537),cloudSmall:v("cloud-small",60538),addSmall:v("add-small",60539),removeSmall:v("remove-small",60540),worktreeSmall:v("worktree-small",60541),worktree:v("worktree",60542),screenCut:v("screen-cut",60543),ask:v("ask",60544),openai:v("openai",60545),claude:v("claude",60546),openInWindow:v("open-in-window",60547),newSession:v("new-session",60548),terminalSecure:v("terminal-secure",60549)};var F9={dialogError:v("dialog-error","error"),dialogWarning:v("dialog-warning","warning"),dialogInfo:v("dialog-info","info"),dialogClose:v("dialog-close","close"),treeItemExpanded:v("tree-item-expanded","chevron-down"),treeFilterOnTypeOn:v("tree-filter-on-type-on","list-filter"),treeFilterOnTypeOff:v("tree-filter-on-type-off","list-selection"),treeFilterClear:v("tree-filter-clear","close"),treeItemLoading:v("tree-item-loading","loading"),menuSelection:v("menu-selection","check"),menuSubmenu:v("menu-submenu","chevron-right"),menuBarMore:v("menubar-more","more"),scrollbarButtonLeft:v("scrollbar-button-left","triangle-left"),scrollbarButtonRight:v("scrollbar-button-right","triangle-right"),scrollbarButtonUp:v("scrollbar-button-up","triangle-up"),scrollbarButtonDown:v("scrollbar-button-down","triangle-down"),toolBarMore:v("toolbar-more","more"),quickInputBack:v("quick-input-back","arrow-left"),dropDownButton:v("drop-down-button",60084),symbolCustomColor:v("symbol-customcolor",60252),exportIcon:v("export",60332),workspaceUnspecified:v("workspace-unspecified",60355),newLine:v("newline",60394),thumbsDownFilled:v("thumbsdown-filled",60435),thumbsUpFilled:v("thumbsup-filled",60436),gitFetch:v("git-fetch",60445),lightbulbSparkleAutofix:v("lightbulb-sparkle-autofix",60447),debugBreakpointPending:v("debug-breakpoint-pending",60377),chatImport:v("chat-import",60550),chatExport:v("chat-export",60551)},ce={...T2,...F9};var kp;(t=>{function r(e){return!!e&&typeof e=="object"&&typeof e.id=="string"}t.isThemeColor=r})(kp||={});var ut;(S=>{S.iconNameSegment="[A-Za-z0-9]+",S.iconNameExpression="[A-Za-z0-9-]+",S.iconModifierExpression="~[A-Za-z]+",S.iconNameCharacter="[A-Za-z0-9~-]";let o=new RegExp(`^(${S.iconNameExpression})(${S.iconModifierExpression})?$`);function i(T){let P=o.exec(T.id);if(!P)return i(ce.error);let[,L,q]=P,N=["codicon","codicon-"+L];return q&&N.push("codicon-modifier-"+q.substring(1)),N}S.asClassNameArray=i;function s(T){return i(T).join(" ")}S.asClassName=s;function a(T){return"."+i(T).join(".")}S.asCSSSelector=a;function l(T){return!!T&&typeof T=="object"&&typeof T.id=="string"&&(typeof T.color>"u"||kp.isThemeColor(T.color))}S.isThemeIcon=l;let d=new RegExp(`^\\$\\((${S.iconNameExpression}(?:${S.iconModifierExpression})?)\\)$`);function c(T){let P=d.exec(T);if(!P)return;let[,L]=P;return{id:L}}S.fromString=c;function u(T){return{id:T}}S.fromId=u;function m(T,P){let L=T.id,q=L.lastIndexOf("~");return q!==-1&&(L=L.substring(0,q)),P&&(L=`${L}~${P}`),{id:L}}S.modify=m;function g(T){let P=T.id.lastIndexOf("~");if(P!==-1)return T.id.substring(P+1)}S.getModifier=g;function h(T,P){return T.id===P.id&&T.color?.id===P.color?.id}S.isEqual=h;function f(T){return T?.id===ce.file.id}S.isFile=f;function I(T){return T?.id===ce.folder.id}S.isFolder=I})(ut||={});var IR=new RegExp(`\\$\\(${ut.iconNameExpression}(?:${ut.iconModifierExpression})?\\)`,"g"),H9=new RegExp(`(\\\\)?${IR.source}`,"g");function E2(r){return r.replace(H9,(t,e)=>e?t:`\\${t}`)}var Mre=new RegExp(`\\\\${IR.source}`,"g");var Lre=new RegExp(`(\\s)?(\\\\)?${IR.source}(\\s)?`,"g");var Ore=new RegExp(`\\$\\(${ut.iconNameCharacter}+\\)`,"g");var Bt=class r{static lift(t){let e=new r(t.value,t);return e.uris=t.uris,e.baseUri=t.baseUri?b.revive(t.baseUri):void 0,e}constructor(t="",e=!1){if(this.value=t,typeof this.value!="string")throw Fe("value");typeof e=="boolean"?(this.isTrusted=e,this.supportThemeIcons=!1,this.supportHtml=!1,this.supportAlertSyntax=!1):(this.isTrusted=e.isTrusted??void 0,this.supportThemeIcons=e.supportThemeIcons??!1,this.supportHtml=e.supportHtml??!1,this.supportAlertSyntax=e.supportAlertSyntax??!1)}appendText(t,e=0){return this.value+=W9(this.supportThemeIcons?E2(t):t).replace(/([ \t]+)/g,(n,o)=>"&nbsp;".repeat(o.length)).replace(/\>/gm,"\\>").replace(/\n/g,e===1?`\\
`:`

`),this}appendMarkdown(t){return this.value+=t,this}appendCodeblock(t,e){return this.value+=`
${V9(e,t)}
`,this}appendLink(t,e,n){return this.value+="[",this.value+=this._escape(e,"]"),this.value+="](",this.value+=this._escape(String(t),")"),n&&(this.value+=` "${this._escape(this._escape(n,'"'),")")}"`),this.value+=")",this}_escape(t,e){let n=new RegExp(pr(e),"g");return t.replace(n,(o,i)=>t.charAt(i-1)!=="\\"?`\\${o}`:o)}};function Uo(r){return r instanceof Bt?!0:r&&typeof r=="object"?typeof r.value=="string"&&(typeof r.isTrusted=="boolean"||typeof r.isTrusted=="object"||r.isTrusted===void 0)&&(typeof r.supportThemeIcons=="boolean"||r.supportThemeIcons===void 0)&&(typeof r.supportAlertSyntax=="boolean"||r.supportAlertSyntax===void 0):!1}function W9(r){return r.replace(/[\\`*_{}[\]()#+\-!~]/g,"\\$&")}function V9(r,t){let e=r.match(/^`+/gm)?.reduce((o,i)=>o.length>i.length?o:i).length??0,n=e>=3?e+1:3;return[`${"`".repeat(n)}${t}`,r,`${"`".repeat(n)}`].join(`
`)}function w2(r){let t=[],e=r.split("|").map(o=>o.trim());r=e[0];let n=e[1];if(n){let o=/height=(\d+)/.exec(n),i=/width=(\d+)/.exec(n),s=o?o[1]:"",a=i?i[1]:"",l=isFinite(parseInt(a)),d=isFinite(parseInt(s));l&&t.push(`width="${a}"`),d&&t.push(`height="${s}"`)}return{href:r,dimensions:t}}function CR(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var bc=CR();function A2(r){bc=r}var M2=/[&<>"']/,$9=new RegExp(M2.source,"g"),L2=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,z9=new RegExp(L2.source,"g"),q9={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},k2=r=>q9[r];function Ar(r,t){if(t){if(M2.test(r))return r.replace($9,k2)}else if(L2.test(r))return r.replace(z9,k2);return r}var K9=/(^|[^\[])\^/g;function Yt(r,t){let e=typeof r=="string"?r:r.source;t=t||"";let n={replace:(o,i)=>{let s=typeof i=="string"?i:i.source;return s=s.replace(K9,"$1"),e=e.replace(o,s),n},getRegex:()=>new RegExp(e,t)};return n}function P2(r){try{r=encodeURI(r).replace(/%25/g,"%")}catch{return null}return r}var Zh={exec:()=>null};function _2(r,t){let e=r.replace(/\|/g,(i,s,a)=>{let l=!1,d=s;for(;--d>=0&&a[d]==="\\";)l=!l;return l?"|":" |"}),n=e.split(/ \|/),o=0;if(n[0].trim()||n.shift(),n.length>0&&!n[n.length-1].trim()&&n.pop(),t)if(n.length>t)n.splice(t);else for(;n.length<t;)n.push("");for(;o<n.length;o++)n[o]=n[o].trim().replace(/\\\|/g,"|");return n}function Yh(r,t,e){let n=r.length;if(n===0)return"";let o=0;for(;o<n;){let i=r.charAt(n-o-1);if(i===t&&!e)o++;else if(i!==t&&e)o++;else break}return r.slice(0,n-o)}function j9(r,t){if(r.indexOf(t[1])===-1)return-1;let e=0;for(let n=0;n<r.length;n++)if(r[n]==="\\")n++;else if(r[n]===t[0])e++;else if(r[n]===t[1]&&(e--,e<0))return n;return-1}function D2(r,t,e,n){let o=t.href,i=t.title?Ar(t.title):null,s=r[1].replace(/\\([\[\]])/g,"$1");if(r[0].charAt(0)!=="!"){n.state.inLink=!0;let a={type:"link",raw:e,href:o,title:i,text:s,tokens:n.inlineTokens(s)};return n.state.inLink=!1,a}return{type:"image",raw:e,href:o,title:i,text:Ar(s)}}function G9(r,t){let e=r.match(/^(\s+)(?:```)/);if(e===null)return t;let n=e[1];return t.split(`
`).map(o=>{let i=o.match(/^\s+/);if(i===null)return o;let[s]=i;return s.length>=n.length?o.slice(n.length):o}).join(`
`)}var _p=class{options;rules;lexer;constructor(t){this.options=t||bc}space(t){let e=this.rules.block.newline.exec(t);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(t){let e=this.rules.block.code.exec(t);if(e){let n=e[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?n:Yh(n,`
`)}}}fences(t){let e=this.rules.block.fences.exec(t);if(e){let n=e[0],o=G9(n,e[3]||"");return{type:"code",raw:n,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:o}}}heading(t){let e=this.rules.block.heading.exec(t);if(e){let n=e[2].trim();if(/#$/.test(n)){let o=Yh(n,"#");(this.options.pedantic||!o||/ $/.test(o))&&(n=o.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(t){let e=this.rules.block.hr.exec(t);if(e)return{type:"hr",raw:Yh(e[0],`
`)}}blockquote(t){let e=this.rules.block.blockquote.exec(t);if(e){let n=Yh(e[0],`
`).split(`
`),o="",i="",s=[];for(;n.length>0;){let a=!1,l=[],d;for(d=0;d<n.length;d++)if(/^ {0,3}>/.test(n[d]))l.push(n[d]),a=!0;else if(!a)l.push(n[d]);else break;n=n.slice(d);let c=l.join(`
`),u=c.replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,`
    $1`).replace(/^ {0,3}>[ \t]?/gm,"");o=o?`${o}
${c}`:c,i=i?`${i}
${u}`:u;let m=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(u,s,!0),this.lexer.state.top=m,n.length===0)break;let g=s[s.length-1];if(g?.type==="code")break;if(g?.type==="blockquote"){let h=g,f=h.raw+`
`+n.join(`
`),I=this.blockquote(f);s[s.length-1]=I,o=o.substring(0,o.length-h.raw.length)+I.raw,i=i.substring(0,i.length-h.text.length)+I.text;break}else if(g?.type==="list"){let h=g,f=h.raw+`
`+n.join(`
`),I=this.list(f);s[s.length-1]=I,o=o.substring(0,o.length-g.raw.length)+I.raw,i=i.substring(0,i.length-h.raw.length)+I.raw,n=f.substring(s[s.length-1].raw.length).split(`
`);continue}}return{type:"blockquote",raw:o,tokens:s,text:i}}}list(t){let e=this.rules.block.list.exec(t);if(e){let n=e[1].trim(),o=n.length>1,i={type:"list",raw:"",ordered:o,start:o?+n.slice(0,-1):"",loose:!1,items:[]};n=o?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=o?n:"[*+-]");let s=new RegExp(`^( {0,3}${n})((?:[	 ][^\\n]*)?(?:\\n|$))`),a=!1;for(;t;){let l=!1,d="",c="";if(!(e=s.exec(t))||this.rules.block.hr.test(t))break;d=e[0],t=t.substring(d.length);let u=e[2].split(`
`,1)[0].replace(/^\t+/,S=>" ".repeat(3*S.length)),m=t.split(`
`,1)[0],g=!u.trim(),h=0;if(this.options.pedantic?(h=2,c=u.trimStart()):g?h=e[1].length+1:(h=e[2].search(/[^ ]/),h=h>4?1:h,c=u.slice(h),h+=e[1].length),g&&/^ *$/.test(m)&&(d+=m+`
`,t=t.substring(m.length+1),l=!0),!l){let S=new RegExp(`^ {0,${Math.min(3,h-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ 	][^\\n]*)?(?:\\n|$))`),T=new RegExp(`^ {0,${Math.min(3,h-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),P=new RegExp(`^ {0,${Math.min(3,h-1)}}(?:\`\`\`|~~~)`),L=new RegExp(`^ {0,${Math.min(3,h-1)}}#`);for(;t;){let q=t.split(`
`,1)[0];if(m=q,this.options.pedantic&&(m=m.replace(/^ {1,4}(?=( {4})*[^ ])/g,"  ")),P.test(m)||L.test(m)||S.test(m)||T.test(t))break;if(m.search(/[^ ]/)>=h||!m.trim())c+=`
`+m.slice(h);else{if(g||u.search(/[^ ]/)>=4||P.test(u)||L.test(u)||T.test(u))break;c+=`
`+m}!g&&!m.trim()&&(g=!0),d+=q+`
`,t=t.substring(q.length+1),u=m.slice(h)}}i.loose||(a?i.loose=!0:/\n *\n *$/.test(d)&&(a=!0));let f=null,I;this.options.gfm&&(f=/^\[[ xX]\] /.exec(c),f&&(I=f[0]!=="[ ] ",c=c.replace(/^\[[ xX]\] +/,""))),i.items.push({type:"list_item",raw:d,task:!!f,checked:I,loose:!1,text:c,tokens:[]}),i.raw+=d}i.items[i.items.length-1].raw=i.items[i.items.length-1].raw.trimEnd(),i.items[i.items.length-1].text=i.items[i.items.length-1].text.trimEnd(),i.raw=i.raw.trimEnd();for(let l=0;l<i.items.length;l++)if(this.lexer.state.top=!1,i.items[l].tokens=this.lexer.blockTokens(i.items[l].text,[]),!i.loose){let d=i.items[l].tokens.filter(u=>u.type==="space"),c=d.length>0&&d.some(u=>/\n.*\n/.test(u.raw));i.loose=c}if(i.loose)for(let l=0;l<i.items.length;l++)i.items[l].loose=!0;return i}}html(t){let e=this.rules.block.html.exec(t);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(t){let e=this.rules.block.def.exec(t);if(e){let n=e[1].toLowerCase().replace(/\s+/g," "),o=e[2]?e[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:n,raw:e[0],href:o,title:i}}}table(t){let e=this.rules.block.table.exec(t);if(!e||!/[:|]/.test(e[2]))return;let n=_2(e[1]),o=e[2].replace(/^\||\| *$/g,"").split("|"),i=e[3]&&e[3].trim()?e[3].replace(/\n[ \t]*$/,"").split(`
`):[],s={type:"table",raw:e[0],header:[],align:[],rows:[]};if(n.length===o.length){for(let a of o)/^ *-+: *$/.test(a)?s.align.push("right"):/^ *:-+: *$/.test(a)?s.align.push("center"):/^ *:-+ *$/.test(a)?s.align.push("left"):s.align.push(null);for(let a=0;a<n.length;a++)s.header.push({text:n[a],tokens:this.lexer.inline(n[a]),header:!0,align:s.align[a]});for(let a of i)s.rows.push(_2(a,s.header.length).map((l,d)=>({text:l,tokens:this.lexer.inline(l),header:!1,align:s.align[d]})));return s}}lheading(t){let e=this.rules.block.lheading.exec(t);if(e)return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:e[1],tokens:this.lexer.inline(e[1])}}paragraph(t){let e=this.rules.block.paragraph.exec(t);if(e){let n=e[1].charAt(e[1].length-1)===`
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:n,tokens:this.lexer.inline(n)}}}text(t){let e=this.rules.block.text.exec(t);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(t){let e=this.rules.inline.escape.exec(t);if(e)return{type:"escape",raw:e[0],text:Ar(e[1])}}tag(t){let e=this.rules.inline.tag.exec(t);if(e)return!this.lexer.state.inLink&&/^<a /i.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(t){let e=this.rules.inline.link.exec(t);if(e){let n=e[2].trim();if(!this.options.pedantic&&/^</.test(n)){if(!/>$/.test(n))return;let s=Yh(n.slice(0,-1),"\\");if((n.length-s.length)%2===0)return}else{let s=j9(e[2],"()");if(s>-1){let l=(e[0].indexOf("!")===0?5:4)+e[1].length+s;e[2]=e[2].substring(0,s),e[0]=e[0].substring(0,l).trim(),e[3]=""}}let o=e[2],i="";if(this.options.pedantic){let s=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(o);s&&(o=s[1],i=s[3])}else i=e[3]?e[3].slice(1,-1):"";return o=o.trim(),/^</.test(o)&&(this.options.pedantic&&!/>$/.test(n)?o=o.slice(1):o=o.slice(1,-1)),D2(e,{href:o&&o.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer)}}reflink(t,e){let n;if((n=this.rules.inline.reflink.exec(t))||(n=this.rules.inline.nolink.exec(t))){let o=(n[2]||n[1]).replace(/\s+/g," "),i=e[o.toLowerCase()];if(!i){let s=n[0].charAt(0);return{type:"text",raw:s,text:s}}return D2(n,i,n[0],this.lexer)}}emStrong(t,e,n=""){let o=this.rules.inline.emStrongLDelim.exec(t);if(!o||o[3]&&n.match(/[\p{L}\p{N}]/u))return;if(!(o[1]||o[2]||"")||!n||this.rules.inline.punctuation.exec(n)){let s=[...o[0]].length-1,a,l,d=s,c=0,u=o[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(u.lastIndex=0,e=e.slice(-1*t.length+s);(o=u.exec(e))!=null;){if(a=o[1]||o[2]||o[3]||o[4]||o[5]||o[6],!a)continue;if(l=[...a].length,o[3]||o[4]){d+=l;continue}else if((o[5]||o[6])&&s%3&&!((s+l)%3)){c+=l;continue}if(d-=l,d>0)continue;l=Math.min(l,l+d+c);let m=[...o[0]][0].length,g=t.slice(0,s+o.index+m+l);if(Math.min(s,l)%2){let f=g.slice(1,-1);return{type:"em",raw:g,text:f,tokens:this.lexer.inlineTokens(f)}}let h=g.slice(2,-2);return{type:"strong",raw:g,text:h,tokens:this.lexer.inlineTokens(h)}}}}codespan(t){let e=this.rules.inline.code.exec(t);if(e){let n=e[2].replace(/\n/g," "),o=/[^ ]/.test(n),i=/^ /.test(n)&&/ $/.test(n);return o&&i&&(n=n.substring(1,n.length-1)),n=Ar(n,!0),{type:"codespan",raw:e[0],text:n}}}br(t){let e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}}del(t){let e=this.rules.inline.del.exec(t);if(e)return{type:"del",raw:e[0],text:e[2],tokens:this.lexer.inlineTokens(e[2])}}autolink(t){let e=this.rules.inline.autolink.exec(t);if(e){let n,o;return e[2]==="@"?(n=Ar(e[1]),o="mailto:"+n):(n=Ar(e[1]),o=n),{type:"link",raw:e[0],text:n,href:o,tokens:[{type:"text",raw:n,text:n}]}}}url(t){let e;if(e=this.rules.inline.url.exec(t)){let n,o;if(e[2]==="@")n=Ar(e[0]),o="mailto:"+n;else{let i;do i=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(i!==e[0]);n=Ar(e[0]),e[1]==="www."?o="http://"+e[0]:o=e[0]}return{type:"link",raw:e[0],text:n,href:o,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(t){let e=this.rules.inline.text.exec(t);if(e){let n;return this.lexer.state.inRawBlock?n=e[0]:n=Ar(e[0]),{type:"text",raw:e[0],text:n}}}},Q9=/^(?: *(?:\n|$))+/,J9=/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,Y9=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,tv=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,X9=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,O2=/(?:[*+-]|\d{1,9}[.)])/,N2=Yt(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,O2).replace(/blockCode/g,/ {4}/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).getRegex(),TR=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Z9=/^[^\n]+/,ER=/(?!\s*\])(?:\\.|[^\[\]\\])+/,e7=Yt(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label",ER).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),t7=Yt(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,O2).getRegex(),gx="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",wR=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,n7=Yt("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))","i").replace("comment",wR).replace("tag",gx).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),U2=Yt(TR).replace("hr",tv).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",gx).getRegex(),o7=Yt(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",U2).getRegex(),kR={blockquote:o7,code:J9,def:e7,fences:Y9,heading:X9,hr:tv,html:n7,lheading:N2,list:t7,newline:Q9,paragraph:U2,table:Zh,text:Z9},R2=Yt("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",tv).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",gx).getRegex(),r7={...kR,table:R2,paragraph:Yt(TR).replace("hr",tv).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",R2).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",gx).getRegex()},i7={...kR,html:Yt(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",wR).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Zh,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Yt(TR).replace("hr",tv).replace("heading",` *#{1,6} *[^
]`).replace("lheading",N2).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},F2=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,s7=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,H2=/^( {2,}|\\)\n(?!\s*$)/,a7=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,nv="\\p{P}\\p{S}",l7=Yt(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,nv).getRegex(),d7=/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,c7=Yt(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,nv).getRegex(),u7=Yt("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,nv).getRegex(),p7=Yt("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,nv).getRegex(),m7=Yt(/\\([punct])/,"gu").replace(/punct/g,nv).getRegex(),g7=Yt(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),f7=Yt(wR).replace("(?:-->|$)","-->").getRegex(),h7=Yt("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",f7).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),mx=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,v7=Yt(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",mx).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),W2=Yt(/^!?\[(label)\]\[(ref)\]/).replace("label",mx).replace("ref",ER).getRegex(),V2=Yt(/^!?\[(ref)\](?:\[\])?/).replace("ref",ER).getRegex(),b7=Yt("reflink|nolink(?!\\()","g").replace("reflink",W2).replace("nolink",V2).getRegex(),PR={_backpedal:Zh,anyPunctuation:m7,autolink:g7,blockSkip:d7,br:H2,code:s7,del:Zh,emStrongLDelim:c7,emStrongRDelimAst:u7,emStrongRDelimUnd:p7,escape:F2,link:v7,nolink:V2,punctuation:l7,reflink:W2,reflinkSearch:b7,tag:h7,text:a7,url:Zh},y7={...PR,link:Yt(/^!?\[(label)\]\((.*?)\)/).replace("label",mx).getRegex(),reflink:Yt(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",mx).getRegex()},xR={...PR,escape:Yt(F2).replace("])","~|])").getRegex(),url:Yt(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},I7={...xR,br:Yt(H2).replace("{2,}","*").getRegex(),text:Yt(xR.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},px={normal:kR,gfm:r7,pedantic:i7},Xh={normal:PR,gfm:xR,breaks:I7,pedantic:y7},ca=class r{tokens;options;state;tokenizer;inlineQueue;constructor(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||bc,this.options.tokenizer=this.options.tokenizer||new _p,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let e={block:px.normal,inline:Xh.normal};this.options.pedantic?(e.block=px.pedantic,e.inline=Xh.pedantic):this.options.gfm&&(e.block=px.gfm,this.options.breaks?e.inline=Xh.breaks:e.inline=Xh.gfm),this.tokenizer.rules=e}static get rules(){return{block:px,inline:Xh}}static lex(t,e){return new r(e).lex(t)}static lexInline(t,e){return new r(e).inlineTokens(t)}lex(t){t=t.replace(/\r\n|\r/g,`
`),this.blockTokens(t,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let n=this.inlineQueue[e];this.inlineTokens(n.src,n.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,e=[],n=!1){this.options.pedantic?t=t.replace(/\t/g,"    ").replace(/^ +$/gm,""):t=t.replace(/^( *)(\t+)/gm,(a,l,d)=>l+"    ".repeat(d.length));let o,i,s;for(;t;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(a=>(o=a.call({lexer:this},t,e))?(t=t.substring(o.raw.length),e.push(o),!0):!1))){if(o=this.tokenizer.space(t)){t=t.substring(o.raw.length),o.raw.length===1&&e.length>0?e[e.length-1].raw+=`
`:e.push(o);continue}if(o=this.tokenizer.code(t)){t=t.substring(o.raw.length),i=e[e.length-1],i&&(i.type==="paragraph"||i.type==="text")?(i.raw+=`
`+o.raw,i.text+=`
`+o.text,this.inlineQueue[this.inlineQueue.length-1].src=i.text):e.push(o);continue}if(o=this.tokenizer.fences(t)){t=t.substring(o.raw.length),e.push(o);continue}if(o=this.tokenizer.heading(t)){t=t.substring(o.raw.length),e.push(o);continue}if(o=this.tokenizer.hr(t)){t=t.substring(o.raw.length),e.push(o);continue}if(o=this.tokenizer.blockquote(t)){t=t.substring(o.raw.length),e.push(o);continue}if(o=this.tokenizer.list(t)){t=t.substring(o.raw.length),e.push(o);continue}if(o=this.tokenizer.html(t)){t=t.substring(o.raw.length),e.push(o);continue}if(o=this.tokenizer.def(t)){t=t.substring(o.raw.length),i=e[e.length-1],i&&(i.type==="paragraph"||i.type==="text")?(i.raw+=`
`+o.raw,i.text+=`
`+o.raw,this.inlineQueue[this.inlineQueue.length-1].src=i.text):this.tokens.links[o.tag]||(this.tokens.links[o.tag]={href:o.href,title:o.title});continue}if(o=this.tokenizer.table(t)){t=t.substring(o.raw.length),e.push(o);continue}if(o=this.tokenizer.lheading(t)){t=t.substring(o.raw.length),e.push(o);continue}if(s=t,this.options.extensions&&this.options.extensions.startBlock){let a=1/0,l=t.slice(1),d;this.options.extensions.startBlock.forEach(c=>{d=c.call({lexer:this},l),typeof d=="number"&&d>=0&&(a=Math.min(a,d))}),a<1/0&&a>=0&&(s=t.substring(0,a+1))}if(this.state.top&&(o=this.tokenizer.paragraph(s))){i=e[e.length-1],n&&i?.type==="paragraph"?(i.raw+=`
`+o.raw,i.text+=`
`+o.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):e.push(o),n=s.length!==t.length,t=t.substring(o.raw.length);continue}if(o=this.tokenizer.text(t)){t=t.substring(o.raw.length),i=e[e.length-1],i&&i.type==="text"?(i.raw+=`
`+o.raw,i.text+=`
`+o.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):e.push(o);continue}if(t){let a="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(a);break}else throw new Error(a)}}return this.state.top=!0,e}inline(t,e=[]){return this.inlineQueue.push({src:t,tokens:e}),e}inlineTokens(t,e=[]){let n,o,i,s=t,a,l,d;if(this.tokens.links){let c=Object.keys(this.tokens.links);if(c.length>0)for(;(a=this.tokenizer.rules.inline.reflinkSearch.exec(s))!=null;)c.includes(a[0].slice(a[0].lastIndexOf("[")+1,-1))&&(s=s.slice(0,a.index)+"["+"a".repeat(a[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(a=this.tokenizer.rules.inline.blockSkip.exec(s))!=null;)s=s.slice(0,a.index)+"["+"a".repeat(a[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(a=this.tokenizer.rules.inline.anyPunctuation.exec(s))!=null;)s=s.slice(0,a.index)+"++"+s.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;t;)if(l||(d=""),l=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(c=>(n=c.call({lexer:this},t,e))?(t=t.substring(n.raw.length),e.push(n),!0):!1))){if(n=this.tokenizer.escape(t)){t=t.substring(n.raw.length),e.push(n);continue}if(n=this.tokenizer.tag(t)){t=t.substring(n.raw.length),o=e[e.length-1],o&&n.type==="text"&&o.type==="text"?(o.raw+=n.raw,o.text+=n.text):e.push(n);continue}if(n=this.tokenizer.link(t)){t=t.substring(n.raw.length),e.push(n);continue}if(n=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(n.raw.length),o=e[e.length-1],o&&n.type==="text"&&o.type==="text"?(o.raw+=n.raw,o.text+=n.text):e.push(n);continue}if(n=this.tokenizer.emStrong(t,s,d)){t=t.substring(n.raw.length),e.push(n);continue}if(n=this.tokenizer.codespan(t)){t=t.substring(n.raw.length),e.push(n);continue}if(n=this.tokenizer.br(t)){t=t.substring(n.raw.length),e.push(n);continue}if(n=this.tokenizer.del(t)){t=t.substring(n.raw.length),e.push(n);continue}if(n=this.tokenizer.autolink(t)){t=t.substring(n.raw.length),e.push(n);continue}if(!this.state.inLink&&(n=this.tokenizer.url(t))){t=t.substring(n.raw.length),e.push(n);continue}if(i=t,this.options.extensions&&this.options.extensions.startInline){let c=1/0,u=t.slice(1),m;this.options.extensions.startInline.forEach(g=>{m=g.call({lexer:this},u),typeof m=="number"&&m>=0&&(c=Math.min(c,m))}),c<1/0&&c>=0&&(i=t.substring(0,c+1))}if(n=this.tokenizer.inlineText(i)){t=t.substring(n.raw.length),n.raw.slice(-1)!=="_"&&(d=n.raw.slice(-1)),l=!0,o=e[e.length-1],o&&o.type==="text"?(o.raw+=n.raw,o.text+=n.text):e.push(n);continue}if(t){let c="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(c);break}else throw new Error(c)}}return e}},Dp=class{options;parser;constructor(t){this.options=t||bc}space(t){return""}code({text:t,lang:e,escaped:n}){let o=(e||"").match(/^\S*/)?.[0],i=t.replace(/\n$/,"")+`
`;return o?'<pre><code class="language-'+Ar(o)+'">'+(n?i:Ar(i,!0))+`</code></pre>
`:"<pre><code>"+(n?i:Ar(i,!0))+`</code></pre>
`}blockquote({tokens:t}){return`<blockquote>
${this.parser.parse(t)}</blockquote>
`}html({text:t}){return t}heading({tokens:t,depth:e}){return`<h${e}>${this.parser.parseInline(t)}</h${e}>
`}hr(t){return`<hr>
`}list(t){let e=t.ordered,n=t.start,o="";for(let a=0;a<t.items.length;a++){let l=t.items[a];o+=this.listitem(l)}let i=e?"ol":"ul",s=e&&n!==1?' start="'+n+'"':"";return"<"+i+s+`>
`+o+"</"+i+`>
`}listitem(t){let e="";if(t.task){let n=this.checkbox({checked:!!t.checked});t.loose?t.tokens.length>0&&t.tokens[0].type==="paragraph"?(t.tokens[0].text=n+" "+t.tokens[0].text,t.tokens[0].tokens&&t.tokens[0].tokens.length>0&&t.tokens[0].tokens[0].type==="text"&&(t.tokens[0].tokens[0].text=n+" "+t.tokens[0].tokens[0].text)):t.tokens.unshift({type:"text",raw:n+" ",text:n+" "}):e+=n+" "}return e+=this.parser.parse(t.tokens,!!t.loose),`<li>${e}</li>
`}checkbox({checked:t}){return"<input "+(t?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:t}){return`<p>${this.parser.parseInline(t)}</p>
`}table(t){let e="",n="";for(let i=0;i<t.header.length;i++)n+=this.tablecell(t.header[i]);e+=this.tablerow({text:n});let o="";for(let i=0;i<t.rows.length;i++){let s=t.rows[i];n="";for(let a=0;a<s.length;a++)n+=this.tablecell(s[a]);o+=this.tablerow({text:n})}return o&&(o=`<tbody>${o}</tbody>`),`<table>
<thead>
`+e+`</thead>
`+o+`</table>
`}tablerow({text:t}){return`<tr>
${t}</tr>
`}tablecell(t){let e=this.parser.parseInline(t.tokens),n=t.header?"th":"td";return(t.align?`<${n} align="${t.align}">`:`<${n}>`)+e+`</${n}>
`}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${t}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:e,tokens:n}){let o=this.parser.parseInline(n),i=P2(t);if(i===null)return o;t=i;let s='<a href="'+t+'"';return e&&(s+=' title="'+e+'"'),s+=">"+o+"</a>",s}image({href:t,title:e,text:n}){let o=P2(t);if(o===null)return n;t=o;let i=`<img src="${t}" alt="${n}"`;return e&&(i+=` title="${e}"`),i+=">",i}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):t.text}},ev=class{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}},ua=class r{options;renderer;textRenderer;constructor(t){this.options=t||bc,this.options.renderer=this.options.renderer||new Dp,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new ev}static parse(t,e){return new r(e).parse(t)}static parseInline(t,e){return new r(e).parseInline(t)}parse(t,e=!0){let n="";for(let o=0;o<t.length;o++){let i=t[o];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[i.type]){let a=i,l=this.options.extensions.renderers[a.type].call({parser:this},a);if(l!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(a.type)){n+=l||"";continue}}let s=i;switch(s.type){case"space":{n+=this.renderer.space(s);continue}case"hr":{n+=this.renderer.hr(s);continue}case"heading":{n+=this.renderer.heading(s);continue}case"code":{n+=this.renderer.code(s);continue}case"table":{n+=this.renderer.table(s);continue}case"blockquote":{n+=this.renderer.blockquote(s);continue}case"list":{n+=this.renderer.list(s);continue}case"html":{n+=this.renderer.html(s);continue}case"paragraph":{n+=this.renderer.paragraph(s);continue}case"text":{let a=s,l=this.renderer.text(a);for(;o+1<t.length&&t[o+1].type==="text";)a=t[++o],l+=`
`+this.renderer.text(a);e?n+=this.renderer.paragraph({type:"paragraph",raw:l,text:l,tokens:[{type:"text",raw:l,text:l}]}):n+=l;continue}default:{let a='Token with "'+s.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return n}parseInline(t,e){e=e||this.renderer;let n="";for(let o=0;o<t.length;o++){let i=t[o];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[i.type]){let a=this.options.extensions.renderers[i.type].call({parser:this},i);if(a!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(i.type)){n+=a||"";continue}}let s=i;switch(s.type){case"escape":{n+=e.text(s);break}case"html":{n+=e.html(s);break}case"link":{n+=e.link(s);break}case"image":{n+=e.image(s);break}case"strong":{n+=e.strong(s);break}case"em":{n+=e.em(s);break}case"codespan":{n+=e.codespan(s);break}case"br":{n+=e.br(s);break}case"del":{n+=e.del(s);break}case"text":{n+=e.text(s);break}default:{let a='Token with "'+s.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return n}},Pp=class{options;constructor(t){this.options=t||bc}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}},SR=class{defaults=CR();options=this.setOptions;parse=this.parseMarkdown(ca.lex,ua.parse);parseInline=this.parseMarkdown(ca.lexInline,ua.parseInline);Parser=ua;Renderer=Dp;TextRenderer=ev;Lexer=ca;Tokenizer=_p;Hooks=Pp;constructor(...t){this.use(...t)}walkTokens(t,e){let n=[];for(let o of t)switch(n=n.concat(e.call(this,o)),o.type){case"table":{let i=o;for(let s of i.header)n=n.concat(this.walkTokens(s.tokens,e));for(let s of i.rows)for(let a of s)n=n.concat(this.walkTokens(a.tokens,e));break}case"list":{let i=o;n=n.concat(this.walkTokens(i.items,e));break}default:{let i=o;this.defaults.extensions?.childTokens?.[i.type]?this.defaults.extensions.childTokens[i.type].forEach(s=>{let a=i[s].flat(1/0);n=n.concat(this.walkTokens(a,e))}):i.tokens&&(n=n.concat(this.walkTokens(i.tokens,e)))}}return n}use(...t){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(n=>{let o={...n};if(o.async=this.defaults.async||o.async||!1,n.extensions&&(n.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let s=e.renderers[i.name];s?e.renderers[i.name]=function(...a){let l=i.renderer.apply(this,a);return l===!1&&(l=s.apply(this,a)),l}:e.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let s=e[i.level];s?s.unshift(i.tokenizer):e[i.level]=[i.tokenizer],i.start&&(i.level==="block"?e.startBlock?e.startBlock.push(i.start):e.startBlock=[i.start]:i.level==="inline"&&(e.startInline?e.startInline.push(i.start):e.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(e.childTokens[i.name]=i.childTokens)}),o.extensions=e),n.renderer){let i=this.defaults.renderer||new Dp(this.defaults);for(let s in n.renderer){if(!(s in i))throw new Error(`renderer '${s}' does not exist`);if(["options","parser"].includes(s))continue;let a=s,l=n.renderer[a],d=i[a];i[a]=(...c)=>{let u=l.apply(i,c);return u===!1&&(u=d.apply(i,c)),u||""}}o.renderer=i}if(n.tokenizer){let i=this.defaults.tokenizer||new _p(this.defaults);for(let s in n.tokenizer){if(!(s in i))throw new Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;let a=s,l=n.tokenizer[a],d=i[a];i[a]=(...c)=>{let u=l.apply(i,c);return u===!1&&(u=d.apply(i,c)),u}}o.tokenizer=i}if(n.hooks){let i=this.defaults.hooks||new Pp;for(let s in n.hooks){if(!(s in i))throw new Error(`hook '${s}' does not exist`);if(s==="options")continue;let a=s,l=n.hooks[a],d=i[a];Pp.passThroughHooks.has(s)?i[a]=c=>{if(this.defaults.async)return Promise.resolve(l.call(i,c)).then(m=>d.call(i,m));let u=l.call(i,c);return d.call(i,u)}:i[a]=(...c)=>{let u=l.apply(i,c);return u===!1&&(u=d.apply(i,c)),u}}o.hooks=i}if(n.walkTokens){let i=this.defaults.walkTokens,s=n.walkTokens;o.walkTokens=function(a){let l=[];return l.push(s.call(this,a)),i&&(l=l.concat(i.call(this,a))),l}}this.defaults={...this.defaults,...o}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,e){return ca.lex(t,e??this.defaults)}parser(t,e){return ua.parse(t,e??this.defaults)}parseMarkdown(t,e){return(o,i)=>{let s={...i},a={...this.defaults,...s},l=this.onError(!!a.silent,!!a.async);if(this.defaults.async===!0&&s.async===!1)return l(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof o>"u"||o===null)return l(new Error("marked(): input parameter is undefined or null"));if(typeof o!="string")return l(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(o)+", string expected"));if(a.hooks&&(a.hooks.options=a),a.async)return Promise.resolve(a.hooks?a.hooks.preprocess(o):o).then(d=>t(d,a)).then(d=>a.hooks?a.hooks.processAllTokens(d):d).then(d=>a.walkTokens?Promise.all(this.walkTokens(d,a.walkTokens)).then(()=>d):d).then(d=>e(d,a)).then(d=>a.hooks?a.hooks.postprocess(d):d).catch(l);try{a.hooks&&(o=a.hooks.preprocess(o));let d=t(o,a);a.hooks&&(d=a.hooks.processAllTokens(d)),a.walkTokens&&this.walkTokens(d,a.walkTokens);let c=e(d,a);return a.hooks&&(c=a.hooks.postprocess(c)),c}catch(d){return l(d)}}}onError(t,e){return n=>{if(n.message+=`
Please report this to https://github.com/markedjs/marked.`,t){let o="<p>An error occurred:</p><pre>"+Ar(n.message+"",!0)+"</pre>";return e?Promise.resolve(o):o}if(e)return Promise.reject(n);throw n}}},vc=new SR;function $t(r,t){return vc.parse(r,t)}$t.options=$t.setOptions=function(r){return vc.setOptions(r),$t.defaults=vc.defaults,A2($t.defaults),$t};$t.getDefaults=CR;$t.defaults=bc;$t.use=function(...r){return vc.use(...r),$t.defaults=vc.defaults,A2($t.defaults),$t};$t.walkTokens=function(r,t){return vc.walkTokens(r,t)};$t.parseInline=vc.parseInline;$t.Parser=ua;$t.parser=ua.parse;$t.Renderer=Dp;$t.TextRenderer=ev;$t.Lexer=ca;$t.lexer=ca.lex;$t.Tokenizer=_p;$t.Hooks=Pp;$t.parse=$t;var zre=$t.options,qre=$t.setOptions,Kre=$t.use,jre=$t.walkTokens,Gre=$t.parseInline;var Qre=ua.parse,Jre=ca.lex;var Fo=Object.freeze({text:"text/plain",binary:"application/octet-stream",unknown:"application/unknown",markdown:"text/markdown",latex:"text/latex",uriList:"text/uri-list",html:"text/html"});var B2={".aac":"audio/x-aac",".avi":"video/x-msvideo",".bmp":"image/bmp",".flv":"video/x-flv",".gif":"image/gif",".ico":"image/x-icon",".jpe":["image/jpg","image/jpeg"],".jpeg":["image/jpg","image/jpeg"],".jpg":["image/jpg","image/jpeg"],".m1v":"video/mpeg",".m2a":"audio/mpeg",".m2v":"video/mpeg",".m3a":"audio/mpeg",".mid":"audio/midi",".midi":"audio/midi",".mk3d":"video/x-matroska",".mks":"video/x-matroska",".mkv":"video/x-matroska",".mov":"video/quicktime",".movie":"video/x-sgi-movie",".mp2":"audio/mpeg",".mp2a":"audio/mpeg",".mp3":"audio/mpeg",".mp4":"video/mp4",".mp4a":"audio/mp4",".mp4v":"video/mp4",".mpe":"video/mpeg",".mpeg":"video/mpeg",".mpg":"video/mpeg",".mpg4":"video/mp4",".mpga":"audio/mpeg",".oga":"audio/ogg",".ogg":"audio/ogg",".opus":"audio/opus",".ogv":"video/ogg",".png":"image/png",".psd":"image/vnd.adobe.photoshop",".qt":"video/quicktime",".spx":"audio/ogg",".svg":"image/svg+xml",".tga":"image/x-tga",".tif":"image/tiff",".tiff":"image/tiff",".wav":"audio/x-wav",".webm":"video/webm",".webp":"image/webp",".wma":"audio/x-ms-wma",".wmv":"video/x-ms-wmv",".woff":"application/font-woff"};function _R(r){for(let t in B2){let e=B2[t];if(Array.isArray(e)?e.includes(r):e===r)return t}}var S7=/^(.+)\/(.+?)(;.+)?$/;function DR(r,t){let e=S7.exec(r);return e?`${e[1].toLowerCase()}/${e[2].toLowerCase()}${e[3]??""}`:t?void 0:r}function fx(r){return["application/vnd.code.notebook.stdout","application/vnd.code.notebook.stderr"].includes(r)}var Ho=Symbol("unset"),hx=class{constructor(){this.root=new ov;this._size=0}get size(){return this._size}get nodes(){return this.root.children?.values()||Nt.empty()}get entries(){return this.root.children?.entries()||Nt.empty()}insert(t,e,n){this.opNode(t,o=>o._value=e,n)}mutate(t,e){this.opNode(t,n=>n._value=e(n._value===Ho?void 0:n._value))}mutatePath(t,e){this.opNode(t,()=>{},n=>e(n))}delete(t){let e=this.getPathToKey(t);if(!e)return;let n=e.length-1,o=e[n].node._value;if(o!==Ho){for(this._size--,e[n].node._value=Ho;n>0;n--){let{node:i,part:s}=e[n];if(i.children?.size||i._value!==Ho)break;e[n-1].node.children.delete(s)}return o}}*deleteRecursive(t){let e=this.getPathToKey(t);if(!e)return;let n=e[e.length-1].node;for(let o=e.length-1;o>0;o--){let i=e[o-1];if(i.node.children.delete(e[o].part),i.node.children.size>0||i.node._value!==Ho)break}for(let o of $2(n))o._value!==Ho&&(this._size--,yield o._value);n===this.root&&(this.root._value=Ho,this.root.children=void 0)}find(t){let e=this.root;for(let n of t){let o=e.children?.get(n);if(!o)return;e=o}return e._value===Ho?void 0:e._value}hasKeyOrParent(t){let e=this.root;for(let n of t){let o=e.children?.get(n);if(!o)return!1;if(o._value!==Ho)return!0;e=o}return!1}hasKeyOrChildren(t){let e=this.root;for(let n of t){let o=e.children?.get(n);if(!o)return!1;e=o}return!0}hasKey(t){let e=this.root;for(let n of t){let o=e.children?.get(n);if(!o)return!1;e=o}return e._value!==Ho}getPathToKey(t){let e=[{part:"",node:this.root}],n=0;for(let o of t){let i=e[n].node.children?.get(o);if(!i)return;e.push({part:o,node:i}),n++}return e}opNode(t,e,n){let o=this.root;for(let a of t){if(o.children)if(o.children.has(a))o=o.children.get(a);else{let l=new ov;o.children.set(a,l),o=l}else{let l=new ov;o.children=new Map([[a,l]]),o=l}n?.(o)}let i=o._value===Ho?0:1;e(o);let s=o._value===Ho?0:1;this._size+=s-i}*values(){for(let{_value:t}of $2(this.root))t!==Ho&&(yield t)}};function*$2(r){let t=[r];for(;t.length>0;){let e=t.pop();if(yield e,e.children)for(let n of e.children.values())t.push(n)}}var ov=class{constructor(){this._value=Ho}get value(){return this._value===Ho?void 0:this._value}set value(t){this._value=t===void 0?Ho:t}};var An=class r{constructor(t,e){this.lineNumber=t,this.column=e}with(t=this.lineNumber,e=this.column){return t===this.lineNumber&&e===this.column?this:new r(t,e)}delta(t=0,e=0){return this.with(Math.max(1,this.lineNumber+t),Math.max(1,this.column+e))}equals(t){return r.equals(this,t)}static equals(t,e){return!t&&!e?!0:!!t&&!!e&&t.lineNumber===e.lineNumber&&t.column===e.column}isBefore(t){return r.isBefore(this,t)}static isBefore(t,e){return t.lineNumber<e.lineNumber?!0:e.lineNumber<t.lineNumber?!1:t.column<e.column}isBeforeOrEqual(t){return r.isBeforeOrEqual(this,t)}static isBeforeOrEqual(t,e){return t.lineNumber<e.lineNumber?!0:e.lineNumber<t.lineNumber?!1:t.column<=e.column}static compare(t,e){let n=t.lineNumber|0,o=e.lineNumber|0;if(n===o){let i=t.column|0,s=e.column|0;return i-s}return n-o}clone(){return new r(this.lineNumber,this.column)}toString(){return"("+this.lineNumber+","+this.column+")"}static lift(t){return new r(t.lineNumber,t.column)}static isIPosition(t){return!!t&&typeof t.lineNumber=="number"&&typeof t.column=="number"}toJSON(){return{lineNumber:this.lineNumber,column:this.column}}};var We=class r{constructor(t,e,n,o){t>n||t===n&&e>o?(this.startLineNumber=n,this.startColumn=o,this.endLineNumber=t,this.endColumn=e):(this.startLineNumber=t,this.startColumn=e,this.endLineNumber=n,this.endColumn=o)}isEmpty(){return r.isEmpty(this)}static isEmpty(t){return t.startLineNumber===t.endLineNumber&&t.startColumn===t.endColumn}containsPosition(t){return r.containsPosition(this,t)}static containsPosition(t,e){return!(e.lineNumber<t.startLineNumber||e.lineNumber>t.endLineNumber||e.lineNumber===t.startLineNumber&&e.column<t.startColumn||e.lineNumber===t.endLineNumber&&e.column>t.endColumn)}static strictContainsPosition(t,e){return!(e.lineNumber<t.startLineNumber||e.lineNumber>t.endLineNumber||e.lineNumber===t.startLineNumber&&e.column<=t.startColumn||e.lineNumber===t.endLineNumber&&e.column>=t.endColumn)}containsRange(t){return r.containsRange(this,t)}static containsRange(t,e){return!(e.startLineNumber<t.startLineNumber||e.endLineNumber<t.startLineNumber||e.startLineNumber>t.endLineNumber||e.endLineNumber>t.endLineNumber||e.startLineNumber===t.startLineNumber&&e.startColumn<t.startColumn||e.endLineNumber===t.endLineNumber&&e.endColumn>t.endColumn)}strictContainsRange(t){return r.strictContainsRange(this,t)}static strictContainsRange(t,e){return!(e.startLineNumber<t.startLineNumber||e.endLineNumber<t.startLineNumber||e.startLineNumber>t.endLineNumber||e.endLineNumber>t.endLineNumber||e.startLineNumber===t.startLineNumber&&e.startColumn<=t.startColumn||e.endLineNumber===t.endLineNumber&&e.endColumn>=t.endColumn)}plusRange(t){return r.plusRange(this,t)}static plusRange(t,e){let n,o,i,s;return e.startLineNumber<t.startLineNumber?(n=e.startLineNumber,o=e.startColumn):e.startLineNumber===t.startLineNumber?(n=e.startLineNumber,o=Math.min(e.startColumn,t.startColumn)):(n=t.startLineNumber,o=t.startColumn),e.endLineNumber>t.endLineNumber?(i=e.endLineNumber,s=e.endColumn):e.endLineNumber===t.endLineNumber?(i=e.endLineNumber,s=Math.max(e.endColumn,t.endColumn)):(i=t.endLineNumber,s=t.endColumn),new r(n,o,i,s)}intersectRanges(t){return r.intersectRanges(this,t)}static intersectRanges(t,e){let n=t.startLineNumber,o=t.startColumn,i=t.endLineNumber,s=t.endColumn,a=e.startLineNumber,l=e.startColumn,d=e.endLineNumber,c=e.endColumn;return n<a?(n=a,o=l):n===a&&(o=Math.max(o,l)),i>d?(i=d,s=c):i===d&&(s=Math.min(s,c)),n>i||n===i&&o>s?null:new r(n,o,i,s)}equalsRange(t){return r.equalsRange(this,t)}static equalsRange(t,e){return!t&&!e?!0:!!t&&!!e&&t.startLineNumber===e.startLineNumber&&t.startColumn===e.startColumn&&t.endLineNumber===e.endLineNumber&&t.endColumn===e.endColumn}getEndPosition(){return r.getEndPosition(this)}static getEndPosition(t){return new An(t.endLineNumber,t.endColumn)}getStartPosition(){return r.getStartPosition(this)}static getStartPosition(t){return new An(t.startLineNumber,t.startColumn)}toString(){return"["+this.startLineNumber+","+this.startColumn+" -> "+this.endLineNumber+","+this.endColumn+"]"}setEndPosition(t,e){return new r(this.startLineNumber,this.startColumn,t,e)}setStartPosition(t,e){return new r(t,e,this.endLineNumber,this.endColumn)}collapseToStart(){return r.collapseToStart(this)}static collapseToStart(t){return new r(t.startLineNumber,t.startColumn,t.startLineNumber,t.startColumn)}collapseToEnd(){return r.collapseToEnd(this)}static collapseToEnd(t){return new r(t.endLineNumber,t.endColumn,t.endLineNumber,t.endColumn)}delta(t){return new r(this.startLineNumber+t,this.startColumn,this.endLineNumber+t,this.endColumn)}isSingleLine(){return this.startLineNumber===this.endLineNumber}static fromPositions(t,e=t){return new r(t.lineNumber,t.column,e.lineNumber,e.column)}static lift(t){return t?new r(t.startLineNumber,t.startColumn,t.endLineNumber,t.endColumn):null}static isIRange(t){return!!t&&typeof t.startLineNumber=="number"&&typeof t.startColumn=="number"&&typeof t.endLineNumber=="number"&&typeof t.endColumn=="number"}static areIntersectingOrTouching(t,e){return!(t.endLineNumber<e.startLineNumber||t.endLineNumber===e.startLineNumber&&t.endColumn<e.startColumn||e.endLineNumber<t.startLineNumber||e.endLineNumber===t.startLineNumber&&e.endColumn<t.startColumn)}static areIntersecting(t,e){return!(t.endLineNumber<e.startLineNumber||t.endLineNumber===e.startLineNumber&&t.endColumn<=e.startColumn||e.endLineNumber<t.startLineNumber||e.endLineNumber===t.startLineNumber&&e.endColumn<=t.startColumn)}static areOnlyIntersecting(t,e){return!(t.endLineNumber<e.startLineNumber-1||t.endLineNumber===e.startLineNumber&&t.endColumn<e.startColumn-1||e.endLineNumber<t.startLineNumber-1||e.endLineNumber===t.startLineNumber&&e.endColumn<t.startColumn-1)}static compareRangesUsingStarts(t,e){if(t&&e){let i=t.startLineNumber|0,s=e.startLineNumber|0;if(i===s){let a=t.startColumn|0,l=e.startColumn|0;if(a===l){let d=t.endLineNumber|0,c=e.endLineNumber|0;if(d===c){let u=t.endColumn|0,m=e.endColumn|0;return u-m}return d-c}return a-l}return i-s}return(t?1:0)-(e?1:0)}static compareRangesUsingEnds(t,e){return t.endLineNumber===e.endLineNumber?t.endColumn===e.endColumn?t.startLineNumber===e.startLineNumber?t.startColumn-e.startColumn:t.startLineNumber-e.startLineNumber:t.endColumn-e.endColumn:t.endLineNumber-e.endLineNumber}static spansMultipleLines(t){return t.endLineNumber>t.startLineNumber}toJSON(){return this}};var vx=class{constructor(){this._tokenizationSupports=new Map;this._factories=new Map;this._onDidChange=new E;this.onDidChange=this._onDidChange.event;this._colorMap=null}handleChange(t){this._onDidChange.fire({changedLanguages:t,changedColorMap:!1})}register(t,e){return this._tokenizationSupports.set(t,e),this.handleChange([t]),K(()=>{this._tokenizationSupports.get(t)===e&&(this._tokenizationSupports.delete(t),this.handleChange([t]))})}get(t){return this._tokenizationSupports.get(t)||null}registerFactory(t,e){this._factories.get(t)?.dispose();let n=new RR(this,t,e);return this._factories.set(t,n),K(()=>{let o=this._factories.get(t);!o||o!==n||(this._factories.delete(t),o.dispose())})}async getOrCreate(t){let e=this.get(t);if(e)return e;let n=this._factories.get(t);return!n||n.isResolved?null:(await n.resolve(),this.get(t))}isResolved(t){if(this.get(t))return!0;let n=this._factories.get(t);return!!(!n||n.isResolved)}setColorMap(t){this._colorMap=t,this._onDidChange.fire({changedLanguages:Array.from(this._tokenizationSupports.keys()),changedColorMap:!0})}getColorMap(){return this._colorMap}getDefaultBackground(){return this._colorMap&&this._colorMap.length>2?this._colorMap[2]:null}},RR=class extends O{constructor(e,n,o){super();this._registry=e;this._languageId=n;this._factory=o;this._isDisposed=!1;this._resolvePromise=null;this._isResolved=!1}get isResolved(){return this._isResolved}dispose(){this._isDisposed=!0,super.dispose()}async resolve(){return this._resolvePromise||(this._resolvePromise=this._create()),this._resolvePromise}async _create(){let e=await this._factory.tokenizationSupport;this._isResolved=!0,e&&!this._isDisposed&&this._register(this._registry.register(this._languageId,e))}};var T7;(i=>{let r=new Map;r.set(0,ce.symbolMethod),r.set(1,ce.symbolFunction),r.set(2,ce.symbolConstructor),r.set(3,ce.symbolField),r.set(4,ce.symbolVariable),r.set(5,ce.symbolClass),r.set(6,ce.symbolStruct),r.set(7,ce.symbolInterface),r.set(8,ce.symbolModule),r.set(9,ce.symbolProperty),r.set(10,ce.symbolEvent),r.set(11,ce.symbolOperator),r.set(12,ce.symbolUnit),r.set(13,ce.symbolValue),r.set(15,ce.symbolEnum),r.set(14,ce.symbolConstant),r.set(15,ce.symbolEnum),r.set(16,ce.symbolEnumMember),r.set(17,ce.symbolKeyword),r.set(28,ce.symbolSnippet),r.set(18,ce.symbolText),r.set(19,ce.symbolColor),r.set(20,ce.symbolFile),r.set(21,ce.symbolReference),r.set(22,ce.symbolCustomColor),r.set(23,ce.symbolFolder),r.set(24,ce.symbolTypeParameter),r.set(25,ce.account),r.set(26,ce.issues),r.set(27,ce.tools);function t(s){let a=r.get(s);return a||(console.info("No codicon found for CompletionItemKind "+s),a=ce.symbolProperty),a}i.toIcon=t;function e(s){switch(s){case 0:return p(891,null);case 1:return p(887,null);case 2:return p(879,null);case 3:return p(884,null);case 4:return p(904,null);case 5:return p(876,null);case 6:return p(897,null);case 7:return p(888,null);case 8:return p(892,null);case 9:return p(894,null);case 10:return p(883,null);case 11:return p(893,null);case 12:return p(901,null);case 13:return p(903,null);case 14:return p(878,null);case 15:return p(881,null);case 16:return p(882,null);case 17:return p(890,null);case 18:return p(898,null);case 19:return p(877,null);case 20:return p(885,null);case 21:return p(895,null);case 22:return p(880,null);case 23:return p(886,null);case 24:return p(900,null);case 25:return p(902,null);case 26:return p(889,null);case 27:return p(899,null);case 28:return p(896,null);default:return""}}i.toLabel=e;let n=new Map;n.set("method",0),n.set("function",1),n.set("constructor",2),n.set("field",3),n.set("variable",4),n.set("class",5),n.set("struct",6),n.set("interface",7),n.set("module",8),n.set("property",9),n.set("event",10),n.set("operator",11),n.set("unit",12),n.set("value",13),n.set("constant",14),n.set("enum",15),n.set("enum-member",16),n.set("enumMember",16),n.set("keyword",17),n.set("snippet",28),n.set("text",18),n.set("color",19),n.set("file",20),n.set("reference",21),n.set("customcolor",22),n.set("folder",23),n.set("type-parameter",24),n.set("typeParameter",24),n.set("account",25),n.set("issue",26),n.set("tool",27);function o(s,a){let l=n.get(s);return typeof l>"u"&&!a&&(l=9),l}i.fromString=o})(T7||={});function q2(r){return!!r&&b.isUri(r.uri)&&We.isIRange(r.range)&&(We.isIRange(r.originSelectionRange)||We.isIRange(r.targetSelectionRange))}function K2(r){return!!r&&b.isUri(r.uri)&&We.isIRange(r.range)}var Tie={17:p(852,null),16:p(853,null),4:p(854,null),13:p(855,null),8:p(856,null),9:p(857,null),21:p(858,null),23:p(859,null),7:p(860,null),0:p(861,null),11:p(862,null),10:p(863,null),19:p(864,null),5:p(865,null),1:p(866,null),2:p(867,null),20:p(868,null),15:p(869,null),18:p(870,null),24:p(871,null),3:p(872,null),6:p(873,null),14:p(874,null),22:p(875,null),25:p(906,null),12:p(907,null)};var AR;(o=>{let r=new Map;r.set(0,ce.symbolFile),r.set(1,ce.symbolModule),r.set(2,ce.symbolNamespace),r.set(3,ce.symbolPackage),r.set(4,ce.symbolClass),r.set(5,ce.symbolMethod),r.set(6,ce.symbolProperty),r.set(7,ce.symbolField),r.set(8,ce.symbolConstructor),r.set(9,ce.symbolEnum),r.set(10,ce.symbolInterface),r.set(11,ce.symbolFunction),r.set(12,ce.symbolVariable),r.set(13,ce.symbolConstant),r.set(14,ce.symbolString),r.set(15,ce.symbolNumber),r.set(16,ce.symbolBoolean),r.set(17,ce.symbolArray),r.set(18,ce.symbolObject),r.set(19,ce.symbolKey),r.set(20,ce.symbolNull),r.set(21,ce.symbolEnumMember),r.set(22,ce.symbolStruct),r.set(23,ce.symbolEvent),r.set(24,ce.symbolOperator),r.set(25,ce.symbolTypeParameter);function t(i){let s=r.get(i);return s||(console.info("No codicon found for SymbolKind "+i),s=ce.symbolProperty),s}o.toIcon=t;let e=new Map;e.set(0,20),e.set(1,8),e.set(2,8),e.set(3,8),e.set(4,5),e.set(5,0),e.set(6,9),e.set(7,3),e.set(8,2),e.set(9,15),e.set(10,7),e.set(11,1),e.set(12,4),e.set(13,14),e.set(14,18),e.set(15,13),e.set(16,13),e.set(17,13),e.set(18,13),e.set(19,17),e.set(20,13),e.set(21,16),e.set(22,6),e.set(23,10),e.set(24,11),e.set(25,24);function n(i){let s=e.get(i);return s===void 0&&(console.info("No completion kind found for SymbolKind "+i),s=20),s}o.toCompletionKind=n})(AR||={});var pa=class r{constructor(t){this.value=t}static{this.Comment=new r("comment")}static{this.Imports=new r("imports")}static{this.Region=new r("region")}static fromValue(t){switch(t){case"comment":return r.Comment;case"imports":return r.Imports;case"region":return r.Region}return new r(t)}};var MR;(t=>{function r(e){return!e||typeof e!="object"?!1:typeof e.id=="string"&&typeof e.title=="string"}t.is=r})(MR||={});var Eie=new vx;var LR=(o=>(o[o.Left=1]="Left",o[o.Center=2]="Center",o[o.Right=4]="Right",o[o.Full=7]="Full",o))(LR||{});var yc=class{constructor(t,e){this._findMatchBrand=void 0;this.range=t,this.matches=e}};var yx=class{constructor(t,e,n){this.regex=t,this.wordSeparators=e,this.simpleSearch=n}},Ix=class{constructor(t,e,n){this.reverseEdits=t;this.changes=e;this.trimAutoWhitespaceLineNumbers=n}};var Rp=(o=>(o[o.Hint=1]="Hint",o[o.Info=2]="Info",o[o.Warning=4]="Warning",o[o.Error=8]="Error",o))(Rp||{});(a=>{function r(l,d){return d-l}a.compare=r;let t=Object.create(null);t[8]=p(2215,null),t[4]=p(2219,null),t[2]=p(2217,null);function e(l){return t[l]||""}a.toString=e;let n=Object.create(null);n[8]=p(2216,null),n[4]=p(2220,null),n[2]=p(2218,null);function o(l){return n[l]||""}a.toStringPlural=o;function i(l){switch(l){case Xe.Error:return 8;case Xe.Warning:return 4;case Xe.Info:return 2;case Xe.Ignore:return 1}}a.fromSeverity=i;function s(l){switch(l){case 8:return Xe.Error;case 4:return Xe.Warning;case 2:return Xe.Info;case 1:return Xe.Ignore}}a.toSeverity=s})(Rp||={});var E7;(n=>{function t(o){return e(o,!0)}n.makeKey=t;function e(o,i){let s=[""];return o.source?s.push(o.source.replace("\xA6","\\\xA6")):s.push(""),o.code?typeof o.code=="string"?s.push(o.code.replace("\xA6","\\\xA6")):s.push(o.code.value.replace("\xA6","\\\xA6")):s.push(""),o.severity!==void 0&&o.severity!==null?s.push(Rp.toString(o.severity)):s.push(""),o.message&&i?s.push(o.message.replace("\xA6","\\\xA6")):s.push(""),o.startLineNumber!==void 0&&o.startLineNumber!==null?s.push(o.startLineNumber.toString()):s.push(""),o.startColumn!==void 0&&o.startColumn!==null?s.push(o.startColumn.toString()):s.push(""),o.endLineNumber!==void 0&&o.endLineNumber!==null?s.push(o.endLineNumber.toString()):s.push(""),o.endColumn!==void 0&&o.endColumn!==null?s.push(o.endColumn.toString()):s.push(""),s.push(""),s.join("\xA6")}n.makeKeyOptionalMessage=e})(E7||={});var Rie=R("markerService");var w7=R("progressService");var Fie=Object.freeze({total(){},worked(){},done(){}}),us=class{constructor(t){this.callback=t}static{this.None=Object.freeze({report(){}})}get value(){return this._value}report(t){this._value=t,this.callback(this._value)}},xx=class extends O{constructor(e,n){super();this.deferred=new Jt;n.withProgress(e,o=>(this.reporter=o,this.lastStep&&o.report(this.lastStep),this.deferred.p)),this._register(K(()=>this.deferred.complete()))}report(e){this.reporter?this.reporter.report(e):this.lastStep=e}};xx=_([C(1,w7)],xx);var Hie=R("editorProgressService");var OR=class{constructor(){this.data=new Map}add(t,e){qn(De(t)),qn(it(e)),qn(!this.data.has(t),"There is already an extension with this id"),this.data.set(t,e)}knows(t){return this.data.has(t)}as(t){return this.data.get(t)||null}dispose(){this.data.forEach(t=>{$y(t.dispose)&&t.dispose()}),this.data.clear()}},vt=new OR;var NR=class extends O{constructor(e,n="",o="",i=!0,s){super();this._onDidChange=this._register(new E);this._enabled=!0;this._id=e,this._label=n,this._cssClass=o,this._enabled=i,this._actionCallback=s}get onDidChange(){return this._onDidChange.event}get id(){return this._id}get label(){return this._label}set label(e){this._setLabel(e)}_setLabel(e){this._label!==e&&(this._label=e,this._onDidChange.fire({label:e}))}get tooltip(){return this._tooltip||""}set tooltip(e){this._setTooltip(e)}_setTooltip(e){this._tooltip!==e&&(this._tooltip=e,this._onDidChange.fire({tooltip:e}))}get class(){return this._cssClass}set class(e){this._setClass(e)}_setClass(e){this._cssClass!==e&&(this._cssClass=e,this._onDidChange.fire({class:e}))}get enabled(){return this._enabled}set enabled(e){this._setEnabled(e)}_setEnabled(e){this._enabled!==e&&(this._enabled=e,this._onDidChange.fire({enabled:e}))}get checked(){return this._checked}set checked(e){this._setChecked(e)}_setChecked(e){this._checked!==e&&(this._checked=e,this._onDidChange.fire({checked:e}))}async run(e,n){this._actionCallback&&await this._actionCallback(e)}};var G2=class r{constructor(){this.id=r.ID;this.label="";this.tooltip="";this.class="separator";this.enabled=!1;this.checked=void 0}static join(...t){let e=[];for(let n of t)n.length&&(e.length?e=[...e,new r,...n]:e=n);return e}static clean(t){for(;t.length>0&&t[0].id===r.ID;)t.shift();for(;t.length>0&&t[t.length-1].id===r.ID;)t.pop();for(let e=t.length-2;e>=0;e--)t[e].id===r.ID&&t[e+1].id===r.ID&&t.splice(e+1,1);return t}static{this.ID="vs.actions.separator"}async run(){}},rv=class{constructor(t,e,n,o){this.tooltip="";this.enabled=!0;this.checked=void 0;this.id=t,this.label=e,this.class=o,this._actions=n}get actions(){return this._actions}async run(){}},Q2=class r extends NR{static{this.ID="vs.actions.empty"}constructor(){super(r.ID,p(46,null),void 0,!1)}};var J2={EditorPane:"workbench.contributions.editors",EditorFactory:"workbench.contributions.editor.inputFactories"},WR={id:"default",displayName:p(4920,null),providerDisplayName:p(4917,null)};var Y2="workbench.editors.textDiffEditor",X2="workbench.editors.binaryResourceDiffEditor";function Cx(r,t,e){for(let n of e.visibleEditorPanes)if(n.group.id===t&&r.matches(n.input))return n.getViewState()}function Z2(r){if(yr(r))return!1;let t=r;return b.isUri(t?.resource)}function Ci(r){if(yr(r))return!1;let t=r;return t?.original!==void 0&&t.modified!==void 0}function Ap(r){if(yr(r))return!1;let t=r;return!t||t.resources&&!Array.isArray(t.resources)?!1:!!t.resources||!!t.multiDiffSource}function El(r){if(yr(r)||Ci(r))return!1;let t=r;return t?.primary!==void 0&&t.secondary!==void 0}function Tl(r){if(yr(r))return!1;let t=r;return b.isUri(t?.base?.resource)&&b.isUri(t?.input1?.resource)&&b.isUri(t?.input2?.resource)&&b.isUri(t?.result?.resource)}var UR=class{constructor(){this.mapIdToSaveSource=new Map}registerSource(t,e){let n=this.mapIdToSaveSource.get(t);return n||(n={source:t,label:e},this.mapIdToSaveSource.set(t,n)),n.source}getSourceLabel(t){return this.mapIdToSaveSource.get(t)?.label??t}},hse=new UR;var iv=class extends O{};function yr(r){return r instanceof iv}function k7(r){let t=r;return b.isUri(t?.preferredResource)}function P7(r){let t=r;return yr(t?.primary)&&yr(t?.secondary)}function VR(r){let t=r;return yr(t?.modified)&&yr(t?.original)}var FR=class{getOriginalUri(t,e){if(!t)return;if(Tl(t))return Sx.getOriginalUri(t.result,e);if(e?.supportSideBySide){let{primary:o,secondary:i}=this.getSideEditors(t);if(o&&i){if(e?.supportSideBySide===3)return{primary:this.getOriginalUri(o,{filterByScheme:e.filterByScheme}),secondary:this.getOriginalUri(i,{filterByScheme:e.filterByScheme})};if(e?.supportSideBySide===4)return this.getOriginalUri(o,{filterByScheme:e.filterByScheme})??this.getOriginalUri(i,{filterByScheme:e.filterByScheme});t=e.supportSideBySide===1?o:i}}if(Ci(t)||Ap(t)||El(t)||Tl(t))return;let n=k7(t)?t.preferredResource:t.resource;return!n||!e?.filterByScheme?n:this.filterUri(n,e.filterByScheme)}getSideEditors(t){return P7(t)||El(t)?{primary:t.primary,secondary:t.secondary}:VR(t)||Ci(t)?{primary:t.modified,secondary:t.original}:{primary:void 0,secondary:void 0}}getCanonicalUri(t,e){if(!t)return;if(Tl(t))return Sx.getCanonicalUri(t.result,e);if(e?.supportSideBySide){let{primary:o,secondary:i}=this.getSideEditors(t);if(o&&i){if(e?.supportSideBySide===3)return{primary:this.getCanonicalUri(o,{filterByScheme:e.filterByScheme}),secondary:this.getCanonicalUri(i,{filterByScheme:e.filterByScheme})};if(e?.supportSideBySide===4)return this.getCanonicalUri(o,{filterByScheme:e.filterByScheme})??this.getCanonicalUri(i,{filterByScheme:e.filterByScheme});t=e.supportSideBySide===1?o:i}}if(Ci(t)||Ap(t)||El(t)||Tl(t))return;let n=t.resource;return!n||!e?.filterByScheme?n:this.filterUri(n,e.filterByScheme)}filterUri(t,e){if(Array.isArray(e)){if(e.some(n=>t.scheme===n))return t}else if(e===t.scheme)return t}};var Sx=new FR;var HR=class{constructor(){this.editorSerializerConstructors=new Map;this.editorSerializerInstances=new Map}start(t){let e=this.instantiationService=t.get(Jo);for(let[n,o]of this.editorSerializerConstructors)this.createEditorSerializer(n,o,e);this.editorSerializerConstructors.clear()}createEditorSerializer(t,e,n){let o=n.createInstance(e);this.editorSerializerInstances.set(t,o)}registerFileEditorFactory(t){if(this.fileEditorFactory)throw new Error("Can only register one file editor factory.");this.fileEditorFactory=t}getFileEditorFactory(){return pi(this.fileEditorFactory)}registerEditorSerializer(t,e){if(this.editorSerializerConstructors.has(t)||this.editorSerializerInstances.has(t))throw new Error(`A editor serializer with type ID '${t}' was already registered.`);return this.instantiationService?this.createEditorSerializer(t,e,this.instantiationService):this.editorSerializerConstructors.set(t,e),K(()=>{this.editorSerializerConstructors.delete(t),this.editorSerializerInstances.delete(t)})}getEditorSerializer(t){return this.editorSerializerInstances.get(typeof t=="string"?t:t.typeId)}};vt.add(J2.EditorFactory,new HR);var BR="local";var _7;(n=>{function r(o){return new Map(Object.entries(o))}n.fromRecord=r;function t(o){let i=Object.create(null);for(let[s,a]of o)i[s]=a;return i}n.toRecord=t;function e(o){if(o)return Array.from(o,([i,s])=>({optionId:i,value:typeof s=="string"?s:s.id}))}n.toStrValueArray=e})(_7||={});var D7=R("chatSessionsService");var Qr;(s=>{s.scheme=V.vscodeLocalChatSession;function t(a){let l=Ao(H.wrap(new TextEncoder().encode(a)),!1,!0);return b.from({scheme:s.scheme,authority:BR,path:"/"+l})}s.forSession=t;function e(){let a=Math.floor(Math.random()*1e9);return t(`chat-${a}`)}s.getNewSessionUri=e;function n(a){let l=i(a);return l?.chatSessionType===BR?l.sessionId:void 0}s.parseLocalSessionId=n;function o(a){return!!n(a)}s.isLocalSession=o;function i(a){if(a.scheme!==s.scheme||!a.authority)return;let l=a.path.split("/");if(l.length!==2)return;let d=a.authority,c=Rr(l[1]);return{chatSessionType:d,sessionId:new TextDecoder().decode(c.buffer)}}})(Qr||={});function wl(r){let t=Qr.parseLocalSessionId(r);return t||r.toString()}var sv;(i=>{i.icon=ce.error;function t(s){return{filterUri:s.resource,owner:s.owner,problemMessage:s.message,filterRange:{startLineNumber:s.startLineNumber,endLineNumber:s.endLineNumber,startColumn:s.startColumn,endColumn:s.endColumn}}}i.fromMarker=t;function e(s){return{id:n(s),name:o(s),icon:i.icon,value:s,kind:"diagnostic",...s}}i.toEntry=e;function n(s){return[s.filterUri,s.owner,s.filterSeverity,s.filterRange?.startLineNumber,s.filterRange?.startColumn].join(":")}i.id=n;function o(s){let a;if((u=>(u[u.MaxChars=30]="MaxChars",u[u.MaxSpaceLookback=10]="MaxSpaceLookback"))(a||={}),s.problemMessage){if(s.problemMessage.length<30)return s.problemMessage;let d=s.problemMessage.lastIndexOf(" ",30);return d===-1||d+10<30?s.problemMessage.substring(0,30)+"\u2026":s.problemMessage.substring(0,d)+"\u2026"}let l=p(8193,null);return s.filterUri&&(l=p(8194,null,Tt(s.filterUri))),l}i.label=o})(sv||={});var kl;(n=>{function r(o){return b.isUri(o.value)?o.value:K2(o.value)?o.value.uri:void 0}n.toUri=r;function t(o){if(o.value instanceof Uint8Array){let i={...o};return i.value={$base64:Ao(H.wrap(o.value))},i}return o}n.toExport=t;function e(o){if(o&&"values"in o&&Array.isArray(o.values))return{kind:"generic",id:o.id??"",name:o.name,value:o.values[0]?.value,range:o.range,modelDescription:o.modelDescription,references:o.references};if(o.value&&typeof o.value=="object"&&"$base64"in o.value&&typeof o.value.$base64=="string"){let i={...o};return i.value=Rr(o.value.$base64).buffer,i}return o}n.fromExport=e})(kl||={});function eH(r){return r.kind==="implicit"}function tH(r){return r.kind==="string"}function nH(r){return r.kind==="image"}function av(r){return r.kind==="promptFile"}function oH(r){return r.kind==="promptText"}function rH(r){let t=r;return typeof t=="object"&&t!==null&&(typeof t.value=="string"||typeof t.value>"u")&&(typeof t.name=="string"||typeof t.name>"u")&&(t.resourceUri===void 0||b.isUri(t.resourceUri))&&(typeof t.name=="string"||b.isUri(t.resourceUri))&&(t.icon===void 0||ut.isThemeIcon(t.icon))&&b.isUri(t.uri)&&typeof t.handle=="number"}function Pl(r,t,e,n=!1,o){return{id:`${t}__${r.toString()}`,name:`prompt:${Tt(r)}`,value:r,kind:"promptFile",modelDescription:"Prompt instructions file",isRoot:t!=="vscode.instructions.file.reference",originLabel:e,toolReferences:o,automaticallyAdded:n}}function iH(r,t=!1,e){return{id:"vscode.customizations.index",name:"prompt:customizationsIndex",value:r,kind:"promptText",modelDescription:"Chat customizations index",automaticallyAdded:t,toolReferences:e}}function sH(r,t){return{kind:"tool",id:r.id,icon:ut.isThemeIcon(r.icon)?r.icon:void 0,name:r.displayName,value:void 0,range:t}}var Ic=class{constructor(t){this._ids=new Set;this._entries=[];t&&this.add(...t)}add(...t){for(let e of t)this._ids.has(e.id)||(this._ids.add(e.id),this._entries.push(e))}insertFirst(t){this._ids.has(t.id)||(this._ids.add(t.id),this._entries.unshift(t))}remove(t){this._ids.delete(t.id),this._entries=this._entries.filter(e=>e.id!==t.id)}has(t){return this._ids.has(t.id)}asArray(){return this._entries.slice(0)}get length(){return this._entries.length}};var Ti=(o=>(o.Chat="panel",o.Terminal="terminal",o.Notebook="notebook",o.EditorInline="editor",o))(Ti||{});(t=>{function r(e){switch(e){case"panel":return"panel";case"terminal":return"terminal";case"notebook":return"notebook";case"editor":return"editor"}return"panel"}t.fromRaw=r})(Ti||={});var Hse=new Set([V.vscodeChatEditor,V.walkThrough,V.vscodeLocalChatSession,V.vscodeSettings,V.webviewPanel,V.vscodeUserData,V.extension,"ccreq","openai-codex"]);var Wse=new w("inModelsEditor",!1),Vse=new w("inModelsSearch",!1);function Mp(r,t=Ie){return bI(r,t)?r.charAt(0).toUpperCase()+r.slice(1):r}function xc(r,t){return r.replace(/^~($|\/|\\)/,`${t}$1`)}var aH="\u2026",lv="\\\\",dv="~";function lH(r,t=xt){let e=new Array(r.length),n=!1;for(let o=0;o<r.length;o++){let i=r[o];if(i===""){e[o]=`.${t}`;continue}if(!i){e[o]=i;continue}n=!0;let s="",a=i;a.indexOf(lv)===0?(s=a.substr(0,a.indexOf(lv)+lv.length),a=a.substr(a.indexOf(lv)+lv.length)):a.indexOf(t)===0?(s=a.substr(0,a.indexOf(t)+t.length),a=a.substr(a.indexOf(t)+t.length)):a.indexOf(dv)===0&&(s=a.substr(0,a.indexOf(dv)+dv.length),a=a.substr(a.indexOf(dv)+dv.length));let l=a.split(t);for(let d=1;n&&d<=l.length;d++)for(let c=l.length-d;n&&c>=0;c--){n=!1;let u=l.slice(c,c+d).join(t);for(let m=0;!n&&m<r.length;m++)if(m!==o&&r[m]&&r[m].indexOf(u)>-1){let g=c+d===l.length,h=c>0&&r[m].indexOf(t)>-1?t+u:u,f=r[m].endsWith(h);n=!g||f}if(!n){let m="";(l[0].endsWith(":")||s!=="")&&(c===1&&(c=0,d++,u=l[0]+t+u),c>0&&(m=l[0]+t),m=s+m),c>0&&(m=m+aH+t),m=m+u,c+d<l.length&&(m=m+t+aH),e[o]=m}}n&&(e[o]=i)}return e}var dH="github.copilot.chat.agentDebugLog.enabled",cH="github.copilot.chat.agentDebugLog.fileLogging.enabled";var uH="troubleshoot/SKILL.md";var cv=(c=>(c.SessionStart="SessionStart",c.SessionEnd="SessionEnd",c.UserPromptSubmit="UserPromptSubmit",c.PreToolUse="PreToolUse",c.PostToolUse="PostToolUse",c.PreCompact="PreCompact",c.SubagentStart="SubagentStart",c.SubagentStop="SubagentStop",c.Stop="Stop",c.ErrorOccurred="ErrorOccurred",c))(cv||{}),pH={vscode:{SessionStart:"SessionStart",UserPromptSubmit:"UserPromptSubmit",PreToolUse:"PreToolUse",PostToolUse:"PostToolUse",PreCompact:"PreCompact",SubagentStart:"SubagentStart",SubagentStop:"SubagentStop",Stop:"Stop"},"github-copilot":{sessionStart:"SessionStart",sessionEnd:"SessionEnd",userPromptSubmitted:"UserPromptSubmit",preToolUse:"PreToolUse",postToolUse:"PostToolUse",agentStop:"Stop",subagentStop:"SubagentStop",errorOccurred:"ErrorOccurred"},claude:{SessionStart:"SessionStart",UserPromptSubmit:"UserPromptSubmit",PreToolUse:"PreToolUse",PostToolUse:"PostToolUse",PreCompact:"PreCompact",SubagentStart:"SubagentStart",SubagentStop:"SubagentStop",Stop:"Stop"},undefined:Object.fromEntries(Object.values(cv).map(r=>[r,r]))},mH={SessionStart:{label:p(8315,null),description:p(8314,null)},UserPromptSubmit:{label:p(8323,null),description:p(8322,null)},PreToolUse:{label:p(8311,null),description:p(8310,null)},PostToolUse:{label:p(8307,null),description:p(8306,null)},PreCompact:{label:p(8309,null),description:p(8308,null)},SubagentStart:{label:p(8319,null),description:p(8318,null)},SubagentStop:{label:p(8321,null),description:p(8320,null)},Stop:{label:p(8317,null),description:p(8316,null)},SessionEnd:{label:p(8313,null),description:p(8312,null)},ErrorOccurred:{label:p(8305,null),description:p(8304,null)}};function gH(r,t){if(!r)return t;let e={...r};for(let n of Object.values(cv)){let o=r[n],i=t[n];i&&i.length>0&&(e[n]=o?[...o,...i]:i)}return e}var Ir={type:p(8297,null),command:p(8288,null),windows:p(8298,null),linux:p(8292,null),osx:p(8293,null),bash:p(8286,null),powershell:p(8294,null),cwd:p(8290,null),env:p(8291,null),timeout:p(8295,null),timeoutSec:p(8296,null)},A7={type:"object",additionalProperties:!0,required:["type"],anyOf:[{required:["command"]},{required:["windows"]},{required:["linux"]},{required:["osx"]},{required:["bash"]},{required:["powershell"]}],errorMessage:p(8289,null),properties:{type:{type:"string",enum:["command"],description:Ir.type},command:{type:"string",description:Ir.command},windows:{type:"string",description:Ir.windows},linux:{type:"string",description:Ir.linux},osx:{type:"string",description:Ir.osx},cwd:{type:"string",description:Ir.cwd},env:{type:"object",additionalProperties:{type:"string"},description:Ir.env},timeout:{type:"number",default:30,description:Ir.timeout}}},M7={type:"array",items:A7};function fH(r,t){return Object.fromEntries(Object.entries(pH[r]).map(([e,n])=>[e,{...t,description:mH[n]?.description}]))}var L7=fH("vscode",M7),O7={type:"object",additionalProperties:!0,required:["type"],anyOf:[{required:["bash"]},{required:["powershell"]}],errorMessage:p(8287,null),properties:{type:{type:"string",enum:["command"],description:Ir.type},bash:{type:"string",description:Ir.bash},powershell:{type:"string",description:Ir.powershell},cwd:{type:"string",description:Ir.cwd},env:{type:"object",additionalProperties:{type:"string"},description:Ir.env},timeoutSec:{type:"number",default:10,description:Ir.timeoutSec}}},N7={type:"array",items:O7},U7=fH("github-copilot",N7),iae={$schema:"http://json-schema.org/draft-07/schema#",type:"object",description:p(8299,null),additionalProperties:!0,required:["hooks"],properties:{hooks:{type:"object",description:p(8300,null),additionalProperties:!0}},if:{required:["version"],properties:{version:{type:"number"}}},then:{properties:{version:{type:"number",description:p(8303,null)},hooks:{properties:U7}}},else:{properties:{hooks:{properties:L7}}},defaultSnippets:[{label:p(8301,null),description:p(8302,null),body:{hooks:{SessionStart:[{type:"command",command:'${1:echo "Session started" >> session.log}'}],PreToolUse:[{type:"command",command:"${2:./scripts/validate.sh}",timeout:15}]}}}]};function hH(r,t){return t===1&&r.windows?r.windows:t===2&&r.osx?r.osx:t===3&&r.linux?r.linux:r.command}var Hn=class{constructor(t,e,n){this.owner=t;this.debugNameSource=e;this.referenceFn=n}getDebugName(t){return IH(t,this)}},vH=new Map,$R=new WeakMap;function IH(r,t){let e=$R.get(r);if(e)return e;let n=F7(r,t);if(n){let o=vH.get(n)??0;o++,vH.set(n,o);let i=o===1?n:`${n}#${o}`;return $R.set(r,i),i}}function F7(r,t){let e=$R.get(r);if(e)return e;let n=t.owner?W7(t.owner)+".":"",o,i=t.debugNameSource;if(i!==void 0)if(typeof i=="function"){if(o=i(),o!==void 0)return n+o}else return n+i;let s=t.referenceFn;if(s!==void 0&&(o=uv(s),o!==void 0))return n+o;if(t.owner!==void 0){let a=H7(t.owner,r);if(a!==void 0)return n+a}}function H7(r,t){for(let e in r)if(r[e]===t)return e}var bH=new Map,yH=new WeakMap;function W7(r){let t=yH.get(r);if(t)return t;let e=zR(r)??"Object",n=bH.get(e)??0;n++,bH.set(e,n);let o=n===1?e:`${e}#${n}`;return yH.set(r,o),o}function zR(r){let t=r.constructor;if(t)return t.name==="Object"?void 0:t.name}function uv(r){let t=r.toString(),n=/\/\*\*\s*@description\s*([^*]*)\*\//.exec(t);return(n?n[1]:void 0)?.trim()}function Wo(r,t){return r===t}function V7(){return(r,t)=>r===t}function qR(r,t,e){return rn(r,t,e??Wo)}function B7(r){return(t,e)=>rn(t,e,r??Wo)}function Lp(r,t){if(r===t)return!0;if(Array.isArray(r)&&Array.isArray(t)){if(r.length!==t.length)return!1;for(let e=0;e<r.length;e++)if(!Lp(r[e],t[e]))return!1;return!0}if(r&&typeof r=="object"&&t&&typeof t=="object"&&Object.getPrototypeOf(r)===Object.prototype&&Object.getPrototypeOf(t)===Object.prototype){let e=r,n=t,o=Object.keys(e),i=Object.keys(n),s=new Set(i);if(o.length!==i.length)return!1;for(let a of o)if(!s.has(a)||!Lp(e[a],n[a]))return!1;return!0}return!1}function $7(){return(r,t)=>Lp(r,t)}function z7(r,t){return JSON.stringify(r)===JSON.stringify(t)}function q7(){return(r,t)=>JSON.stringify(r)===JSON.stringify(t)}function K7(){return(r,t)=>r.equals(t)}function j7(r,t,e){return r==null||t===void 0||t===null?t===r:e(r,t)}function G7(r){return(t,e)=>t==null||e===void 0||e===null?e===t:r(t,e)}var Q7;(u=>(u.strict=Wo,u.strictC=V7,u.array=qR,u.arrayC=B7,u.structural=Lp,u.structuralC=$7,u.jsonStringify=z7,u.jsonStringifyC=q7,u.thisC=K7,u.ifDefined=j7,u.ifDefinedC=G7))(Q7||={});function KR(r){let t=new Error("BugIndicatingErrorRecovery: "+r);ze(t),console.error("recovered from an error that indicates a bug",t)}var Sc;function pv(r){Sc?Sc instanceof Tx?Sc.loggers.push(r):Sc=new Tx([Sc,r]):Sc=r}function Xt(){return Sc}var jR;function xH(r){jR=r}function SH(r){jR&&jR(r)}var Tx=class{constructor(t){this.loggers=t}handleObservableCreated(t,e){for(let n of this.loggers)n.handleObservableCreated(t,e)}handleOnListenerCountChanged(t,e){for(let n of this.loggers)n.handleOnListenerCountChanged(t,e)}handleObservableUpdated(t,e){for(let n of this.loggers)n.handleObservableUpdated(t,e)}handleAutorunCreated(t,e){for(let n of this.loggers)n.handleAutorunCreated(t,e)}handleAutorunDisposed(t){for(let e of this.loggers)e.handleAutorunDisposed(t)}handleAutorunDependencyChanged(t,e,n){for(let o of this.loggers)o.handleAutorunDependencyChanged(t,e,n)}handleAutorunStarted(t){for(let e of this.loggers)e.handleAutorunStarted(t)}handleAutorunFinished(t){for(let e of this.loggers)e.handleAutorunFinished(t)}handleDerivedDependencyChanged(t,e,n){for(let o of this.loggers)o.handleDerivedDependencyChanged(t,e,n)}handleDerivedCleared(t){for(let e of this.loggers)e.handleDerivedCleared(t)}handleBeginTransaction(t){for(let e of this.loggers)e.handleBeginTransaction(t)}handleEndTransaction(t){for(let e of this.loggers)e.handleEndTransaction(t)}};function Cc(r,t){let e=new _l(r,t);try{r(e)}finally{e.finish()}}function GR(r,t,e){r?t(r):Cc(t,e)}var _l=class{constructor(t,e){this._fn=t;this._getDebugName=e;this._updatingObservers=[];Xt()?.handleBeginTransaction(this)}getDebugName(){return this._getDebugName?this._getDebugName():uv(this._fn)}updateObserver(t,e){if(!this._updatingObservers){KR("Transaction already finished!"),Cc(n=>{n.updateObserver(t,e)});return}this._updatingObservers.push({observer:t,observable:e}),t.beginUpdate(e)}finish(){let t=this._updatingObservers;if(!t){KR("transaction.finish() has already been called!");return}for(let e=0;e<t.length;e++){let{observer:n,observable:o}=t[e];n.endUpdate(o)}this._updatingObservers=null,Xt()?.handleEndTransaction(this)}debugGetUpdatingObservers(){return this._updatingObservers}};var xn;(n=>{let r=!1;function t(){r=!0}n.enable=t;function e(){if(!r)return;let o=Error,i=o.stackTraceLimit;o.stackTraceLimit=3;let s=new Error().stack;return o.stackTraceLimit=i,QR.fromStack(s,2)}n.ofCaller=e})(xn||={});var QR=class r{constructor(t,e,n,o){this.fileName=t;this.line=e;this.column=n;this.id=o}static fromStack(t,e){let n=t.split(`
`),o=J7(n[e+1]);if(o)return new r(o.fileName,o.line,o.column,o.id)}};function J7(r){let t=r.match(/\((.*):(\d+):(\d+)\)/);if(t)return{fileName:t[1],line:parseInt(t[2]),column:parseInt(t[3]),id:r};let e=r.match(/at ([^\(\)]*):(\d+):(\d+)/);if(e)return{fileName:e[1],line:parseInt(e[2]),column:parseInt(e[3]),id:r}}var JR;function CH(r){JR=r}var TH;function EH(r){TH=r}var wH;function kH(r){wH=r}var YR;function PH(r){YR=r}var mv=class{get TChange(){return null}reportChanges(){this.get()}read(t){return t?t.readObservable(this):this.get()}map(t,e,n=xn.ofCaller()){let o=e===void 0?void 0:t,i=e===void 0?t:e;return JR({owner:o,debugName:()=>{let s=uv(i);if(s!==void 0)return s;let l=/^\s*\(?\s*([a-zA-Z_$][a-zA-Z_$0-9]*)\s*\)?\s*=>\s*\1(?:\??)\.([a-zA-Z_$][a-zA-Z_$0-9]*)\s*$/.exec(i.toString());if(l)return`${this.debugName}.${l[2]}`;if(!o)return`${this.debugName} (mapped)`},debugReferenceFn:i},s=>i(this.read(s),s),n)}flatten(){return JR({owner:void 0,debugName:()=>`${this.debugName} (flattened)`},t=>this.read(t).read(t))}recomputeInitiallyAndOnChange(t,e){return t.add(TH(this,e)),this}keepObserved(t){return t.add(wH(this)),this}get debugValue(){return this.get()}get debug(){return new XR(this)}},XR=class{constructor(t){this.observable=t}getDependencyGraph(){return YR(this.observable,{type:"dependencies"})}getObserverGraph(){return YR(this.observable,{type:"observers"})}},Mr=class extends mv{constructor(e){super();this._observers=new Set;Xt()?.handleObservableCreated(this,e)}addObserver(e){let n=this._observers.size;this._observers.add(e),n===0&&this.onFirstObserverAdded(),n!==this._observers.size&&Xt()?.handleOnListenerCountChanged(this,this._observers.size)}removeObserver(e){let n=this._observers.delete(e);n&&this._observers.size===0&&this.onLastObserverRemoved(),n&&Xt()?.handleOnListenerCountChanged(this,this._observers.size)}onFirstObserverAdded(){}onLastObserverRemoved(){}log(){let e=!!Xt();return SH(this),e||Xt()?.handleObservableCreated(this,xn.ofCaller()),this}debugGetObservers(){return this._observers}};function to(r,t,e=xn.ofCaller()){let n;return typeof r=="string"?n=new Hn(void 0,r,void 0):n=new Hn(r,void 0,void 0),new ps(n,t,Wo,e)}var ps=class extends Mr{constructor(e,n,o,i){super(i);this._debugNameData=e;this._equalityComparator=o;this._value=n,Xt()?.handleObservableUpdated(this,{hadValue:!1,newValue:n,change:void 0,didChange:!0,oldValue:void 0})}get debugName(){return this._debugNameData.getDebugName(this)??"ObservableValue"}get(){return this._value}set(e,n,o){if(o===void 0&&this._equalityComparator(this._value,e))return;let i;n||(n=i=new _l(()=>{},()=>`Setting ${this.debugName}`));try{let s=this._value;this._setValue(e),Xt()?.handleObservableUpdated(this,{oldValue:s,newValue:e,change:o,didChange:!0,hadValue:!0});for(let a of this._observers)n.updateObserver(a,this),a.handleChange(this,o)}finally{i&&i.finish()}}toString(){return`${this.debugName}: ${this._value}`}_setValue(e){this._value=e}debugGetState(){return{value:this._value}}debugSetValue(e){this._value=e}};var Ex=class extends Mr{constructor(e,n,o,i){super(i);this._debugNameData=e;this._equalityComparator=o;this._isUpToDate=!0;this._deltas=[];this._updateCounter=0;this._value=n}get debugName(){return this._debugNameData.getDebugName(this)??"LazyObservableValue"}get(){return this._update(),this._value}_update(){if(!this._isUpToDate)if(this._isUpToDate=!0,this._deltas.length>0){for(let e of this._deltas){Xt()?.handleObservableUpdated(this,{change:e,didChange:!0,oldValue:"(unknown)",newValue:this._value,hadValue:!0});for(let n of this._observers)n.handleChange(this,e)}this._deltas.length=0}else{Xt()?.handleObservableUpdated(this,{change:void 0,didChange:!0,oldValue:"(unknown)",newValue:this._value,hadValue:!0});for(let e of this._observers)e.handleChange(this,void 0)}}_beginUpdate(){if(this._updateCounter++,this._updateCounter===1)for(let e of this._observers)e.beginUpdate(this)}_endUpdate(){if(this._updateCounter--,this._updateCounter===0){this._update();let e=[...this._observers];for(let n of e)n.endUpdate(this)}}addObserver(e){let n=!this._observers.has(e)&&this._updateCounter>0;super.addObserver(e),n&&e.beginUpdate(this)}removeObserver(e){let n=this._observers.has(e)&&this._updateCounter>0;super.removeObserver(e),n&&e.endUpdate(this)}set(e,n,o){if(o===void 0&&this._equalityComparator(this._value,e))return;let i;n||(n=i=new _l(()=>{},()=>`Setting ${this.debugName}`));try{if(this._isUpToDate=!1,this._setValue(e),o!==void 0&&this._deltas.push(o),n.updateObserver({beginUpdate:()=>this._beginUpdate(),endUpdate:()=>this._endUpdate(),handleChange:(s,a)=>{},handlePossibleChange:s=>{}},this),this._updateCounter>1)for(let s of this._observers)s.handlePossibleChange(this)}finally{i&&i.finish()}}toString(){return`${this.debugName}: ${this._value}`}_setValue(e){this._value=e}};function Tc(r,t,e=xn.ofCaller()){return r.lazy?new Ex(new Hn(r.owner,r.debugName,void 0),t,r.equalsFn??Wo,e):new ps(new Hn(r.owner,r.debugName,void 0),t,r.equalsFn??Wo,e)}function Y7(r){switch(r){case 1:return"dependenciesMightHaveChanged";case 2:return"stale";case 3:return"upToDate";default:return"<unknown>"}}var ga=class{constructor(t,e,n,o){this._debugNameData=t;this._runFn=e;this._changeTracker=n;this._state=2;this._updateCount=0;this._disposed=!1;this._dependencies=new Set;this._dependenciesToBeRemoved=new Set;this._isRunning=!1;this._iteration=0;this._store=void 0;this._delayedStore=void 0;this._changeSummary=this._changeTracker?.createChangeSummary(void 0),Xt()?.handleAutorunCreated(this,o),this._run(),ol(this)}get debugName(){return this._debugNameData.getDebugName(this)??"(anonymous)"}dispose(){if(!this._disposed){this._disposed=!0;for(let t of this._dependencies)t.removeObserver(this);this._dependencies.clear(),this._store!==void 0&&this._store.dispose(),this._delayedStore!==void 0&&this._delayedStore.dispose(),Xt()?.handleAutorunDisposed(this),rl(this)}}_run(){let t=this._dependenciesToBeRemoved;this._dependenciesToBeRemoved=this._dependencies,this._dependencies=t,this._state=3;try{if(!this._disposed){Xt()?.handleAutorunStarted(this);let e=this._changeSummary,n=this._delayedStore;n!==void 0&&(this._delayedStore=void 0);try{this._isRunning=!0,this._changeTracker&&(this._changeTracker.beforeUpdate?.(this,e),this._changeSummary=this._changeTracker.createChangeSummary(e)),this._store!==void 0&&(this._store.dispose(),this._store=void 0),this._runFn(this,e)}catch(o){Xa(o)}finally{this._isRunning=!1,n!==void 0&&n.dispose()}}}finally{this._disposed||Xt()?.handleAutorunFinished(this);for(let e of this._dependenciesToBeRemoved)e.removeObserver(this);this._dependenciesToBeRemoved.clear()}}toString(){return`Autorun<${this.debugName}>`}beginUpdate(t){this._state===3&&(this._checkIterations(),this._state=1),this._updateCount++}endUpdate(t){try{if(this._updateCount===1){this._iteration=1;do{if(this._checkIterations())return;if(this._state===1){this._state=3;for(let e of this._dependencies)if(e.reportChanges(),this._state===2)break}this._iteration++,this._state!==3&&this._run()}while(this._state!==3)}}finally{this._updateCount--}ah(()=>this._updateCount>=0)}handlePossibleChange(t){this._state===3&&this._isDependency(t)&&(this._checkIterations(),this._state=1)}handleChange(t,e){if(this._isDependency(t)){Xt()?.handleAutorunDependencyChanged(this,t,e);try{(!this._changeTracker||this._changeTracker.handleChange({changedObservable:t,change:e,didChange:o=>o===t},this._changeSummary))&&(this._checkIterations(),this._state=2)}catch(n){Xa(n)}}}_isDependency(t){return this._dependencies.has(t)&&!this._dependenciesToBeRemoved.has(t)}_ensureNoRunning(){if(!this._isRunning)throw new Pt("The reader object cannot be used outside its compute function!")}readObservable(t){if(this._ensureNoRunning(),this._disposed)return t.get();t.addObserver(this);let e=t.get();return this._dependencies.add(t),this._dependenciesToBeRemoved.delete(t),e}get store(){if(this._ensureNoRunning(),this._disposed)throw new Pt("Cannot access store after dispose");return this._store===void 0&&(this._store=new $),this._store}get delayedStore(){if(this._ensureNoRunning(),this._disposed)throw new Pt("Cannot access store after dispose");return this._delayedStore===void 0&&(this._delayedStore=new $),this._delayedStore}debugGetState(){return{isRunning:this._isRunning,updateCount:this._updateCount,dependencies:this._dependencies,state:this._state,stateStr:Y7(this._state)}}debugRerun(){this._isRunning?this._state=2:this._run()}_checkIterations(){return this._iteration>100?(Xa(new Pt(`Autorun '${this.debugName}' is stuck in an infinite update loop.`)),!0):!1}};function Vo(r,t=xn.ofCaller()){return new ga(new Hn(void 0,void 0,r),r,void 0,t)}function gv(r,t=xn.ofCaller()){let e,n=!1;return e=Vo(o=>{r({delayedStore:o.delayedStore,store:o.store,readObservable:o.readObservable.bind(o),dispose:()=>{e?.dispose(),n=!0}})},t),n&&e.dispose(),e}function X7(r){switch(r){case 0:return"initial";case 1:return"dependenciesMightHaveChanged";case 2:return"stale";case 3:return"upToDate";default:return"<unknown>"}}var Qn=class extends Mr{constructor(e,n,o,i=void 0,s,a){super(a);this._debugNameData=e;this._computeFn=n;this._changeTracker=o;this._handleLastObserverRemoved=i;this._equalityComparator=s;this._state=0;this._value=void 0;this._updateCount=0;this._dependencies=new Set;this._dependenciesToBeRemoved=new Set;this._changeSummary=void 0;this._isUpdating=!1;this._isComputing=!1;this._didReportChange=!1;this._isInBeforeUpdate=!1;this._isReaderValid=!1;this._store=void 0;this._delayedStore=void 0;this._removedObserverToCallEndUpdateOn=null;this._changeSummary=this._changeTracker?.createChangeSummary(void 0)}get debugName(){return this._debugNameData.getDebugName(this)??"(anonymous)"}onLastObserverRemoved(){this._state=0,this._value=void 0,Xt()?.handleDerivedCleared(this);for(let e of this._dependencies)e.removeObserver(this);this._dependencies.clear(),this._store!==void 0&&(this._store.dispose(),this._store=void 0),this._delayedStore!==void 0&&(this._delayedStore.dispose(),this._delayedStore=void 0),this._handleLastObserverRemoved?.()}get(){if(this._isComputing,this._observers.size===0){let n;try{this._isReaderValid=!0;let o;this._changeTracker&&(o=this._changeTracker.createChangeSummary(void 0),this._changeTracker.beforeUpdate?.(this,o)),n=this._computeFn(this,o)}finally{this._isReaderValid=!1}return this.onLastObserverRemoved(),n}else{do{if(this._state===1){for(let n of this._dependencies)if(n.reportChanges(),this._state===2)break}this._state===1&&(this._state=3),this._state!==3&&this._recompute()}while(this._state!==3);return this._value}}_recompute(){let e=!1;this._isComputing=!0,this._didReportChange=!1;let n=this._dependenciesToBeRemoved;this._dependenciesToBeRemoved=this._dependencies,this._dependencies=n;try{let o=this._changeSummary;this._isReaderValid=!0,this._changeTracker&&(this._isInBeforeUpdate=!0,this._changeTracker.beforeUpdate?.(this,o),this._isInBeforeUpdate=!1,this._changeSummary=this._changeTracker?.createChangeSummary(o));let i=this._state!==0,s=this._value;this._state=3;let a=this._delayedStore;a!==void 0&&(this._delayedStore=void 0);try{this._store!==void 0&&(this._store.dispose(),this._store=void 0),this._value=this._computeFn(this,o)}finally{this._isReaderValid=!1;for(let l of this._dependenciesToBeRemoved)l.removeObserver(this);this._dependenciesToBeRemoved.clear(),a!==void 0&&a.dispose()}e=this._didReportChange||i&&!this._equalityComparator(s,this._value),Xt()?.handleObservableUpdated(this,{oldValue:s,newValue:this._value,change:void 0,didChange:e,hadValue:i})}catch(o){Xa(o)}if(this._isComputing=!1,!this._didReportChange&&e)for(let o of this._observers)o.handleChange(this,void 0);else this._didReportChange=!1}toString(){return`LazyDerived<${this.debugName}>`}beginUpdate(e){if(this._isUpdating)throw new Pt("Cyclic deriveds are not supported yet!");this._updateCount++,this._isUpdating=!0;try{let n=this._updateCount===1;if(this._state===3&&(this._state=1,!n))for(let o of this._observers)o.handlePossibleChange(this);if(n)for(let o of this._observers)o.beginUpdate(this)}finally{this._isUpdating=!1}}endUpdate(e){if(this._updateCount--,this._updateCount===0){let n=[...this._observers];for(let o of n)o.endUpdate(this);if(this._removedObserverToCallEndUpdateOn){let o=[...this._removedObserverToCallEndUpdateOn];this._removedObserverToCallEndUpdateOn=null;for(let i of o)i.endUpdate(this)}}ah(()=>this._updateCount>=0)}handlePossibleChange(e){if(this._state===3&&this._dependencies.has(e)&&!this._dependenciesToBeRemoved.has(e)){this._state=1;for(let n of this._observers)n.handlePossibleChange(this)}}handleChange(e,n){if(this._dependencies.has(e)&&!this._dependenciesToBeRemoved.has(e)||this._isInBeforeUpdate){Xt()?.handleDerivedDependencyChanged(this,e,n);let o=!1;try{o=this._changeTracker?this._changeTracker.handleChange({changedObservable:e,change:n,didChange:s=>s===e},this._changeSummary):!0}catch(s){Xa(s)}let i=this._state===3;if(o&&(this._state===1||i)&&(this._state=2,i))for(let s of this._observers)s.handlePossibleChange(this)}}_ensureReaderValid(){if(!this._isReaderValid)throw new Pt("The reader object cannot be used outside its compute function!")}readObservable(e){this._ensureReaderValid(),e.addObserver(this);let n=e.get();return this._dependencies.add(e),this._dependenciesToBeRemoved.delete(e),n}reportChange(e){this._ensureReaderValid(),this._didReportChange=!0;for(let n of this._observers)n.handleChange(this,e)}get store(){return this._ensureReaderValid(),this._store===void 0&&(this._store=new $),this._store}get delayedStore(){return this._ensureReaderValid(),this._delayedStore===void 0&&(this._delayedStore=new $),this._delayedStore}addObserver(e){let n=!this._observers.has(e)&&this._updateCount>0;super.addObserver(e),n&&(this._removedObserverToCallEndUpdateOn?.delete(e)||e.beginUpdate(this))}removeObserver(e){this._observers.has(e)&&this._updateCount>0&&(this._removedObserverToCallEndUpdateOn||(this._removedObserverToCallEndUpdateOn=new Set),this._removedObserverToCallEndUpdateOn.add(e)),super.removeObserver(e)}debugGetState(){return{state:this._state,stateStr:X7(this._state),updateCount:this._updateCount,isComputing:this._isComputing,dependencies:this._dependencies,value:this._value}}debugSetValue(e){this._value=e}debugRecompute(){this.beginUpdate(this);try{this._isComputing?this._state=2:this._recompute()}finally{this.endUpdate(this)}}setValue(e,n,o){this._value=e;let i=this._observers;n.updateObserver(this,this);for(let s of i)s.handleChange(this,o)}};function Ei(r,t,e=xn.ofCaller()){return t!==void 0?new Qn(new Hn(r,void 0,t),t,void 0,void 0,Wo,e):new Qn(new Hn(void 0,void 0,r),r,void 0,void 0,Wo,e)}function fv(r,t,e=xn.ofCaller()){return new Qn(new Hn(r.owner,r.debugName,r.debugReferenceFn),t,void 0,r.onLastObserverRemoved,r.equalsFn??Wo,e)}CH(fv);function xo(...r){let t,e,n,o;return r.length===2?[e,n]=r:[t,e,n,o]=r,new Jr(new Hn(t,void 0,n),e,n,()=>Jr.globalTransaction,Wo,o??xn.ofCaller())}var Jr=class extends Mr{constructor(e,n,o,i,s,a){super(a);this._debugNameData=e;this.event=n;this._getValue=o;this._getTransaction=i;this._equalityComparator=s;this._hasValue=!1;this.handleEvent=e=>{let n=this._getValue(e),o=this._value,i=!this._hasValue||!this._equalityComparator(o,n),s=!1;i&&(this._value=n,this._hasValue&&(s=!0,GR(this._getTransaction(),a=>{Xt()?.handleObservableUpdated(this,{oldValue:o,newValue:n,change:void 0,didChange:i,hadValue:this._hasValue});for(let l of this._observers)a.updateObserver(l,this),l.handleChange(this,void 0)},()=>{let a=this.getDebugName();return"Event fired"+(a?`: ${a}`:"")})),this._hasValue=!0),s||Xt()?.handleObservableUpdated(this,{oldValue:o,newValue:n,change:void 0,didChange:i,hadValue:this._hasValue})}}getDebugName(){return this._debugNameData.getDebugName(this)}get debugName(){let e=this.getDebugName();return"From Event"+(e?`: ${e}`:"")}onFirstObserverAdded(){this._subscription=this.event(this.handleEvent)}onLastObserverRemoved(){this._subscription.dispose(),this._subscription=void 0,this._hasValue=!1,this._value=void 0}get(){return this._subscription?(this._hasValue||this.handleEvent(void 0),this._value):this._getValue(void 0)}debugSetValue(e){this._value=e}debugGetState(){return{value:this._value,hasValue:this._hasValue}}};(e=>{e.Observer=Jr;function t(n,o){let i=!1;Jr.globalTransaction===void 0&&(Jr.globalTransaction=n,i=!0);try{o()}finally{i&&(Jr.globalTransaction=void 0)}}e.batchEventsGlobally=t})(xo||={});function _H(r){let t=new wx(!1,void 0);return r.addObserver(t),K(()=>{r.removeObserver(t)})}kH(_H);function DH(r,t){let e=new wx(!0,t);r.addObserver(e);try{e.beginUpdate(r)}finally{e.endUpdate(r)}return K(()=>{r.removeObserver(e)})}EH(DH);var wx=class{constructor(t,e){this._forceRecompute=t;this._handleValue=e;this._counter=0}beginUpdate(t){this._counter++}endUpdate(t){this._counter===1&&this._forceRecompute&&(this._handleValue?this._handleValue(t.get()):t.reportChanges()),this._counter--}handlePossibleChange(t){}handleChange(t,e){}};function Op(r){return new ZR(r)}var ZR=class extends mv{constructor(e){super();this.value=e}get debugName(){return this.toString()}get(){return this.value}addObserver(e){}removeObserver(e){}log(){return this}toString(){return`Const: ${this.value}`}};function hv(r,t,e=xn.ofCaller()){return new eA(typeof r=="string"?r:new Hn(r,void 0,void 0),t,e)}var eA=class extends Mr{constructor(e,n,o){super(o);this.event=n;this.handleEvent=()=>{Cc(e=>{for(let n of this._observers)e.updateObserver(n,this),n.handleChange(this,void 0)},()=>this.debugName)};this.debugName=typeof e=="string"?e:e.getDebugName(this)??"Observable Signal From Event"}onFirstObserverAdded(){this.subscription=this.event(this.handleEvent)}onLastObserverRemoved(){this.subscription.dispose(),this.subscription=void 0}get(){}};var kx;function RH(r){kx||(kx=new vv,pv(kx)),kx.addFilteredObj(r)}var vv=class{constructor(){this.indentation=0;this.changedObservablesSets=new WeakMap}addFilteredObj(t){this._filteredObjects||(this._filteredObjects=new Set),this._filteredObjects.add(t)}_isIncluded(t){return this._filteredObjects?.has(t)??!0}textToConsoleArgs(t){return r3([Np(a3("|  ",this.indentation)),t])}formatInfo(t){return t.hadValue?t.didChange?[Np(" "),Yr(Lr(t.oldValue,70),{color:"red",strikeThrough:!0}),Np(" "),Yr(Lr(t.newValue,60),{color:"green"})]:[Np(" (unchanged)")]:[Np(" "),Yr(Lr(t.newValue,60),{color:"green"}),Np(" (initial)")]}handleObservableCreated(t){if(t instanceof Qn){let e=t;if(this.changedObservablesSets.set(e,new Set),!1){let o=[];e.__debugUpdating=o;let i=e.beginUpdate;e.beginUpdate=a=>(o.push(a),i.apply(e,[a]));let s=e.endUpdate;e.endUpdate=a=>{let l=o.indexOf(a);return l===-1&&console.error("endUpdate called without beginUpdate",e.debugName,a.debugName),o.splice(l,1),s.apply(e,[a])}}}}handleOnListenerCountChanged(t,e){}handleObservableUpdated(t,e){if(this._isIncluded(t)){if(t instanceof Qn){this._handleDerivedRecomputed(t,e);return}console.log(...this.textToConsoleArgs([Up("observable value changed"),Yr(t.debugName,{color:"BlueViolet"}),...this.formatInfo(e)]))}}formatChanges(t){if(t.size!==0)return Yr(" (changed deps: "+[...t].map(e=>e.debugName).join(", ")+")",{color:"gray"})}handleDerivedDependencyChanged(t,e,n){this._isIncluded(t)&&this.changedObservablesSets.get(t)?.add(e)}_handleDerivedRecomputed(t,e){if(!this._isIncluded(t))return;let n=this.changedObservablesSets.get(t);n&&(console.log(...this.textToConsoleArgs([Up("derived recomputed"),Yr(t.debugName,{color:"BlueViolet"}),...this.formatInfo(e),this.formatChanges(n),{data:[{fn:t._debugNameData.referenceFn??t._computeFn}]}])),n.clear())}handleDerivedCleared(t){this._isIncluded(t)&&console.log(...this.textToConsoleArgs([Up("derived cleared"),Yr(t.debugName,{color:"BlueViolet"})]))}handleFromEventObservableTriggered(t,e){this._isIncluded(t)&&console.log(...this.textToConsoleArgs([Up("observable from event triggered"),Yr(t.debugName,{color:"BlueViolet"}),...this.formatInfo(e),{data:[{fn:t._getValue}]}]))}handleAutorunCreated(t){this._isIncluded(t)&&this.changedObservablesSets.set(t,new Set)}handleAutorunDisposed(t){}handleAutorunDependencyChanged(t,e,n){this._isIncluded(t)&&this.changedObservablesSets.get(t).add(e)}handleAutorunStarted(t){let e=this.changedObservablesSets.get(t);e&&(this._isIncluded(t)&&console.log(...this.textToConsoleArgs([Up("autorun"),Yr(t.debugName,{color:"BlueViolet"}),this.formatChanges(e),{data:[{fn:t._debugNameData.referenceFn??t._runFn}]}])),e.clear(),this.indentation++)}handleAutorunFinished(t){this.indentation--}handleBeginTransaction(t){let e=t.getDebugName();e===void 0&&(e=""),this._isIncluded(t)&&console.log(...this.textToConsoleArgs([Up("transaction"),Yr(e,{color:"BlueViolet"}),{data:[{fn:t._fn}]}])),this.indentation++}handleEndTransaction(){this.indentation--}};function r3(r){let t=new Array,e=[],n="";function o(s){if("length"in s)for(let a of s)a&&o(a);else"text"in s?(n+=`%c${s.text}`,t.push(s.style),s.data&&e.push(...s.data)):"data"in s&&e.push(...s.data)}o(r);let i=[n,...t];return i.push(...e),i}function Np(r){return Yr(r,{color:"black"})}function Up(r){return Yr(l3(`${r}: `,10),{color:"black",bold:!0})}function Yr(r,t={color:"black"}){function e(o){return Object.entries(o).reduce((i,[s,a])=>`${i}${s}:${a};`,"")}let n={color:t.color};return t.strikeThrough&&(n["text-decoration"]="line-through"),t.bold&&(n["font-weight"]="bold"),{text:r,style:e(n)}}function Lr(r,t){switch(typeof r){case"number":return""+r;case"string":return r.length+2<=t?`"${r}"`:`"${r.substr(0,t-7)}"+...`;case"boolean":return r?"true":"false";case"undefined":return"undefined";case"object":return r===null?"null":Array.isArray(r)?i3(r,t):s3(r,t);case"symbol":return r.toString();case"function":return`[[Function${r.name?" "+r.name:""}]]`;default:return""+r}}function i3(r,t){let e="[ ",n=!0;for(let o of r){if(n||(e+=", "),e.length-5>t){e+="...";break}n=!1,e+=`${Lr(o,t-e.length)}`}return e+=" ]",e}function s3(r,t){if(typeof r.toString=="function"&&r.toString!==Object.prototype.toString){let i=r.toString();return i.length<=t?i:i.substring(0,t-3)+"..."}let e=zR(r),n=e?e+"(":"{ ",o=!0;for(let[i,s]of Object.entries(r)){if(o||(n+=", "),n.length-5>t){n+="...";break}o=!1,n+=`${i}: ${Lr(s,t-n.length)}`}return n+=e?")":" }",n}function a3(r,t){let e="";for(let n=1;n<=t;n++)e+=r;return e}function l3(r,t){for(;r.length<t;)r+=" ";return r}var Px=class r{constructor(t,e){this._channelFactory=t;this._getHandler=e;this._channel=this._channelFactory({handleNotification:i=>{let s=i,a=this._getHandler().notifications[s[0]];if(!a)throw new Error(`Unknown notification "${s[0]}"!`);a(...s[1])},handleRequest:i=>{let s=i;try{return{type:"result",value:this._getHandler().requests[s[0]](...s[1])}}catch(a){return{type:"error",value:a}}}});let n=new Proxy({},{get:(i,s)=>async(...a)=>{let l=await this._channel.sendRequest([s,a]);if(l.type==="error")throw l.value;return l.value}}),o=new Proxy({},{get:(i,s)=>(...a)=>{this._channel.sendNotification([s,a])}});this.api={notifications:o,requests:n}}static createHost(t,e){return new r(t,e)}static createClient(t,e){return new r(t,e)}};function AH(r,t){let e=globalThis,n=[],o,{channel:i,handler:s}=d3({sendNotification:l=>{o?o.sendNotification(l):n.push(l)}}),a;return(e.$$debugValueEditor_debugChannels??(e.$$debugValueEditor_debugChannels={}))[r]=l=>{a=t(),o=l;for(let d of n)l.sendNotification(d);return n=[],s},Px.createClient(i,()=>{if(!a)throw new Error("Not supported");return a})}function d3(r){let t;return{channel:n=>(t=n,{sendNotification:o=>{r.sendNotification(o)},sendRequest:o=>{throw new Error("not supported")}}),handler:{handleRequest:n=>n.type==="notification"?t?.handleNotification(n.data):t?.handleRequest(n.data)}}}var _x=class{constructor(){this._timeout=void 0}throttle(t,e){this._timeout===void 0&&(this._timeout=setTimeout(()=>{this._timeout=void 0,t()},e))}dispose(){this._timeout!==void 0&&clearTimeout(this._timeout)}};function tA(r,t){for(let e in t)r[e]&&typeof r[e]=="object"&&t[e]&&typeof t[e]=="object"?tA(r[e],t[e]):r[e]=t[e]}function nA(r,t){for(let e in t)t[e]===null?delete r[e]:r[e]&&typeof r[e]=="object"&&t[e]&&typeof t[e]=="object"?nA(r[e],t[e]):r[e]=t[e]}var Dx=class r{constructor(){this._declarationId=0;this._instanceId=0;this._declarations=new Map;this._instanceInfos=new WeakMap;this._aliveInstances=new Map;this._activeTransactions=new Set;this._channel=AH("observableDevTools",()=>({notifications:{setDeclarationIdFilter:t=>{},logObservableValue:t=>{console.log("logObservableValue",t)},flushUpdates:()=>{this._flushUpdates()},resetUpdates:()=>{this._pendingChanges=null,this._channel.api.notifications.handleChange(this._fullState,!0)}},requests:{getDeclarations:()=>{let t={};for(let e of this._declarations.values())t[e.id]=e;return{decls:t}},getSummarizedInstances:()=>null,getObservableValueInfo:t=>({observers:[...this._aliveInstances.get(t).debugGetObservers()].map(n=>this._formatObserver(n)).filter(vo)}),getDerivedInfo:t=>{let e=this._aliveInstances.get(t);return{dependencies:[...e.debugGetState().dependencies].map(n=>this._formatObservable(n)).filter(vo),observers:[...e.debugGetObservers()].map(n=>this._formatObserver(n)).filter(vo)}},getAutorunInfo:t=>({dependencies:[...this._aliveInstances.get(t).debugGetState().dependencies].map(n=>this._formatObservable(n)).filter(vo)}),getTransactionState:()=>this.getTransactionState(),setValue:(t,e)=>{let n=this._aliveInstances.get(t);if(n instanceof Qn)n.debugSetValue(e);else if(n instanceof ps)n.debugSetValue(e);else if(n instanceof Jr)n.debugSetValue(e);else throw new Pt("Observable is not supported");let o=[...n.debugGetObservers()];for(let i of o)i.beginUpdate(n);for(let i of o)i.handleChange(n,void 0);for(let i of o)i.endUpdate(n)},getValue:t=>{let e=this._aliveInstances.get(t);if(e instanceof Qn)return Lr(e.debugGetState().value,200);if(e instanceof ps)return Lr(e.debugGetState().value,200)},logValue:t=>{let e=this._aliveInstances.get(t);if(e&&"get"in e)console.log("Logged Value:",e.get());else throw new Pt("Observable is not supported")},rerun:t=>{let e=this._aliveInstances.get(t);if(e instanceof Qn)e.debugRecompute();else if(e instanceof ga)e.debugRerun();else throw new Pt("Observable is not supported")}}}));this._pendingChanges=null;this._changeThrottler=new _x;this._fullState={};this._flushUpdates=()=>{this._pendingChanges!==null&&(this._channel.api.notifications.handleChange(this._pendingChanges,!1),this._pendingChanges=null)};xn.enable()}static{this._instance=void 0}static getInstance(){return r._instance===void 0&&(r._instance=new r),r._instance}getTransactionState(){let t=[],e=[...this._activeTransactions];if(e.length===0)return;let n=e.flatMap(i=>i.debugGetUpdatingObservers()??[]).map(i=>i.observer),o=new Set;for(;n.length>0;){let i=n.shift();if(o.has(i))continue;o.add(i);let s=this._getInfo(i,a=>{o.has(a)||n.push(a)});s&&t.push(s)}return{names:e.map(i=>i.getDebugName()??"tx"),affected:t}}_getObservableInfo(t){let e=this._instanceInfos.get(t);if(!e){ze(new Pt("No info found"));return}return e}_getAutorunInfo(t){let e=this._instanceInfos.get(t);if(!e){ze(new Pt("No info found"));return}return e}_getInfo(t,e){if(t instanceof Qn){let n=[...t.debugGetObservers()];for(let l of n)e(l);let o=this._getObservableInfo(t);if(!o)return;let i=t.debugGetState(),s={name:t.debugName,instanceId:o.instanceId,updateCount:i.updateCount},a=[...o.changedObservables].map(l=>this._instanceInfos.get(l)?.instanceId).filter(vo);if(i.isComputing)return{...s,type:"observable/derived",state:"updating",changedDependencies:a,initialComputation:!1};switch(i.state){case 0:return{...s,type:"observable/derived",state:"noValue"};case 3:return{...s,type:"observable/derived",state:"upToDate"};case 2:return{...s,type:"observable/derived",state:"stale",changedDependencies:a};case 1:return{...s,type:"observable/derived",state:"possiblyStale"}}}else if(t instanceof ga){let n=this._getAutorunInfo(t);if(!n)return;let o={name:t.debugName,instanceId:n.instanceId,updateCount:n.updateCount},i=[...n.changedObservables].map(s=>this._instanceInfos.get(s).instanceId);if(t.debugGetState().isRunning)return{...o,type:"autorun",state:"updating",changedDependencies:i};switch(t.debugGetState().state){case 3:return{...o,type:"autorun",state:"upToDate"};case 2:return{...o,type:"autorun",state:"stale",changedDependencies:i};case 1:return{...o,type:"autorun",state:"possiblyStale"}}}}_formatObservable(t){let e=this._getObservableInfo(t);if(e)return{name:t.debugName,instanceId:e.instanceId}}_formatObserver(t){if(t instanceof Qn)return{name:t.toString(),instanceId:this._getObservableInfo(t)?.instanceId};let e=this._getAutorunInfo(t);if(e)return{name:t.toString(),instanceId:e.instanceId}}_handleChange(t){nA(this._fullState,t),this._pendingChanges===null?this._pendingChanges=t:tA(this._pendingChanges,t),this._changeThrottler.throttle(this._flushUpdates,10)}_getDeclarationId(t,e){if(!e)return-1;let n=this._declarations.get(e.id);return n===void 0&&(n={id:this._declarationId++,type:t,url:e.fileName,line:e.line,column:e.column},this._declarations.set(e.id,n),this._handleChange({decls:{[n.id]:n}})),n.id}handleObservableCreated(t,e){let o={declarationId:this._getDeclarationId("observable/value",e),instanceId:this._instanceId++,listenerCount:0,lastValue:void 0,updateCount:0,changedObservables:new Set};this._instanceInfos.set(t,o)}handleOnListenerCountChanged(t,e){let n=this._getObservableInfo(t);if(n){if(n.listenerCount===0&&e>0){let o=t instanceof Qn?"observable/derived":"observable/value";this._aliveInstances.set(n.instanceId,t),this._handleChange({instances:{[n.instanceId]:{instanceId:n.instanceId,declarationId:n.declarationId,formattedValue:n.lastValue,type:o,name:t.debugName}}})}else n.listenerCount>0&&e===0&&(this._handleChange({instances:{[n.instanceId]:null}}),this._aliveInstances.delete(n.instanceId));n.listenerCount=e}}handleObservableUpdated(t,e){if(t instanceof Qn){this._handleDerivedRecomputed(t,e);return}let n=this._getObservableInfo(t);n&&e.didChange&&(n.lastValue=Lr(e.newValue,30),n.listenerCount>0&&this._handleChange({instances:{[n.instanceId]:{formattedValue:n.lastValue}}}))}handleAutorunCreated(t,e){let o={declarationId:this._getDeclarationId("autorun",e),instanceId:this._instanceId++,updateCount:0,changedObservables:new Set};this._instanceInfos.set(t,o),this._aliveInstances.set(o.instanceId,t),o&&this._handleChange({instances:{[o.instanceId]:{instanceId:o.instanceId,declarationId:o.declarationId,runCount:0,type:"autorun",name:t.debugName}}})}handleAutorunDisposed(t){let e=this._getAutorunInfo(t);e&&(this._handleChange({instances:{[e.instanceId]:null}}),this._instanceInfos.delete(t),this._aliveInstances.delete(e.instanceId))}handleAutorunDependencyChanged(t,e,n){let o=this._getAutorunInfo(t);o&&o.changedObservables.add(e)}handleAutorunStarted(t){}handleAutorunFinished(t){let e=this._getAutorunInfo(t);e&&(e.changedObservables.clear(),e.updateCount++,this._handleChange({instances:{[e.instanceId]:{runCount:e.updateCount}}}))}handleDerivedDependencyChanged(t,e,n){let o=this._getObservableInfo(t);o&&o.changedObservables.add(e)}_handleDerivedRecomputed(t,e){let n=this._getObservableInfo(t);if(!n)return;let o=Lr(e.newValue,30);n.updateCount++,n.changedObservables.clear(),n.lastValue=o,n.listenerCount>0&&this._handleChange({instances:{[n.instanceId]:{formattedValue:o,recomputationCount:n.updateCount}}})}handleDerivedCleared(t){let e=this._getObservableInfo(t);e&&(e.lastValue=void 0,e.changedObservables.clear(),e.listenerCount>0&&this._handleChange({instances:{[e.instanceId]:{formattedValue:void 0}}}))}handleBeginTransaction(t){this._activeTransactions.add(t)}handleEndTransaction(t){this._activeTransactions.delete(t)}};function MH(r,t){let e=t?.debugNamePostProcessor??(i=>i),n=Ec.from(r,e);if(!n)return"";let o=new Set;return t.type==="observers"?OH(n,0,o,t).trim():LH(n,0,o,t).trim()}function LH(r,t,e,n){let o="		".repeat(t),i=[];if(e.has(r.sourceObj))return i.push(`${o}* ${r.type} ${r.name} (already listed)`),i.join(`
`);if(e.add(r.sourceObj),i.push(`${o}* ${r.type} ${r.name}:`),i.push(`${o}  value: ${Lr(r.value,50)}`),i.push(`${o}  state: ${r.state}`),r.dependencies.length>0){i.push(`${o}  dependencies:`);for(let a of r.dependencies){let l=Ec.from(a,n.debugNamePostProcessor??(d=>d))??Ec.unknown(a);i.push(LH(l,t+1,e,n))}}return i.join(`
`)}function OH(r,t,e,n){let o="		".repeat(t),i=[];if(e.has(r.sourceObj))return i.push(`${o}* ${r.type} ${r.name} (already listed)`),i.join(`
`);if(e.add(r.sourceObj),i.push(`${o}* ${r.type} ${r.name}:`),i.push(`${o}  value: ${Lr(r.value,50)}`),i.push(`${o}  state: ${r.state}`),r.observers.length>0){i.push(`${o}  observers:`);for(let a of r.observers){let l=Ec.from(a,n.debugNamePostProcessor??(d=>d))??Ec.unknown(a);i.push(OH(l,t+1,e,n))}}return i.join(`
`)}var Ec=class r{constructor(t,e,n,o,i,s,a){this.sourceObj=t;this.name=e;this.type=n;this.value=o;this.state=i;this.dependencies=s;this.observers=a}static from(t,e){if(t instanceof ga){let n=t.debugGetState();return new r(t,e(t.debugName),"autorun",void 0,n.stateStr,Array.from(n.dependencies),[])}else if(t instanceof Qn){let n=t.debugGetState();return new r(t,e(t.debugName),"derived",n.value,n.stateStr,Array.from(n.dependencies),Array.from(t.debugGetObservers()))}else if(t instanceof ps){let n=t.debugGetState();return new r(t,e(t.debugName),"observableValue",n.value,"upToDate",[],Array.from(t.debugGetObservers()))}else if(t instanceof Jr){let n=t.debugGetState();return new r(t,e(t.debugName),"fromEvent",n.value,n.hasValue?"upToDate":"initial",[],Array.from(t.debugGetObservers()))}}static unknown(t){return new r(t,"(unknown)","unknown",void 0,"unknown",[],[])}};PH(MH);xH(RH);var p3=!1;p3&&pv(new vv);Do&&Do.VSCODE_DEV_DEBUG_OBSERVABLES&&pv(Dx.getInstance());var kn;(i=>{i.Internal={type:"internal",label:"Built-In"},i.External={type:"external",label:"External"};function e(s){switch(s.type){case"extension":return`extension:${s.extensionId.value}`;case"mcp":return`mcp:${s.collectionId}:${s.definitionId}`;case"user":return`user:${s.file.toString()}`;case"internal":return"internal";case"external":return"external"}}i.toKey=e;function n(s,a){return e(s)===e(a)}i.equals=n;function o(s){return s.type==="internal"?{ordinal:1,label:p(8698,null)}:s.type==="mcp"?{ordinal:2,label:s.label}:s.type==="user"?{ordinal:0,label:p(8700,null)}:{ordinal:3,label:s.label}}i.classify=o})(kn||={});function NH(r){return r!==null&&typeof r=="object"&&b.isUri(r.sessionResource)}function UH(r){return typeof r=="object"&&typeof r?.input=="string"&&(typeof r?.output=="string"||Array.isArray(r?.output))}function FH(r){return typeof r=="object"&&typeof r?.output=="object"&&typeof r?.output?.mimeType=="string"&&r?.output?.type==="data"}function HH(r){return!!r&&r.getTools!==void 0}var wc=R("ILanguageModelToolsService");var m3;(a=>(a.execute="execute",a.edit="edit",a.search="search",a.agent="agent",a.read="read",a.web="web",a.todo="todo"))(m3||={});var bv;(e=>(e.runSubagent="runSubagent",e.vscode="vscode"))(bv||={});var ms=R("productService"),WH="vscode://schemas/vscode-product";var Kt=R("configurationService");function Rx(r,t){let e=Object.create(null);for(let n in r)oA(e,n,r[n],t);return e}function oA(r,t,e,n){let o=t.split("."),i=o.pop(),s=r;for(let a=0;a<o.length;a++){let l=o[a],d=s[l];switch(typeof d){case"undefined":d=s[l]=Object.create(null);break;case"object":if(d===null){n(`Ignoring ${t} as ${o.slice(0,a+1).join(".")} is null`);return}break;default:n(`Ignoring ${t} as ${o.slice(0,a+1).join(".")} is ${JSON.stringify(d)}`);return}s=d}if(typeof s=="object"&&s!==null)try{s[i]=e}catch{n(`Ignoring ${t} as ${o.join(".")} is ${JSON.stringify(s)}`)}else n(`Ignoring ${t} as ${o.join(".")} is ${JSON.stringify(s)}`)}function VH(r,t){let e=t.split(".");BH(r,e)}function BH(r,t){if(!r)return;let e=r,n=t.shift();if(t.length===0){delete e[n];return}if(Object.keys(e).indexOf(n)!==-1){let o=e[n];typeof o=="object"&&!Array.isArray(o)&&(BH(o,t),Object.keys(o).length===0&&delete e[n])}}function yv(r,t,e){function n(s,a){let l=s;for(let d of a){if(typeof l!="object"||l===null)return;l=l[d]}return l}let o=t.split("."),i=n(r,o);return typeof i>"u"?e:i}function $H(r){return r.replace(/^\[/,"").replace(/]$/g,"").replace(/\]\[/g,", ")}function zH(r){let t=!1,e=new Map,n=new Map;if(g3(r,c=>{if(r===c)return!0;let u=JSON.stringify(c);if(u.length<30)return!0;let m=e.get(u);if(!m){let g={schemas:[c]};return e.set(u,g),n.set(c,g),!0}return m.schemas.push(c),n.set(c,m),t=!0,!1}),e.clear(),!t)return JSON.stringify(r);let i="$defs";for(;r.hasOwnProperty(i);)i+="_";let s=[];function a(c){return JSON.stringify(c,(u,m)=>{if(m!==c){let g=n.get(m);if(g&&g.schemas.length>1)return g.id||(g.id=`_${s.length}`,s.push(g.schemas[0])),{$ref:`#/${i}/${g.id}`}}return m})}let l=a(r),d=[];for(let c=0;c<s.length;c++)d.push(`"_${c}":${a(s[c])}`);return d.length?`${l.substring(0,l.length-1)},"${i}":{${d.join(",")}}}`:l}function Fp(r){return typeof r=="object"&&r!==null}function g3(r,t){if(!r||typeof r!="object")return;let e=(...l)=>{for(let d of l)Fp(d)&&s.push(d)},n=(...l)=>{for(let d of l)if(Fp(d))for(let c in d){let u=d[c];Fp(u)&&s.push(u)}},o=(...l)=>{for(let d of l)if(Array.isArray(d))for(let c of d)Fp(c)&&s.push(c)},i=l=>{if(Array.isArray(l))for(let d of l)Fp(d)&&s.push(d);else Fp(l)&&s.push(l)},s=[r],a=s.pop();for(;a;)t(a)&&(e(a.additionalItems,a.additionalProperties,a.not,a.contains,a.propertyNames,a.if,a.then,a.else,a.unevaluatedItems,a.unevaluatedProperties),n(a.definitions,a.$defs,a.properties,a.patternProperties,a.dependencies,a.dependentSchemas),o(a.anyOf,a.allOf,a.oneOf,a.prefixItems),i(a.items)),a=s.pop()}var kc={JSONContribution:"base.contributions.json"};function qH(r){return r.length>0&&r.charAt(r.length-1)==="#"?r.substring(0,r.length-1):r}var rA=class extends O{constructor(){super(...arguments);this.schemasById={};this.schemaAssociations={};this._onDidChangeSchema=this._register(new E);this.onDidChangeSchema=this._onDidChangeSchema.event;this._onDidChangeSchemaAssociations=this._register(new E);this.onDidChangeSchemaAssociations=this._onDidChangeSchemaAssociations.event}registerSchema(e,n,o){let i=qH(e);this.schemasById[i]=n,this._onDidChangeSchema.fire(e),o&&o.add(K(()=>{delete this.schemasById[i],this._onDidChangeSchema.fire(e)}))}registerSchemaAssociation(e,n){let o=qH(e);return this.schemaAssociations[o]||(this.schemaAssociations[o]=[]),this.schemaAssociations[o].includes(n)||(this.schemaAssociations[o].push(n),this._onDidChangeSchemaAssociations.fire()),K(()=>{let i=this.schemaAssociations[o];if(i){let s=i.indexOf(n);s!==-1&&(i.splice(s,1),i.length===0&&delete this.schemaAssociations[o],this._onDidChangeSchemaAssociations.fire())}})}notifySchemaChanged(e){this._onDidChangeSchema.fire(e)}getSchemaContributions(){return{schemas:this.schemasById}}getSchemaContent(e){let n=this.schemasById[e];return n?zH(n):void 0}hasSchemaContent(e){return!!this.schemasById[e]}getSchemaAssociations(){return this.schemaAssociations}},f3=new rA;vt.add(kc.JSONContribution,f3);var xr={Configuration:"base.contributions.configuration"};function h3(r,t){return r===t?!0:!r||!t?!1:typeof r=="string"||typeof t=="string"?r===t:r.id===t.id}var Ax={properties:{},patternProperties:{}},Mx={properties:{},patternProperties:{}},Lx={properties:{},patternProperties:{}},Ox={properties:{},patternProperties:{}},Nx={properties:{},patternProperties:{}},Ux={properties:{},patternProperties:{}},Iv={properties:{},patternProperties:{}},Pc="vscode://schemas/settings/resourceLanguage";var Fx=vt.as(kc.JSONContribution),iA=class extends O{constructor(){super();this.registeredConfigurationDefaults=[];this.overrideIdentifiers=new Set;this._onDidSchemaChange=this._register(new E);this.onDidSchemaChange=this._onDidSchemaChange.event;this._onDidUpdateConfiguration=this._register(new E);this.onDidUpdateConfiguration=this._onDidUpdateConfiguration.event;this.configurationDefaultsOverrides=new Map,this.defaultLanguageConfigurationOverridesNode={id:"defaultOverrides",title:p(1905,null),properties:{}},this.configurationContributors=[this.defaultLanguageConfigurationOverridesNode],this.resourceLanguageSettingsSchema={properties:{},patternProperties:{},additionalProperties:!0,allowTrailingCommas:!0,allowComments:!0},this.configurationProperties={},this.policyConfigurations=new Map,this.excludedConfigurationProperties={},Fx.registerSchema(Pc,this.resourceLanguageSettingsSchema),this.registerOverridePropertyPatternKey()}registerConfiguration(e,n=!0){return this.registerConfigurations([e],n),e}registerConfigurations(e,n=!0){let o=new Set;this.doRegisterConfigurations(e,n,o),Fx.registerSchema(Pc,this.resourceLanguageSettingsSchema),this._onDidSchemaChange.fire(),this._onDidUpdateConfiguration.fire({properties:o})}deregisterConfigurations(e){let n=new Set;this.doDeregisterConfigurations(e,n),Fx.registerSchema(Pc,this.resourceLanguageSettingsSchema),this._onDidSchemaChange.fire(),this._onDidUpdateConfiguration.fire({properties:n})}updateConfigurations({add:e,remove:n}){let o=new Set;this.doDeregisterConfigurations(n,o),this.doRegisterConfigurations(e,!1,o),Fx.registerSchema(Pc,this.resourceLanguageSettingsSchema),this._onDidSchemaChange.fire(),this._onDidUpdateConfiguration.fire({properties:o})}registerDefaultConfigurations(e){let n=new Set;this.doRegisterDefaultConfigurations(e,n),this._onDidSchemaChange.fire(),this._onDidUpdateConfiguration.fire({properties:n,defaultsOverrides:!0})}doRegisterDefaultConfigurations(e,n){this.registeredConfigurationDefaults.push(...e);let o=[];for(let{overrides:i,source:s}of e)for(let a in i){n.add(a);let l=this.configurationDefaultsOverrides.get(a)??this.configurationDefaultsOverrides.set(a,{configurationDefaultOverrides:[]}).get(a),d=i[a];if(l.configurationDefaultOverrides.push({value:d,source:s}),Xr.test(a)){let c=this.mergeDefaultConfigurationsForOverrideIdentifier(a,d,s,l.configurationDefaultOverrideValue);if(!c)continue;l.configurationDefaultOverrideValue=c,this.updateDefaultOverrideProperty(a,c,s),o.push(...Hp(a))}else{let c=this.mergeDefaultConfigurationsForConfigurationProperty(a,d,s,l.configurationDefaultOverrideValue);if(!c)continue;l.configurationDefaultOverrideValue=c;let u=this.configurationProperties[a];u&&(this.updatePropertyDefaultValue(a,u),this.updateSchema(a,u))}}this.doRegisterOverrideIdentifiers(o)}deregisterDefaultConfigurations(e){let n=new Set;this.doDeregisterDefaultConfigurations(e,n),this._onDidSchemaChange.fire(),this._onDidUpdateConfiguration.fire({properties:n,defaultsOverrides:!0})}doDeregisterDefaultConfigurations(e,n){for(let o of e){let i=this.registeredConfigurationDefaults.indexOf(o);i!==-1&&this.registeredConfigurationDefaults.splice(i,1)}for(let{overrides:o,source:i}of e)for(let s in o){let a=this.configurationDefaultsOverrides.get(s);if(!a)continue;let l=a.configurationDefaultOverrides.findIndex(d=>i?h3(d.source,i):d.value===o[s]);if(l!==-1){if(a.configurationDefaultOverrides.splice(l,1),a.configurationDefaultOverrides.length===0&&this.configurationDefaultsOverrides.delete(s),Xr.test(s)){let d;for(let c of a.configurationDefaultOverrides)d=this.mergeDefaultConfigurationsForOverrideIdentifier(s,c.value,c.source,d);d&&!tp(d.value)?(a.configurationDefaultOverrideValue=d,this.updateDefaultOverrideProperty(s,d,i)):(this.configurationDefaultsOverrides.delete(s),delete this.configurationProperties[s],delete this.defaultLanguageConfigurationOverridesNode.properties[s])}else{let d;for(let u of a.configurationDefaultOverrides)d=this.mergeDefaultConfigurationsForConfigurationProperty(s,u.value,u.source,d);a.configurationDefaultOverrideValue=d;let c=this.configurationProperties[s];c&&(this.updatePropertyDefaultValue(s,c),this.updateSchema(s,c))}n.add(s)}}this.updateOverridePropertyPatternKey()}updateDefaultOverrideProperty(e,n,o){let i={section:{id:this.defaultLanguageConfigurationOverridesNode.id,title:this.defaultLanguageConfigurationOverridesNode.title,order:this.defaultLanguageConfigurationOverridesNode.order,extensionInfo:this.defaultLanguageConfigurationOverridesNode.extensionInfo},type:"object",default:n.value,description:p(1904,null,$H(e)),$ref:Pc,defaultDefaultValue:n.value,source:o,defaultValueSource:o};this.configurationProperties[e]=i,this.defaultLanguageConfigurationOverridesNode.properties[e]=i}mergeDefaultConfigurationsForOverrideIdentifier(e,n,o,i){let s=i?.value||{},a=i?.source??new Map;if(!(a instanceof Map)){console.error("objectConfigurationSources is not a Map");return}for(let l of Object.keys(n)){let d=n[l];if(it(d)&&(Zu(s[l])||it(s[l]))){if(s[l]={...s[l]??{},...d},o)for(let u in d)a.set(`${l}.${u}`,o)}else s[l]=d,o?a.set(l,o):a.delete(l)}return{value:s,source:a}}mergeDefaultConfigurationsForConfigurationProperty(e,n,o,i){let s=this.configurationProperties[e],a=i?.value??s?.defaultDefaultValue,l=o;if(it(n)&&(s!==void 0&&s.type==="object"||s===void 0&&(Zu(a)||it(a)))){if(l=i?.source??new Map,!(l instanceof Map)){console.error("defaultValueSource is not a Map");return}for(let c in n)o&&l.set(`${e}.${c}`,o);n={...it(a)?a:{},...n}}return{value:n,source:l}}deltaConfiguration(e){let n=!1,o=new Set;e.removedDefaults&&(this.doDeregisterDefaultConfigurations(e.removedDefaults,o),n=!0),e.addedDefaults&&(this.doRegisterDefaultConfigurations(e.addedDefaults,o),n=!0),e.removedConfigurations&&this.doDeregisterConfigurations(e.removedConfigurations,o),e.addedConfigurations&&this.doRegisterConfigurations(e.addedConfigurations,!1,o),this._onDidSchemaChange.fire(),this._onDidUpdateConfiguration.fire({properties:o,defaultsOverrides:n})}notifyConfigurationSchemaUpdated(...e){this._onDidSchemaChange.fire()}registerOverrideIdentifiers(e){this.doRegisterOverrideIdentifiers(e),this._onDidSchemaChange.fire()}doRegisterOverrideIdentifiers(e){for(let n of e)this.overrideIdentifiers.add(n);this.updateOverridePropertyPatternKey()}doRegisterConfigurations(e,n,o){e.forEach(i=>{this.validateAndRegisterProperties(i,n,i.extensionInfo,i.restrictedProperties,void 0,o),this.configurationContributors.push(i),this.registerJSONConfiguration(i)})}doDeregisterConfigurations(e,n){let o=i=>{if(i.properties)for(let s in i.properties){n.add(s);let a=this.configurationProperties[s];a?.policy?.name&&this.policyConfigurations.delete(a.policy.name),delete this.configurationProperties[s],this.removeFromSchema(s,i.properties[s])}i.allOf?.forEach(s=>o(s))};for(let i of e){o(i);let s=this.configurationContributors.indexOf(i);s!==-1&&this.configurationContributors.splice(s,1)}}validateAndRegisterProperties(e,n=!0,o,i,s=4,a){s=Ot(e.scope)?s:e.scope;let l=e.properties;if(l)for(let c in l){let u=l[c];if(u.section={id:e.id,title:e.title,order:e.order,extensionInfo:e.extensionInfo},n&&b3(c,u,o?.id)){delete l[c];continue}u.source=o,u.defaultDefaultValue=l[c].default,this.updatePropertyDefaultValue(c,u),Xr.test(c)?u.scope=void 0:(u.scope=Ot(u.scope)?s:u.scope,u.restricted=Ot(u.restricted)?!!i?.includes(c):u.restricted),u.experiment?u.tags?.some(h=>h.toLowerCase()==="onexp")||(u.tags=u.tags??[],u.tags.push("onExP")):u.tags?.some(h=>h.toLowerCase()==="onexp")&&(console.error(`Invalid tag 'onExP' found for property '${c}'. Please use 'experiment' property instead.`),u.experiment={mode:"startup"});let m=l[c].hasOwnProperty("included")&&!l[c].included,g=l[c].policy?.name;m?(this.excludedConfigurationProperties[c]=l[c],g&&(this.policyConfigurations.set(g,c),a.add(c)),delete l[c]):(a.add(c),g&&this.policyConfigurations.set(g,c),this.configurationProperties[c]=l[c],!l[c].deprecationMessage&&l[c].markdownDeprecationMessage&&(l[c].deprecationMessage=l[c].markdownDeprecationMessage))}let d=e.allOf;if(d)for(let c of d)this.validateAndRegisterProperties(c,n,o,i,s,a)}getConfigurations(){return this.configurationContributors}getConfigurationProperties(){return this.configurationProperties}getPolicyConfigurations(){return this.policyConfigurations}getExcludedConfigurationProperties(){return this.excludedConfigurationProperties}getRegisteredDefaultConfigurations(){return[...this.registeredConfigurationDefaults]}getConfigurationDefaultsOverrides(){let e=new Map;for(let[n,o]of this.configurationDefaultsOverrides)o.configurationDefaultOverrideValue&&e.set(n,o.configurationDefaultOverrideValue);return e}registerJSONConfiguration(e){let n=o=>{let i=o.properties;if(i)for(let a in i)this.updateSchema(a,i[a]);o.allOf?.forEach(n)};n(e)}updateSchema(e,n){switch(Ax.properties[e]=n,n.scope){case 1:Mx.properties[e]=n;break;case 2:Ox.properties[e]=n;break;case 3:Lx.properties[e]=n;break;case 7:Nx.properties[e]=n;break;case 4:Ux.properties[e]=n;break;case 5:Iv.properties[e]=n;break;case 6:Iv.properties[e]=n,this.resourceLanguageSettingsSchema.properties[e]=n;break}}removeFromSchema(e,n){switch(delete Ax.properties[e],n.scope){case 1:delete Mx.properties[e];break;case 2:delete Ox.properties[e];break;case 3:delete Lx.properties[e];break;case 7:delete Nx.properties[e];break;case 4:delete Ux.properties[e];break;case 5:case 6:delete Iv.properties[e],delete this.resourceLanguageSettingsSchema.properties[e];break}}updateOverridePropertyPatternKey(){for(let e of this.overrideIdentifiers.values()){let n=`[${e}]`,o={type:"object",description:p(1906,null),errorMessage:p(1907,null),$ref:Pc};this.updatePropertyDefaultValue(n,o),Ax.properties[n]=o,Mx.properties[n]=o,Lx.properties[n]=o,Ox.properties[n]=o,Nx.properties[n]=o,Ux.properties[n]=o,Iv.properties[n]=o}}registerOverridePropertyPatternKey(){let e={type:"object",description:p(1906,null),errorMessage:p(1907,null),$ref:Pc};Ax.patternProperties[Dl]=e,Mx.patternProperties[Dl]=e,Lx.patternProperties[Dl]=e,Ox.patternProperties[Dl]=e,Nx.patternProperties[Dl]=e,Ux.patternProperties[Dl]=e,Iv.patternProperties[Dl]=e,this._onDidSchemaChange.fire()}updatePropertyDefaultValue(e,n){let o=this.configurationDefaultsOverrides.get(e)?.configurationDefaultOverrideValue,i,s;o&&(!n.disallowConfigurationDefault||!o.source)&&(i=o.value,s=o.source),Zu(i)&&(i=n.defaultDefaultValue,s=void 0),Zu(i)&&(i=v3(n.type)),n.default=i,n.defaultValueSource=s}},jH="\\[([^\\]]+)\\]",KH=new RegExp(jH,"g"),Dl=`^(${jH})+$`,Xr=new RegExp(Dl);function Hp(r){let t=[];if(Xr.test(r)){let e=KH.exec(r);for(;e?.length;){let n=e[1].trim();n&&t.push(n),e=KH.exec(r)}}return Br(t)}function v3(r){switch(Array.isArray(r)?r[0]:r){case"boolean":return!1;case"integer":case"number":return 0;case"string":return"";case"array":return[];case"object":return{};default:return null}}var Hx=new iA;vt.add(xr.Configuration,Hx);function b3(r,t,e){return r.trim()?Xr.test(r)?p(1903,null,r):Hx.getConfigurationProperties()[r]!==void 0&&(!e||!y3.has(e.toLowerCase()))?p(1901,null,r):t.policy?.name&&Hx.getPolicyConfigurations().get(t.policy?.name)!==void 0?p(1900,null,r,t.policy?.name,Hx.getPolicyConfigurations().get(t.policy?.name)):null:p(1902,null)}var y3=new Set(Yo.defaultChatAgent?[Yo.defaultChatAgent.extensionId,Yo.defaultChatAgent.chatExtensionId].map(r=>r.toLowerCase()):[]);var Bx=R("requestService");var aA=class{constructor(t){this.original=t}toJSON(){if(!this.headers){let t=Object.create(null);for(let e in this.original)e.toLowerCase()==="authorization"||e.toLowerCase()==="proxy-authorization"?t[e]="*****":t[e]=this.original[e];this.headers=t}return this.headers}},Wx=class extends O{constructor(e){super();this.logService=e;this.counter=0;this._onDidCompleteRequest=this._register(new E);this.onDidCompleteRequest=this._onDidCompleteRequest.event}async logAndRequest(e,n){let o=`#${++this.counter}: ${e.url}`;this.logService.trace(`${o} - begin`,e.type,new aA(e.headers??{}));let i=Date.now();try{let s=await n();return this.logService.trace(`${o} - end`,e.type,s.res.statusCode,s.res.headers),this._onDidCompleteRequest.fire({callSite:e.callSite,latency:Date.now()-i,statusCode:s.res.statusCode}),s}catch(s){throw this.logService.error(`${o} - error`,e.type,Xi(s)),s}}};function I3(r){return r.res.statusCode&&r.res.statusCode>=200&&r.res.statusCode<300||r.res.statusCode===1223}function JH(r){return r.res.statusCode===204}async function lA(r){return JH(r)?null:(await P_(r.stream)).toString()}async function YH(r){if(!I3(r))throw new Error("Server returned "+r.res.statusCode);if(JH(r))return null;let e=(await P_(r.stream)).toString();try{return JSON.parse(e)}catch(n){throw n.message+=`:
`+e,n}}var Wp=!1,sA=[],GH,QH;function x3(r=!0,t=!0){if(GH===r&&QH===t)return;GH=r,QH=t;let e=vt.as(xr.Configuration),n=sA;sA=[{id:"http",order:15,title:p(2332,null),type:"object",scope:2,properties:{"http.useLocalProxyConfiguration":{type:"boolean",default:t,markdownDescription:p(2347,null),restricted:!0}}},{id:"http",order:15,title:p(2332,null),type:"object",scope:1,properties:{"http.electronFetch":{type:"boolean",default:!1,description:p(2330,null),restricted:!0}}},{id:"http",order:15,title:p(2332,null),type:"object",scope:r?1:2,properties:{"http.proxy":{type:"string",pattern:"^(https?|socks|socks4a?|socks5h?)://([^:]*(:[^@]*)?@)?([^:]+|\\[[:0-9a-fA-F]+\\])(:\\d+)?/?$|^$",markdownDescription:p(2335,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0},"http.proxyStrictSSL":{type:"boolean",default:!0,markdownDescription:p(2343,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0},"http.proxyKerberosServicePrincipal":{type:"string",markdownDescription:p(2337,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0},"http.noProxy":{type:"array",items:{type:"string"},markdownDescription:p(2334,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0},"http.proxyAuthorization":{type:["null","string"],default:null,markdownDescription:p(2336,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0},"http.proxySupport":{type:"string",enum:["off","on","fallback","override"],enumDescriptions:[p(2340,null),p(2341,null),p(2339,null),p(2342,null)],default:"override",markdownDescription:p(2338,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0},"http.systemCertificates":{type:"boolean",default:!0,markdownDescription:p(2344,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0},"http.systemCertificatesNode":{type:"boolean",tags:["experimental"],default:Wp,markdownDescription:p(2345,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0,experiment:{mode:"auto"}},"http.experimental.systemCertificatesV2":{type:"boolean",tags:["experimental"],default:!1,markdownDescription:p(2346,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0},"http.fetchAdditionalSupport":{type:"boolean",default:!0,markdownDescription:p(2331,null,"`#http.useLocalProxyConfiguration#`","`#http.proxySupport#`","`#http.systemCertificates#`"),restricted:!0},"http.webSocketAdditionalSupport":{type:"boolean",default:!0,markdownDescription:p(2348,null,"`#http.useLocalProxyConfiguration#`","`#http.proxySupport#`","`#http.systemCertificates#`"),restricted:!0},"http.experimental.networkInterfaceCheckInterval":{type:"number",default:300,minimum:-1,tags:["experimental"],markdownDescription:p(2333,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0,experiment:{mode:"auto"}}}}],e.updateConfigurations({add:sA,remove:n})}x3();var dA=class{constructor(t){this.options=t}getItemLabel(t){return t.label}getItemDescription(t){if(!this.options?.skipDescription)return t.description}getItemPath(t){if(!this.options?.skipPath)return t.resource?.scheme===V.file?t.resource.fsPath:t.resource?.path}},Vpe=new dA,XH=R("quickInputService");var ZH=R("encryptionService"),zpe=R("encryptionMainService");var Vp=class r extends O{constructor(e,n=Object.create(null)){super();this.database=e;this.options=n;this._onDidChangeStorage=this._register(new os);this.onDidChangeStorage=this._onDidChangeStorage.event;this.state=0;this.cache=new Map;this.flushDelayer=this._register(new vi(r.DEFAULT_FLUSH_DELAY));this.pendingDeletes=new Set;this.pendingInserts=new Map;this.pendingClose=void 0;this.whenFlushedCallbacks=[];this.registerListeners()}static{this.DEFAULT_FLUSH_DELAY=100}registerListeners(){this._register(this.database.onDidChangeItemsExternal(e=>this.onDidChangeItemsExternal(e)))}onDidChangeItemsExternal(e){this._onDidChangeStorage.pause();try{e.changed?.forEach((n,o)=>this.acceptExternal(o,n)),e.deleted?.forEach(n=>this.acceptExternal(n,void 0))}finally{this._onDidChangeStorage.resume()}}acceptExternal(e,n){if(this.state===2)return;let o=!1;Ot(n)?o=this.cache.delete(e):this.cache.get(e)!==n&&(this.cache.set(e,n),o=!0),o&&this._onDidChangeStorage.fire({key:e,external:!0})}get items(){return this.cache}get size(){return this.cache.size}async init(){this.state===0&&(this.state=1,this.options.hint!==0&&(this.cache=await this.database.getItems()))}get(e,n){let o=this.cache.get(e);return Ot(o)?n:o}getBoolean(e,n){let o=this.get(e);return Ot(o)?n:o==="true"}getNumber(e,n){let o=this.get(e);return Ot(o)?n:parseInt(o,10)}getObject(e,n){let o=this.get(e);return Ot(o)?n:AI(o)}async set(e,n,o=!1){if(this.state===2)return;if(Ot(n))return this.delete(e,o);let i=it(n)||Array.isArray(n)?TF(n):String(n);if(this.cache.get(e)!==i)return this.cache.set(e,i),this.pendingInserts.set(e,i),this.pendingDeletes.delete(e),this._onDidChangeStorage.fire({key:e,external:o}),this.doFlush()}async delete(e,n=!1){if(!(this.state===2||!this.cache.delete(e)))return this.pendingDeletes.has(e)||this.pendingDeletes.add(e),this.pendingInserts.delete(e),this._onDidChangeStorage.fire({key:e,external:n}),this.doFlush()}async optimize(){if(this.state!==2)return await this.flush(0),this.database.optimize()}async close(){return this.pendingClose||(this.pendingClose=this.doClose()),this.pendingClose}async doClose(){this.state=2;try{await this.doFlush(0)}catch{}await this.database.close(()=>this.cache)}get hasPending(){return this.pendingInserts.size>0||this.pendingDeletes.size>0}async flushPending(){if(!this.hasPending)return;let e={insert:this.pendingInserts,delete:this.pendingDeletes};return this.pendingDeletes=new Set,this.pendingInserts=new Map,this.database.updateItems(e).finally(()=>{if(!this.hasPending)for(;this.whenFlushedCallbacks.length;)this.whenFlushedCallbacks.pop()?.()})}async flush(e){if(!(this.state===2||this.pendingClose))return this.doFlush(e)}async doFlush(e){return this.options.hint===1?this.flushPending():this.flushDelayer.trigger(()=>this.flushPending(),e)}async whenFlushed(){if(this.hasPending)return new Promise(e=>this.whenFlushedCallbacks.push(e))}isInMemory(){return this.options.hint===1}},Bp=class{constructor(){this.onDidChangeItemsExternal=he.None;this.items=new Map}async getItems(){return this.items}async updateItems(t){t.insert?.forEach((e,n)=>this.items.set(n,e)),t.delete?.forEach(e=>this.items.delete(e))}async optimize(){}async close(){}};var xv=R("environmentService"),eW=xv;var $x=R("IUriIdentityService");function tW(r){let t=r;return!!(t&&typeof t=="object"&&typeof t.id=="string"&&typeof t.isDefault=="boolean"&&typeof t.name=="string"&&b.isUri(t.location)&&b.isUri(t.globalStorageHome)&&b.isUri(t.settingsResource)&&b.isUri(t.keybindingsResource)&&b.isUri(t.tasksResource)&&b.isUri(t.snippetsHome)&&b.isUri(t.promptsHome)&&b.isUri(t.extensionsResource)&&b.isUri(t.mcpResource))}var nW=R("IUserDataProfilesService");function zx(r,t,e,n,o,i){return{id:r,name:t,location:e,isDefault:!1,icon:o?.icon,globalStorageHome:i&&o?.useDefaultFlags?.globalState?i.globalStorageHome:Et(e,"globalStorage"),settingsResource:i&&o?.useDefaultFlags?.settings?i.settingsResource:Et(e,"settings.json"),keybindingsResource:i&&o?.useDefaultFlags?.keybindings?i.keybindingsResource:Et(e,"keybindings.json"),tasksResource:i&&o?.useDefaultFlags?.tasks?i.tasksResource:Et(e,"tasks.json"),snippetsHome:i&&o?.useDefaultFlags?.snippets?i.snippetsHome:Et(e,"snippets"),promptsHome:i&&o?.useDefaultFlags?.prompts?i.promptsHome:Et(e,"prompts"),extensionsResource:i&&o?.useDefaultFlags?.extensions?i.extensionsResource:Et(e,"extensions.json"),mcpResource:i&&o?.useDefaultFlags?.mcp?i.mcpResource:Et(e,"mcp.json"),cacheHome:Et(n,r),useDefaultFlags:o?.useDefaultFlags,isTransient:o?.transient,workspaces:o?.workspaces}}var qx=class extends O{constructor(e,n,o,i){super();this.environmentService=e;this.fileService=n;this.uriIdentityService=o;this.logService=i;this._onDidChangeProfiles=this._register(new E);this.onDidChangeProfiles=this._onDidChangeProfiles.event;this._onWillCreateProfile=this._register(new E);this.onWillCreateProfile=this._onWillCreateProfile.event;this._onWillRemoveProfile=this._register(new E);this.onWillRemoveProfile=this._onWillRemoveProfile.event;this._onDidResetWorkspaces=this._register(new E);this.onDidResetWorkspaces=this._onDidResetWorkspaces.event;this.profileCreationPromises=new Map;this.transientProfilesObject={profiles:[],emptyWindows:new Map};this.profilesHome=Et(this.environmentService.userRoamingDataHome,"profiles"),this.profilesCacheHome=Et(this.environmentService.cacheHome,"CachedProfilesData")}static{this.PROFILES_KEY="userDataProfiles"}static{this.PROFILE_ASSOCIATIONS_KEY="profileAssociations"}get defaultProfile(){return this.profiles[0]}get profiles(){return[...this.profilesObject.profiles,...this.transientProfilesObject.profiles]}init(){this._profilesObject=void 0}get profilesObject(){if(!this._profilesObject){let e=this.createDefaultProfile(),n=[e];try{for(let i of this.getStoredProfiles()){if(this.isInvalidProfile(i)){this.logService.warn("Skipping the invalid stored profile",i.location||i.name);continue}let s=Tt(i.location);n.push(zx(s,i.name,i.location,this.profilesCacheHome,{icon:i.icon,useDefaultFlags:i.useDefaultFlags},e))}}catch(i){this.logService.error(i)}let o=new Map;if(n.length)try{let i=this.getStoredProfileAssociations();if(i.workspaces)for(let[s,a]of Object.entries(i.workspaces)){let l=b.parse(s),d=n.find(c=>c.id===a);if(d){let c=d.workspaces?d.workspaces.slice(0):[];c.push(l),d.workspaces=c}}if(i.emptyWindows)for(let[s,a]of Object.entries(i.emptyWindows)){let l=n.find(d=>d.id===a);l&&o.set(s,l)}}catch(i){this.logService.error(i)}this._profilesObject={profiles:n,emptyWindows:o}}return this._profilesObject}isInvalidProfile(e){return!!(!e.name||!De(e.name)||!e.location||e.isSystem||this.uriIdentityService.extUri.basename(this.uriIdentityService.extUri.dirname(e.location))==="builtin")}createDefaultProfile(){let e=zx("__default__profile__",p(2760,null),this.environmentService.userRoamingDataHome,this.profilesCacheHome);return{...e,extensionsResource:this.getDefaultProfileExtensionsLocation()??e.extensionsResource,isDefault:!0}}async createTransientProfile(e){let n="Temp",o=new RegExp(`${pr(n)}\\s(\\d+)`),i=0;for(let a of this.profiles){let l=o.exec(a.name),d=l?parseInt(l[1]):0;i=d>i?d:i}let s=`${n} ${i+1}`;return this.createProfile(Gn(Ae()).toString(16),s,{transient:!0},e)}async createNamedProfile(e,n,o){return this.createProfile(Gn(Ae()).toString(16),e,n,o)}async createProfile(e,n,o,i){return await this.doCreateProfile(e,n,o,i)}async doCreateProfile(e,n,o,i){if(!De(n)||!n)throw new Error("Name of the profile is mandatory and must be of type `string`");let s=this.profileCreationPromises.get(n);return s||(s=(async()=>{try{if(this.profiles.find(u=>u.id===e||!u.isTransient&&!o?.transient&&u.name===n))throw new Error(`Profile with ${n} name already exists`);let l=i?this.getWorkspace(i):void 0;b.isUri(l)&&(o={...o,workspaces:[l]});let d=zx(e,n,this.uriIdentityService.extUri.joinPath(this.profilesHome,e),this.profilesCacheHome,o,this.defaultProfile);await this.fileService.createFolder(d.location);let c=[];return this._onWillCreateProfile.fire({profile:d,join(u){c.push(u)}}),await Kr.settled(c),l&&!b.isUri(l)&&this.updateEmptyWindowAssociation(l,d,!!d.isTransient),this.updateProfiles([d],[],[]),d}finally{this.profileCreationPromises.delete(n)}})(),this.profileCreationPromises.set(n,s)),s}async updateProfile(e,n){let o=[];for(let s of this.profiles){let a;if(e.id===s.id)s.isDefault?n.workspaces&&(a=s,a.workspaces=n.workspaces):a=zx(s.id,n.name??s.name,s.location,this.profilesCacheHome,{icon:n.icon===null?void 0:n.icon??s.icon,transient:n.transient??s.isTransient,useDefaultFlags:n.useDefaultFlags??s.useDefaultFlags,workspaces:n.workspaces??s.workspaces},this.defaultProfile);else if(n.workspaces){let l=s.workspaces?.filter(d=>!n.workspaces?.some(c=>this.uriIdentityService.extUri.isEqual(d,c)));s.workspaces?.length!==l?.length&&(a=s,a.workspaces=l)}a&&o.push(a)}if(!o.length)throw e.isDefault?new Error("Cannot update default profile"):new Error(`Profile '${e.name}' does not exist`);this.updateProfiles([],[],o);let i=this.profiles.find(s=>s.id===e.id);if(!i)throw new Error(`Profile '${e.name}' was not updated`);return i}async removeProfile(e){if(e.isDefault)throw new Error("Cannot remove default profile");let n=this.profiles.find(i=>i.id===e.id);if(!n)throw new Error(`Profile '${e.name}' does not exist`);let o=[];this._onWillRemoveProfile.fire({profile:n,join(i){o.push(i)}});try{await Promise.allSettled(o)}catch(i){this.logService.error(i)}this.updateProfiles([],[n],[]);try{await this.fileService.del(n.cacheHome,{recursive:!0})}catch(i){a2(i)!==1&&this.logService.error(i)}}async setProfileForWorkspace(e,n){let o=this.profiles.find(s=>s.id===n.id);if(!o)throw new Error(`Profile '${n.name}' does not exist`);let i=this.getWorkspace(e);if(b.isUri(i)){let s=o.workspaces?[...o.workspaces]:[];s.some(a=>this.uriIdentityService.extUri.isEqual(a,i))||(s.push(i),await this.updateProfile(o,{workspaces:s}))}else this.updateEmptyWindowAssociation(i,o,!1),this.updateStoredProfiles(this.profiles)}unsetWorkspace(e,n=!1){let o=this.getWorkspace(e);if(b.isUri(o)){let i=this.getProfileForWorkspace(e);i&&this.updateProfile(i,{workspaces:i.workspaces?.filter(s=>!this.uriIdentityService.extUri.isEqual(s,o))})}else this.updateEmptyWindowAssociation(o,void 0,n),this.updateStoredProfiles(this.profiles)}async resetWorkspaces(){this.transientProfilesObject.emptyWindows.clear(),this.profilesObject.emptyWindows.clear();for(let e of this.profiles)e.workspaces=void 0;this.updateProfiles([],[],this.profiles),this._onDidResetWorkspaces.fire()}async cleanUp(){try{if(await this.fileService.exists(this.profilesHome)){let e=this.uriIdentityService.extUri.joinPath(this.profilesHome,"builtin");if(await this.fileService.exists(e))try{await this.fileService.del(e,{recursive:!0})}catch(o){this.logService.error(o)}let n=await this.fileService.resolve(this.profilesHome);await Promise.all((n.children||[]).filter(o=>o.isDirectory&&this.profiles.every(i=>!this.uriIdentityService.extUri.isEqual(i.location,o.resource))).map(o=>this.fileService.del(o.resource,{recursive:!0})))}}catch(e){this.logService.error("Error deleting redundant profile folders",e)}try{let e=this.getStoredProfiles(),n=[];for(let o of this.getStoredProfiles())this.isInvalidProfile(o)?this.logService.warn(`Invalid user data profile found: ${o.name}`):n.push(o);e.length!==n.length&&this.saveStoredProfiles(n)}catch(e){this.logService.error("Error removing invalid stored profiles",e)}}async cleanUpTransientProfiles(){let e=this.transientProfilesObject.profiles.filter(n=>!this.isProfileAssociatedToWorkspace(n));await Promise.allSettled(e.map(n=>this.removeProfile(n)))}getProfileForWorkspace(e){let n=this.getWorkspace(e);return b.isUri(n)?this.profiles.find(o=>o.workspaces?.some(i=>this.uriIdentityService.extUri.isEqual(i,n))):this.profilesObject.emptyWindows.get(n)??this.transientProfilesObject.emptyWindows.get(n)}getWorkspace(e){return u2(e)?e.uri:p2(e)?e.configPath:e.id}isProfileAssociatedToWorkspace(e){return!!(e.workspaces?.length||[...this.profilesObject.emptyWindows.values()].some(n=>this.uriIdentityService.extUri.isEqual(n.location,e.location))||[...this.transientProfilesObject.emptyWindows.values()].some(n=>this.uriIdentityService.extUri.isEqual(n.location,e.location)))}updateProfiles(e,n,o,i=!1){let s=[...this.profiles,...e],a=this.transientProfilesObject.profiles;this.transientProfilesObject.profiles=[];let l=[];for(let d of s){if(n.some(c=>d.id===c.id)){for(let c of[...this.profilesObject.emptyWindows.keys()])d.id===this.profilesObject.emptyWindows.get(c)?.id&&this.profilesObject.emptyWindows.delete(c);continue}if(!d.isDefault){d=o.find(u=>d.id===u.id)??d;let c=a.find(u=>d.id===u.id);if(d.isTransient)this.transientProfilesObject.profiles.push(d);else if(c){for(let[u,m]of this.transientProfilesObject.emptyWindows.entries())if(d.id===m.id){this.transientProfilesObject.emptyWindows.delete(u),this.profilesObject.emptyWindows.set(u,d);break}}}d.workspaces?.length===0&&(d.workspaces=void 0),l.push(d)}this.updateStoredProfiles(l),i||this.triggerProfilesChanges(e,n,o)}triggerProfilesChanges(e,n,o){this._onDidChangeProfiles.fire({added:e,removed:n,updated:o,all:this.profiles})}updateEmptyWindowAssociation(e,n,o){o=n?.isTransient?!0:o,o?n?this.transientProfilesObject.emptyWindows.set(e,n):this.transientProfilesObject.emptyWindows.delete(e):(this.transientProfilesObject.emptyWindows.delete(e),n?this.profilesObject.emptyWindows.set(e,n):this.profilesObject.emptyWindows.delete(e))}updateStoredProfiles(e){let n=[],o={},i={};for(let s of e)if(!s.isTransient&&(s.isDefault||n.push({location:s.location,name:s.name,icon:s.icon,useDefaultFlags:s.useDefaultFlags}),s.workspaces))for(let a of s.workspaces)o[a.toString()]=s.id;for(let[s,a]of this.profilesObject.emptyWindows.entries())i[s.toString()]=a.id;this.saveStoredProfileAssociations({workspaces:o,emptyWindows:i}),this.saveStoredProfiles(n),this._profilesObject=void 0}getStoredProfiles(){return[]}saveStoredProfiles(e){throw new Error("not implemented")}getStoredProfileAssociations(){return{}}saveStoredProfileAssociations(e){throw new Error("not implemented")}getDefaultProfileExtensionsLocation(){}};qx=_([C(0,xv),C(1,da),C(2,$x),C(3,oe)],qx);var C3="__$__isNewStorageMarker",Kx="__$__targetStorageMarker",Sr=R("storageService");function T3(r){let t=r.get(Kx);if(t)try{return JSON.parse(t)}catch{}return Object.create(null)}var uA=class r extends O{constructor(e={flushInterval:r.DEFAULT_FLUSH_INTERVAL}){super();this._onDidChangeValue=this._register(new os);this._onDidChangeTarget=this._register(new os);this.onDidChangeTarget=this._onDidChangeTarget.event;this._onWillSaveState=this._register(new E);this.onWillSaveState=this._onWillSaveState.event;this.runFlushWhenIdle=this._register(new sn);this._workspaceKeyTargets=void 0;this._profileKeyTargets=void 0;this._applicationKeyTargets=void 0;this.flushWhenIdleScheduler=this._register(new jn(()=>this.doFlushWhenIdle(),e.flushInterval))}static{this.DEFAULT_FLUSH_INTERVAL=60*1e3}onDidChangeValue(e,n,o){return he.filter(this._onDidChangeValue.event,i=>i.scope===e&&(n===void 0||i.key===n),o)}doFlushWhenIdle(){this.runFlushWhenIdle.value=C_(()=>{this.shouldFlushWhenIdle()&&this.flush(),this.flushWhenIdleScheduler.schedule()})}shouldFlushWhenIdle(){return!0}stopFlushWhenIdle(){Cn([this.runFlushWhenIdle,this.flushWhenIdleScheduler])}initialize(){return this.initializationPromise||(this.initializationPromise=(async()=>{Ft("code/willInitStorage");try{await this.doInitialize()}finally{Ft("code/didInitStorage")}this.flushWhenIdleScheduler.schedule()})()),this.initializationPromise}emitDidChangeValue(e,n){let{key:o,external:i}=n;if(o===Kx){switch(e){case-1:this._applicationKeyTargets=void 0;break;case 0:this._profileKeyTargets=void 0;break;case 1:this._workspaceKeyTargets=void 0;break}this._onDidChangeTarget.fire({scope:e})}else this._onDidChangeValue.fire({scope:e,key:o,target:this.getKeyTargets(e)[o],external:i})}emitWillSaveState(e){this._onWillSaveState.fire({reason:e})}get(e,n,o){return this.getStorage(n)?.get(e,o)}getBoolean(e,n,o){return this.getStorage(n)?.getBoolean(e,o)}getNumber(e,n,o){return this.getStorage(n)?.getNumber(e,o)}getObject(e,n,o){return this.getStorage(n)?.getObject(e,o)}storeAll(e,n){this.withPausedEmitters(()=>{for(let o of e)this.store(o.key,o.value,o.scope,o.target,n)})}store(e,n,o,i,s=!1){if(Ot(n)){this.remove(e,o,s);return}this.withPausedEmitters(()=>{this.updateKeyTarget(e,o,i),this.getStorage(o)?.set(e,n,s)})}remove(e,n,o=!1){this.withPausedEmitters(()=>{this.updateKeyTarget(e,n,void 0),this.getStorage(n)?.delete(e,o)})}withPausedEmitters(e){this._onDidChangeValue.pause(),this._onDidChangeTarget.pause();try{e()}finally{this._onDidChangeValue.resume(),this._onDidChangeTarget.resume()}}keys(e,n){let o=[],i=this.getKeyTargets(e);for(let s of Object.keys(i))i[s]===n&&o.push(s);return o}updateKeyTarget(e,n,o,i=!1){let s=this.getKeyTargets(n);typeof o=="number"?s[e]!==o&&(s[e]=o,this.getStorage(n)?.set(Kx,JSON.stringify(s),i)):typeof s[e]=="number"&&(delete s[e],this.getStorage(n)?.set(Kx,JSON.stringify(s),i))}get workspaceKeyTargets(){return this._workspaceKeyTargets||(this._workspaceKeyTargets=this.loadKeyTargets(1)),this._workspaceKeyTargets}get profileKeyTargets(){return this._profileKeyTargets||(this._profileKeyTargets=this.loadKeyTargets(0)),this._profileKeyTargets}get applicationKeyTargets(){return this._applicationKeyTargets||(this._applicationKeyTargets=this.loadKeyTargets(-1)),this._applicationKeyTargets}getKeyTargets(e){switch(e){case-1:return this.applicationKeyTargets;case 0:return this.profileKeyTargets;default:return this.workspaceKeyTargets}}loadKeyTargets(e){let n=this.getStorage(e);return n?T3(n):Object.create(null)}isNew(e){return this.getBoolean(C3,e)===!0}async flush(e=0){this._onWillSaveState.fire({reason:e});let n=this.getStorage(-1),o=this.getStorage(0),i=this.getStorage(1);switch(e){case 0:await Kr.settled([n?.whenFlushed()??Promise.resolve(),o?.whenFlushed()??Promise.resolve(),i?.whenFlushed()??Promise.resolve()]);break;case 1:await Kr.settled([n?.flush(0)??Promise.resolve(),o?.flush(0)??Promise.resolve(),i?.flush(0)??Promise.resolve()]);break}}async log(){let e=this.getStorage(-1)?.items??new Map,n=this.getStorage(0)?.items??new Map,o=this.getStorage(1)?.items??new Map;return E3(e,n,o,this.getLogDetails(-1)??"",this.getLogDetails(0)??"",this.getLogDetails(1)??"")}async optimize(e){return await this.flush(),this.getStorage(e)?.optimize()}async switch(e,n){return this.emitWillSaveState(0),tW(e)?this.switchToProfile(e,n):this.switchToWorkspace(e,n)}canSwitchProfile(e,n){return!(e.id===n.id||oW(n)&&oW(e))}switchData(e,n,o){this.withPausedEmitters(()=>{let i=new Set;for(let[s,a]of e)i.add(s),n.get(s)!==a&&this.emitDidChangeValue(o,{key:s,external:!0});for(let[s]of n.items)i.has(s)||this.emitDidChangeValue(o,{key:s,external:!0})})}};function oW(r){return r.isDefault||!!r.useDefaultFlags?.globalState}var jx=class extends uA{constructor(){super();this.applicationStorage=this._register(new Vp(new Bp,{hint:1}));this.profileStorage=this._register(new Vp(new Bp,{hint:1}));this.workspaceStorage=this._register(new Vp(new Bp,{hint:1}));this._register(this.workspaceStorage.onDidChangeStorage(e=>this.emitDidChangeValue(1,e))),this._register(this.profileStorage.onDidChangeStorage(e=>this.emitDidChangeValue(0,e))),this._register(this.applicationStorage.onDidChangeStorage(e=>this.emitDidChangeValue(-1,e)))}getStorage(e){switch(e){case-1:return this.applicationStorage;case 0:return this.profileStorage;default:return this.workspaceStorage}}getLogDetails(e){switch(e){case-1:return"inMemory (application)";case 0:return"inMemory (profile)";default:return"inMemory (workspace)"}}async doInitialize(){}async switchToProfile(){}async switchToWorkspace(){}shouldFlushWhenIdle(){return!1}hasScope(e){return!1}};async function E3(r,t,e,n,o,i){let s=f=>{try{return JSON.parse(f)}catch{return f}},a=new Map,l=new Map;r.forEach((f,I)=>{a.set(I,f),l.set(I,s(f))});let d=new Map,c=new Map;t.forEach((f,I)=>{d.set(I,f),c.set(I,s(f))});let u=new Map,m=new Map;e.forEach((f,I)=>{u.set(I,f),m.set(I,s(f))}),console.group(n!==o?`Storage: Application (path: ${n})`:`Storage: Application & Profile (path: ${n}, default profile)`);let g=[];if(a.forEach((f,I)=>{g.push({key:I,value:f})}),console.table(g),console.groupEnd(),console.log(l),n!==o){console.group(`Storage: Profile (path: ${o}, profile specific)`);let f=[];d.forEach((I,S)=>{f.push({key:S,value:I})}),console.table(f),console.groupEnd(),console.log(c)}console.group(`Storage: Workspace (path: ${i})`);let h=[];u.forEach((f,I)=>{h.push({key:I,value:f})}),console.table(h),console.groupEnd(),console.log(m)}var rW=R("secretStorageService"),Gx=class extends O{constructor(e,n,o,i){super();this._useInMemoryStorage=e;this._storageService=n;this._encryptionService=o;this._logService=i;this._storagePrefix="secret://";this.onDidChangeSecretEmitter=this._register(new E);this.onDidChangeSecret=this.onDidChangeSecretEmitter.event;this._sequencer=new pl;this._type="unknown";this._onDidChangeValueDisposable=this._register(new $);this._lazyStorageService=new mt(()=>this.initialize())}get type(){return this._type}get resolvedStorageService(){return this._lazyStorageService.value}get(e){return this._sequencer.queue(e,async()=>{let n=await this.resolvedStorageService,o=this.getKey(e);this._logService.trace("[secrets] getting secret for key:",o);let i=n.get(o,-1);if(!i){this._logService.trace("[secrets] no secret found for key:",o);return}try{this._logService.trace("[secrets] decrypting gotten secret for key:",o);let s=this._type==="in-memory"?i:await this._encryptionService.decrypt(i);return this._logService.trace("[secrets] decrypted secret for key:",o),s}catch(s){this._logService.error(s),this.delete(e);return}})}set(e,n){return this._sequencer.queue(e,async()=>{let o=await this.resolvedStorageService;this._logService.trace("[secrets] encrypting secret for key:",e);let i;try{i=this._type==="in-memory"?n:await this._encryptionService.encrypt(n)}catch(a){throw this._logService.error(a),a}let s=this.getKey(e);this._logService.trace("[secrets] storing encrypted secret for key:",s),o.store(s,i,-1,1),this._logService.trace("[secrets] stored encrypted secret for key:",s)})}delete(e){return this._sequencer.queue(e,async()=>{let n=await this.resolvedStorageService,o=this.getKey(e);this._logService.trace("[secrets] deleting secret for key:",o),n.remove(o,-1),this._logService.trace("[secrets] deleted secret for key:",o)})}keys(){return this._sequencer.queue("__keys__",async()=>{let e=await this.resolvedStorageService;this._logService.trace("[secrets] fetching keys of all secrets");let n=e.keys(-1,1);return this._logService.trace("[secrets] fetched keys of all secrets"),n.filter(o=>o.startsWith(this._storagePrefix)).map(o=>o.slice(this._storagePrefix.length))})}async initialize(){let e;if(!this._useInMemoryStorage&&await this._encryptionService.isEncryptionAvailable())this._logService.trace("[SecretStorageService] Encryption is available, using persisted storage"),this._type="persisted",e=this._storageService;else{if(this._type==="in-memory")return this._storageService;this._logService.trace("[SecretStorageService] Encryption is not available, falling back to in-memory storage"),this._type="in-memory",e=this._register(new jx)}return this._onDidChangeValueDisposable.clear(),this._onDidChangeValueDisposable.add(e.onDidChangeValue(-1,void 0,this._onDidChangeValueDisposable)(n=>{this.onDidChangeValue(n.key)})),e}reinitialize(){this._lazyStorageService=new mt(()=>this.initialize())}onDidChangeValue(e){if(!e.startsWith(this._storagePrefix))return;let n=e.slice(this._storagePrefix.length);this._logService.trace(`[SecretStorageService] Notifying change in value for secret: ${n}`),this.onDidChangeSecretEmitter.fire(n)}getKey(e){return`${this._storagePrefix}${e}`}};Gx=_([C(1,Sr),C(2,ZH),C(3,oe)],Gx);var Xme={Extensions:{name:{key:"extensionsConfigurationTitle",value:p(138,null)}},IntegratedTerminal:{name:{key:"terminalIntegratedConfigurationTitle",value:p(141,null)}},InteractiveSession:{name:{key:"interactiveSessionConfigurationTitle",value:p(139,null)}},Telemetry:{name:{key:"telemetryConfigurationTitle",value:p(140,null)}},Update:{name:{key:"updateConfigurationTitle",value:p(142,null)}}};var Cv="^([a-z0-9A-Z][a-z0-9-A-Z]*)\\.([a-z0-9A-Z][a-z0-9-A-Z]*)$",hge=new RegExp(Cv);var vge=R("extensionGalleryService");var bge=R("extensionManagementService");var yge=R("IGlobalExtensionEnablementService"),Ige=R("IExtensionTipsService"),xge=R("IAllowedExtensionsService");var Sge=Qd(2033,"Extensions"),Cge=Qd(2050,"Preferences"),w3="extensions.allowed";vt.as(xr.Configuration).registerConfiguration({id:"extensions",order:30,title:p(2049,null),type:"object",properties:{[w3]:{type:"object",markdownDescription:p(2039,null),default:"*",defaultSnippets:[{body:{},description:p(2044,null)},{body:{"*":!0},description:p(2040,null)}],scope:1,policy:{name:"AllowedExtensions",category:"Extensions",minimumVersion:"1.96",localization:{description:{key:"extensions.allowed.policy",value:p(2045,null)}}},additionalProperties:!1,patternProperties:{"([a-z0-9A-Z][a-z0-9-A-Z]*)\\.([a-z0-9A-Z][a-z0-9-A-Z]*)$":{anyOf:[{type:["boolean","string"],enum:[!0,!1,"stable"],description:p(2037,null),enumDescriptions:[p(2043,null),p(2041,null),p(2042,null)]},{type:"array",items:{type:"string"},description:p(2038,null)}]},"([a-z0-9A-Z][a-z0-9-A-Z]*)$":{type:["boolean","string"],enum:[!0,!1,"stable"],description:p(2032,null),enumDescriptions:[p(2048,null),p(2046,null),p(2047,null)]},"\\*":{type:"boolean",enum:[!0,!1],description:p(2034,null),enumDescriptions:[p(2036,null),p(2035,null)]}}}}});var gs=R("telemetryService");var Rge=R("customEndpointTelemetryService");var Rl=class{constructor(t){this.value=t;this.isTrustedTelemetryValue=!0}},pA=class{constructor(){this.telemetryLevel=0;this.sessionId="someValue.sessionId";this.machineId="someValue.machineId";this.sqmId="someValue.sqmId";this.devDeviceId="someValue.devDeviceId";this.firstSessionDate="someValue.firstSessionDate";this.sendErrorTelemetry=!1}publicLog(){}publicLog2(){}publicLogError(){}publicLogError2(){}setExperimentProperty(){}},Gge=new pA;var k3="telemetry",aW={id:k3,name:p(2372,null)};function lW(r,t){if(!r)return"none";let e=zh(r),n=t?.remoteExtensionTips;if(n&&Object.prototype.hasOwnProperty.call(n,e))return e;let o=t?.virtualWorkspaceExtensionTips;return o&&Object.prototype.hasOwnProperty.call(o,e)?e:"other"}function P3(r,t){if(!r||!r.includes("/")&&!r.includes("\\"))return r;let e=r,n=[];for(let l of t)for(;;){let d=l.exec(r);if(!d)break;n.push([d.index,l.lastIndex])}let o=/(?:^|[\\\/])((node_modules|node_modules\.asar)[\\\/].*)$/,i=/^(.*?)((?:\.vscode(?:-[a-z]+)*|resources[\\\/]app)[\\\/]extensions[\\\/].*)$/i,s=/(file:\/\/)?([a-zA-Z]:(\\\\|\\|\/)|(\\\\|\\|\/))?([\w\-\._@]+(\\\\|\\|\/))+[\w\-\._@]*/g,a=0;for(e="";;){let l=s.exec(r);if(!l)break;if(!n.some(([c,u])=>l.index<u&&c<s.lastIndex)){let c=i.exec(l[0]);if(c)e+=r.substring(a,l.index)+"<REDACTED: user-file-path>/"+c[2];else{let u=o.exec(l[0]);u?e+=r.substring(a,l.index)+"<REDACTED: user-file-path>/"+u[1]:e+=r.substring(a,l.index)+"<REDACTED: user-file-path>"}a=s.lastIndex}}return a<r.length&&(e+=r.substr(a)),e}function _3(r){if(!r)return r;let t=[{label:"URL",regex:/[a-zA-Z][a-zA-Z0-9+.-]*:\/\/[^\s]*/},{label:"Google API Key",regex:/AIza[A-Za-z0-9_\\\-]{35}/},{label:"JWT",regex:/eyJ[0eXAiOiJKV1Qi|hbGci|a-zA-Z0-9\-_]+\.[a-zA-Z0-9\-_]+\.[a-zA-Z0-9\-_]+/},{label:"Slack Token",regex:/xox[pbar]\-[A-Za-z0-9]/},{label:"GitHub Token",regex:/(gh[psuro]_[a-zA-Z0-9]{36}|github_pat_[a-zA-Z0-9]{22}_[a-zA-Z0-9]{59})/},{label:"Generic Secret",regex:/(key|token|sig|secret|signature|password|passwd|pwd|android:value)[^a-zA-Z0-9]/i},{label:"CLI Credentials",regex:/((login|psexec|(certutil|psexec)\.exe).{1,50}(\s-u(ser(name)?)?\s+.{3,100})?\s-(admin|user|vm|root)?p(ass(word)?)?\s+["']?[^$\-\/\s]|(^|[\s\r\n\\])net(\.exe)?.{1,5}(user\s+|share\s+\/user:| user -? secrets ? set) \s + [^ $\s \/])/},{label:"Microsoft Entra ID",regex:/eyJ(?:0eXAiOiJKV1Qi|hbGci|[a-zA-Z0-9\-_]+\.[a-zA-Z0-9\-_]+\.)/},{label:"Email",regex:/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/}];for(let e of t)if(e.regex.test(r))return`<REDACTED: ${e.label}>`;return r}function mA(r,t){return r?ra(r,e=>{if(e instanceof Rl||Object.hasOwnProperty.call(e,"isTrustedTelemetryValue"))return e.value;if(typeof e=="string"){let n=e.replaceAll("%20"," ");n=P3(n,t);for(let o of t)n=n.replace(o,"");return n=_3(n),n}}):{}}function dW(r,t){return r.uuid&&t.uuid?r.uuid===t.uuid:r.id===t.id?!0:mh(r.id,t.id)===0}var pfe=new Ee("pprice.better-merge");var gA=class{constructor(){this._generators=new Map;this._cache=new WeakMap}register(t,e){this._generators.set(t,e)}readActivationEvents(t){return this._cache.has(t)||this._cache.set(t,this._readActivationEvents(t)),this._cache.get(t)}createActivationEventsMap(t){let e=Object.create(null);for(let n of t){let o=this.readActivationEvents(n);o.length>0&&(e[Ee.toKey(n.identifier)]=o)}return e}_readActivationEvents(t){if(typeof t.main>"u"&&typeof t.browser>"u")return[];let e=Array.isArray(t.activationEvents)?t.activationEvents.slice(0):[];for(let n=0;n<e.length;n++)e[n]==="onUri"&&(e[n]=`onUri:${Ee.toKey(t.identifier)}`);if(!t.contributes)return e;for(let n in t.contributes){let o=this._generators.get(n);if(!o)continue;let i=t.contributes[n],s=Array.isArray(i)?i:[i];try{e.push(...o(s))}catch(a){ze(a)}}return e}},fA=new gA;var cW=Object.freeze({identifier:new Ee("nullExtensionDescription"),name:"Null Extension Description",version:"0.0.0",publisher:"vscode",engines:{vscode:""},extensionLocation:b.parse("void:location"),isBuiltin:!1,targetPlatform:"undefined",isUserBuiltin:!1,isUnderDevelopment:!1,preRelease:!1});var Qx=R("extensionService"),Tv=class{constructor(t){this.dependency=t}};function He(r,t){return!!r.enabledApiProposals}function A(r,t){if(!He(r,t))throw new Error(`Extension '${r.identifier.value}' CANNOT use API proposal: ${t}.
Its package.json#enabledApiProposals-property declares: ${r.enabledApiProposals?.join(", ")??"[]"} but NOT ${t}.
 The missing proposal MUST be added and you must start in extension development mode or use the following command line switch: --enable-proposed-api ${r.identifier.value}`)}var D3={activeComment:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.activeComment.d.ts"},agentSessionsWorkspace:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.agentSessionsWorkspace.d.ts"},aiRelatedInformation:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.aiRelatedInformation.d.ts"},aiSettingsSearch:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.aiSettingsSearch.d.ts"},aiTextSearchProvider:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.aiTextSearchProvider.d.ts",version:2},authIssuers:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.authIssuers.d.ts"},authLearnMore:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.authLearnMore.d.ts"},authProviderSpecific:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.authProviderSpecific.d.ts"},authSession:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.authSession.d.ts"},authenticationChallenges:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.authenticationChallenges.d.ts"},browser:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.browser.d.ts"},canonicalUriProvider:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.canonicalUriProvider.d.ts"},chatContextProvider:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatContextProvider.d.ts"},chatDebug:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatDebug.d.ts",version:4},chatHooks:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatHooks.d.ts",version:6},chatOutputRenderer:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatOutputRenderer.d.ts"},chatParticipantAdditions:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatParticipantAdditions.d.ts",version:3},chatParticipantPrivate:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatParticipantPrivate.d.ts",version:15},chatPromptFiles:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatPromptFiles.d.ts",version:1},chatProvider:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatProvider.d.ts",version:4},chatReferenceBinaryData:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatReferenceBinaryData.d.ts"},chatReferenceDiagnostic:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatReferenceDiagnostic.d.ts"},chatSessionCustomizationProvider:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatSessionCustomizationProvider.d.ts"},chatSessionsProvider:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatSessionsProvider.d.ts",version:3},chatStatusItem:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatStatusItem.d.ts"},chatTab:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatTab.d.ts"},codeActionAI:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.codeActionAI.d.ts"},codeActionRanges:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.codeActionRanges.d.ts"},codiconDecoration:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.codiconDecoration.d.ts"},commentReactor:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.commentReactor.d.ts"},commentReveal:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.commentReveal.d.ts"},commentThreadApplicability:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.commentThreadApplicability.d.ts"},commentingRangeHint:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.commentingRangeHint.d.ts"},commentsDraftState:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.commentsDraftState.d.ts"},contribAccessibilityHelpContent:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribAccessibilityHelpContent.d.ts"},contribChatEditorInlineGutterMenu:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribChatEditorInlineGutterMenu.d.ts"},contribCommentEditorActionsMenu:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribCommentEditorActionsMenu.d.ts"},contribCommentPeekContext:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribCommentPeekContext.d.ts"},contribCommentThreadAdditionalMenu:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribCommentThreadAdditionalMenu.d.ts"},contribCommentsViewThreadMenus:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribCommentsViewThreadMenus.d.ts"},contribDebugCreateConfiguration:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribDebugCreateConfiguration.d.ts"},contribDiffEditorGutterToolBarMenus:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribDiffEditorGutterToolBarMenus.d.ts"},contribEditSessions:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribEditSessions.d.ts"},contribEditorContentMenu:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribEditorContentMenu.d.ts"},contribLabelFormatterWorkspaceTooltip:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribLabelFormatterWorkspaceTooltip.d.ts"},contribLanguageModelToolSets:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribLanguageModelToolSets.d.ts"},contribMenuBarHome:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribMenuBarHome.d.ts"},contribMergeEditorMenus:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribMergeEditorMenus.d.ts"},contribMultiDiffEditorMenus:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribMultiDiffEditorMenus.d.ts"},contribNotebookStaticPreloads:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribNotebookStaticPreloads.d.ts"},contribRemoteHelp:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribRemoteHelp.d.ts"},contribShareMenu:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribShareMenu.d.ts"},contribSourceControlArtifactGroupMenu:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribSourceControlArtifactGroupMenu.d.ts"},contribSourceControlArtifactMenu:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribSourceControlArtifactMenu.d.ts"},contribSourceControlHistoryItemMenu:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribSourceControlHistoryItemMenu.d.ts"},contribSourceControlHistoryTitleMenu:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribSourceControlHistoryTitleMenu.d.ts"},contribSourceControlInputBoxMenu:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribSourceControlInputBoxMenu.d.ts"},contribSourceControlTitleMenu:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribSourceControlTitleMenu.d.ts"},contribStatusBarItems:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribStatusBarItems.d.ts"},contribViewContainerTitle:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribViewContainerTitle.d.ts"},contribViewsRemote:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribViewsRemote.d.ts"},contribViewsWelcome:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribViewsWelcome.d.ts"},css:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.css.d.ts"},customEditorMove:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.customEditorMove.d.ts"},dataChannels:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.dataChannels.d.ts"},debugVisualization:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.debugVisualization.d.ts"},defaultChatParticipant:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.defaultChatParticipant.d.ts",version:4},devDeviceId:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.devDeviceId.d.ts"},diffCommand:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.diffCommand.d.ts"},diffContentOptions:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.diffContentOptions.d.ts"},documentFiltersExclusive:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.documentFiltersExclusive.d.ts"},editSessionIdentityProvider:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.editSessionIdentityProvider.d.ts"},editorHoverVerbosityLevel:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.editorHoverVerbosityLevel.d.ts"},editorInsets:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.editorInsets.d.ts"},embeddings:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.embeddings.d.ts"},envIsConnectionMetered:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.envIsConnectionMetered.d.ts"},environmentPower:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.environmentPower.d.ts"},extensionAffinity:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.extensionAffinity.d.ts"},extensionRuntime:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.extensionRuntime.d.ts"},extensionsAny:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.extensionsAny.d.ts"},externalUriOpener:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.externalUriOpener.d.ts"},fileSearchProvider:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.fileSearchProvider.d.ts"},fileSearchProvider2:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.fileSearchProvider2.d.ts"},findFiles2:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.findFiles2.d.ts",version:2},findTextInFiles:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.findTextInFiles.d.ts"},findTextInFiles2:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.findTextInFiles2.d.ts"},fsChunks:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.fsChunks.d.ts"},inlineCompletionsAdditions:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.inlineCompletionsAdditions.d.ts"},interactive:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.interactive.d.ts"},interactiveWindow:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.interactiveWindow.d.ts"},ipc:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.ipc.d.ts"},languageModelCapabilities:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.languageModelCapabilities.d.ts"},languageModelProxy:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.languageModelProxy.d.ts"},languageModelSystem:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.languageModelSystem.d.ts"},languageModelThinkingPart:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.languageModelThinkingPart.d.ts",version:1},languageModelToolResultAudience:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.languageModelToolResultAudience.d.ts"},languageModelToolSupportsModel:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.languageModelToolSupportsModel.d.ts",version:1},languageStatusText:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.languageStatusText.d.ts"},mappedEditsProvider:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.mappedEditsProvider.d.ts"},markdownAlertSyntax:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.markdownAlertSyntax.d.ts"},mcpServerDefinitions:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.mcpServerDefinitions.d.ts",version:1},mcpToolDefinitions:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.mcpToolDefinitions.d.ts"},multiDocumentHighlightProvider:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.multiDocumentHighlightProvider.d.ts"},nativeWindowHandle:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.nativeWindowHandle.d.ts"},newSymbolNamesProvider:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.newSymbolNamesProvider.d.ts"},notebookCellExecution:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookCellExecution.d.ts"},notebookControllerAffinityHidden:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookControllerAffinityHidden.d.ts"},notebookDeprecated:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookDeprecated.d.ts"},notebookExecution:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookExecution.d.ts"},notebookKernelSource:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookKernelSource.d.ts"},notebookLiveShare:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookLiveShare.d.ts"},notebookMessaging:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookMessaging.d.ts"},notebookMime:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookMime.d.ts"},notebookReplDocument:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookReplDocument.d.ts"},notebookVariableProvider:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookVariableProvider.d.ts"},portsAttributes:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.portsAttributes.d.ts"},profileContentHandlers:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.profileContentHandlers.d.ts"},quickDiffProvider:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.quickDiffProvider.d.ts"},quickPickItemTooltip:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.quickPickItemTooltip.d.ts"},quickPickSortByLabel:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.quickPickSortByLabel.d.ts"},remoteCodingAgents:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.remoteCodingAgents.d.ts"},resolvers:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.resolvers.d.ts"},scmActionButton:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.scmActionButton.d.ts"},scmArtifactProvider:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.scmArtifactProvider.d.ts"},scmHistoryProvider:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.scmHistoryProvider.d.ts"},scmMultiDiffEditor:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.scmMultiDiffEditor.d.ts"},scmProviderOptions:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.scmProviderOptions.d.ts"},scmSelectedProvider:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.scmSelectedProvider.d.ts"},scmTextDocument:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.scmTextDocument.d.ts"},scmValidation:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.scmValidation.d.ts"},shareProvider:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.shareProvider.d.ts"},speech:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.speech.d.ts"},statusBarItemTooltip:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.statusBarItemTooltip.d.ts"},tabInputMultiDiff:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.tabInputMultiDiff.d.ts"},tabInputTextMerge:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.tabInputTextMerge.d.ts"},taskExecutionTerminal:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.taskExecutionTerminal.d.ts"},taskPresentationGroup:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.taskPresentationGroup.d.ts"},taskProblemMatcherStatus:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.taskProblemMatcherStatus.d.ts"},taskRunOptions:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.taskRunOptions.d.ts"},telemetry:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.telemetry.d.ts"},terminalCompletionProvider:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.terminalCompletionProvider.d.ts"},terminalDataWriteEvent:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.terminalDataWriteEvent.d.ts"},terminalDimensions:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.terminalDimensions.d.ts"},terminalExecuteCommandEvent:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.terminalExecuteCommandEvent.d.ts"},terminalQuickFixProvider:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.terminalQuickFixProvider.d.ts"},terminalSelection:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.terminalSelection.d.ts"},terminalShellEnv:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.terminalShellEnv.d.ts"},terminalTitle:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.terminalTitle.d.ts"},testObserver:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.testObserver.d.ts"},testRelatedCode:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.testRelatedCode.d.ts"},textDocumentChangeReason:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.textDocumentChangeReason.d.ts"},textEditorDiffInformation:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.textEditorDiffInformation.d.ts"},textSearchComplete2:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.textSearchComplete2.d.ts"},textSearchProvider:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.textSearchProvider.d.ts"},textSearchProvider2:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.textSearchProvider2.d.ts"},timeline:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.timeline.d.ts"},tokenInformation:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.tokenInformation.d.ts"},toolInvocationApproveCombination:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.toolInvocationApproveCombination.d.ts"},toolProgress:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.toolProgress.d.ts"},treeItemMarkdownLabel:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.treeItemMarkdownLabel.d.ts"},treeViewActiveItem:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.treeViewActiveItem.d.ts"},treeViewMarkdownMessage:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.treeViewMarkdownMessage.d.ts"},treeViewReveal:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.treeViewReveal.d.ts"},tunnelFactory:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.tunnelFactory.d.ts"},tunnels:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.tunnels.d.ts"},valueSelectionInQuickPick:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.valueSelectionInQuickPick.d.ts"},workspaceTrust:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.workspaceTrust.d.ts"}},$p=Object.freeze(D3);var IA=vt.as(kc.JSONContribution);var hA=class r{constructor(t,e){this.added=t;this.removed=e}static _toSet(t){let e=new No;for(let n=0,o=t.length;n<o;n++)e.add(t[n].description.identifier);return e}static compute(t,e){if(!t||!t.length)return new r(e,[]);if(!e||!e.length)return new r([],t);let n=this._toSet(t),o=this._toSet(e),i=e.filter(a=>!n.has(a.description.identifier)),s=t.filter(a=>!o.has(a.description.identifier));return new r(i,s)}},vA=class{constructor(t,e,n){this.name=t,this.defaultExtensionKind=e,this.canHandleResolver=n,this._handler=null,this._users=null,this._delta=null}setHandler(t){if(this._handler!==null)throw new Error("Handler already set!");return this._handler=t,this._handle(),{dispose:()=>{this._handler=null}}}acceptUsers(t){this._delta=hA.compute(this._users,t),this._users=t,this._handle()}_handle(){if(!(this._handler===null||this._users===null||this._delta===null))try{this._handler(this._users,this._delta)}catch(t){ze(t)}}},R3={type:"string",enum:["ui","workspace"],enumDescriptions:[p(17673,null),p(17753,null)]},uW="vscode://schemas/vscode-extensions",bA={properties:{engines:{type:"object",description:p(17737,null),properties:{vscode:{type:"string",description:p(17738,null),default:"^1.105.0"}}},publisher:{description:p(17749,null),type:"string"},displayName:{description:p(17734,null),type:"string"},categories:{description:p(17728,null),type:"array",uniqueItems:!0,items:{oneOf:[{type:"string",enum:KI},{type:"string",const:"Languages",deprecationMessage:p(17729,null)}]}},galleryBanner:{type:"object",description:p(17741,null),properties:{color:{description:p(17742,null),type:"string"},theme:{description:p(17743,null),type:"string",enum:["dark","light"]}}},contributes:{description:p(17730,null),type:"object",properties:{},default:{}},preview:{type:"boolean",description:p(17747,null)},enableProposedApi:{type:"boolean",deprecationMessage:p(17736,null)},enabledApiProposals:{markdownDescription:p(17735,null),type:"array",uniqueItems:!0,items:{type:"string",enum:Object.keys($p).map(r=>r),markdownEnumDescriptions:Object.values($p).map(r=>r.proposal)}},api:{markdownDescription:p(17708,null),type:"string",enum:["none"],enumDescriptions:[p(17709,null)]},activationEvents:{description:p(17674,null),type:"array",items:{type:"string",defaultSnippets:[{label:"onWebviewPanel",description:p(17705,null),body:"onWebviewPanel:viewType"},{label:"onLanguage",description:p(17688,null),body:"onLanguage:${1:languageId}"},{label:"onCommand",description:p(17678,null),body:"onCommand:${2:commandId}"},{label:"onDebug",description:p(17680,null),body:"onDebug"},{label:"onDebugInitialConfigurations",description:p(17683,null),body:"onDebugInitialConfigurations"},{label:"onDebugDynamicConfigurations",description:p(17682,null),body:"onDebugDynamicConfigurations"},{label:"onDebugResolve",description:p(17684,null),body:"onDebugResolve:${6:type}"},{label:"onDebugAdapterProtocolTracker",description:p(17681,null),body:"onDebugAdapterProtocolTracker:${6:type}"},{label:"workspaceContains",description:p(17707,null),body:"workspaceContains:${4:filePattern}"},{label:"onStartupFinished",description:p(17696,null),body:"onStartupFinished"},{label:"onTaskType",description:p(17697,null),body:"onTaskType:${1:taskType}"},{label:"onFileSystem",description:p(17686,null),body:"onFileSystem:${1:scheme}"},{label:"onEditSession",description:p(17685,null),body:"onEditSession:${1:scheme}"},{label:"onSearch",description:p(17695,null),body:"onSearch:${7:scheme}"},{label:"onView",body:"onView:${5:viewId}",description:p(17703,null)},{label:"onUri",body:"onUri",description:p(17702,null)},{label:"onOpenExternalUri",body:"onOpenExternalUri",description:p(17693,null)},{label:"onCustomEditor",body:"onCustomEditor:${9:viewType}",description:p(17679,null)},{label:"onNotebook",body:"onNotebook:${1:type}",description:p(17692,null)},{label:"onAuthenticationRequest",body:"onAuthenticationRequest:${11:authenticationProviderId}",description:p(17675,null)},{label:"onRenderer",description:p(17694,null),body:"onRenderer:${11:rendererId}"},{label:"onTerminalProfile",body:"onTerminalProfile:${1:terminalId}",description:p(17699,null)},{label:"onTerminalQuickFixRequest",body:"onTerminalQuickFixRequest:${1:quickFixId}",description:p(17700,null)},{label:"onWalkthrough",body:"onWalkthrough:${1:walkthroughID}",description:p(17704,null)},{label:"onIssueReporterOpened",body:"onIssueReporterOpened",description:p(17687,null)},{label:"onChatParticipant",body:"onChatParticipant:${1:participantId}",description:p(17677,null)},{label:"onChatContextProvider",body:"onChatContextProvider:${1:contextProviderId}",description:p(17676,null)},{label:"onLanguageModelChatProvider",body:"onLanguageModelChatProvider:${1:vendor}",description:p(17689,null)},{label:"onLanguageModelTool",body:"onLanguageModelTool:${1:toolId}",description:p(17690,null)},{label:"onTerminal",body:"onTerminal:{1:shellType}",description:p(17698,null)},{label:"onTerminalShellIntegration",body:"onTerminalShellIntegration:${1:shellType}",description:p(17701,null)},{label:"onMcpCollection",description:p(17691,null),body:"onMcpCollection:${2:collectionId}"},{label:"*",description:p(17706,null),body:"*"}]}},badges:{type:"array",description:p(17710,null),items:{type:"object",required:["url","href","description"],properties:{url:{type:"string",description:p(17713,null)},href:{type:"string",description:p(17712,null)},description:{type:"string",description:p(17711,null)}}}},markdown:{type:"string",description:p(17746,null),enum:["github","standard"],default:"github"},qna:{default:"marketplace",description:p(17750,null),anyOf:[{type:["string","boolean"],enum:["marketplace",!1]},{type:"string"}]},extensionDependencies:{description:p(17740,null),type:"array",uniqueItems:!0,items:{type:"string",pattern:Cv}},extensionAffinity:{description:p(17739,null),type:"array",uniqueItems:!0,items:{type:"string",pattern:Cv}},extensionPack:{description:p(17731,null),type:"array",uniqueItems:!0,items:{type:"string",pattern:Cv}},extensionKind:{description:p(17666,null),type:"array",items:R3,default:["workspace"],defaultSnippets:[{body:["ui"],description:p(17668,null)},{body:["workspace"],description:p(17670,null)},{body:["ui","workspace"],description:p(17669,null)},{body:["workspace","ui"],description:p(17671,null)},{body:[],description:p(17667,null)}]},capabilities:{description:p(17714,null),type:"object",properties:{virtualWorkspaces:{description:p(17722,null),type:["boolean","object"],defaultSnippets:[{label:"limited",body:{supported:"${1:limited}",description:"${2}"}},{label:"false",body:{supported:!1,description:"${2}"}}],default:(!0).valueOf,properties:{supported:{markdownDescription:p(17724,null),type:["string","boolean"],enum:["limited",!0,!1],enumDescriptions:[p(17726,null),p(17727,null),p(17725,null)]},description:{type:"string",markdownDescription:p(17723,null)}}},untrustedWorkspaces:{description:p(17715,null),type:"object",required:["supported"],defaultSnippets:[{body:{supported:"${1:limited}",description:"${2}"}}],properties:{supported:{markdownDescription:p(17718,null),type:["string","boolean"],enum:["limited",!0,!1],enumDescriptions:[p(17720,null),p(17721,null),p(17719,null)]},restrictedConfigurations:{description:p(17717,null),type:"array",items:{type:"string"}},description:{type:"string",markdownDescription:p(17716,null)}}}}},sponsor:{description:p(17732,null),type:"object",defaultSnippets:[{body:{url:"${1:https:}"}}],properties:{url:{description:p(17733,null),type:"string"}}},scripts:{type:"object",properties:{"vscode:prepublish":{description:p(17751,null),type:"string"},"vscode:uninstall":{description:p(17752,null),type:"string"}}},icon:{type:"string",description:p(17744,null)},l10n:{type:"string",description:p(17745,null)},pricing:{type:"string",markdownDescription:p(17748,null),enum:["Free","Trial"],default:"Free"}}},yA=class{constructor(){this._extensionPoints=new Map}registerExtensionPoint(t){if(this._extensionPoints.has(t.extensionPoint))throw new Error("Duplicate extension point: "+t.extensionPoint);let e=new vA(t.extensionPoint,t.defaultExtensionKind,t.canHandleResolver);return this._extensionPoints.set(t.extensionPoint,e),t.activationEventsGenerator&&fA.register(t.extensionPoint,t.activationEventsGenerator),bA.properties.contributes.properties[t.extensionPoint]=t.jsonSchema,IA.registerSchema(uW,bA),e}getExtensionPoints(){return Array.from(this._extensionPoints.values())}},pW={ExtensionsRegistry:"ExtensionsRegistry"};vt.add(pW.ExtensionsRegistry,new yA);var Jx=vt.as(pW.ExtensionsRegistry);IA.registerSchema(uW,bA);IA.registerSchema(WH,{properties:{extensionEnabledApiProposals:{description:p(17672,null),type:"object",properties:{},additionalProperties:{anyOf:[{type:"array",uniqueItems:!0,items:{type:"string",enum:Object.keys($p),markdownEnumDescriptions:Object.values($p).map(r=>r.proposal)}}]}}}});var Gfe=new w("isMac",pt,p(1923,null)),Qfe=new w("isLinux",Qe,p(1922,null)),Jfe=new w("isWindows",Ie,p(1927,null)),mW=new w("isWeb",Pr,p(1926,null)),Yfe=new w("isMacNative",pt&&!Pr,p(1924,null)),Xfe=new w("isIOS",dU,p(1921,null)),Zfe=new w("isMobile",cU,p(1925,null)),ehe=new w("isDevelopment",!1,!0),the=new w("productQualityType","",p(1928,null)),A3="inputFocus",nhe=new w(A3,!1,p(1920,null));var Ev=R("languageService");var wv=R("modelService");var kv=class extends iv{constructor(){super(...arguments);this._onDidChangeDirty=this._register(new E);this._onDidChangeLabel=this._register(new E);this._onDidChangeCapabilities=this._register(new E);this._onWillDispose=this._register(new E);this.onDidChangeDirty=this._onDidChangeDirty.event;this.onDidChangeLabel=this._onDidChangeLabel.event;this.onDidChangeCapabilities=this._onDidChangeCapabilities.event;this.onWillDispose=this._onWillDispose.event}get editorId(){}get capabilities(){return 2}hasCapability(e){return e===0?this.capabilities===0:(this.capabilities&e)!==0}isReadonly(){return this.hasCapability(2)}getName(){return`Editor ${this.typeId}`}getDescription(e){}getTitle(e){return this.getName()}getLabelExtraClasses(){return[]}getAriaLabel(){return this.getTitle(0)}getIcon(){}getTelemetryDescriptor(){return{typeId:this.typeId}}isDirty(){return!1}isModified(){return this.isDirty()}isSaving(){return!1}async resolve(){return null}async save(e,n){return this}async saveAs(e,n){return this}async revert(e,n){}async rename(e,n){}copy(){return this}canMove(e,n){return!0}canReopen(){return!0}matches(e){if(yr(e))return this===e;let n=e.options?.override;return this.editorId!==n&&n!==void 0&&this.editorId!==void 0?!1:Ro(this.resource,Sx.getCanonicalUri(e))}prefersEditorPane(e){return e.at(0)}toUntyped(e){}isDisposed(){return this._store.isDisposed}dispose(){this.isDisposed()||this._onWillDispose.fire(),super.dispose()}};var fW=R("editorGroupsService");var Yx=R("editorService"),hW=-1,vW=-2;var wi=class extends kv{constructor(e,n,o,i,s){super();this.preferredName=e;this.preferredDescription=n;this.secondary=o;this.primary=i;this.editorService=s;this.hasIdenticalSides=this.primary.matches(this.secondary),this.registerListeners()}static{this.ID="workbench.editorinputs.sidebysideEditorInput"}get typeId(){return wi.ID}get capabilities(){let e=this.primary.capabilities;return e&=-33,this.secondary.hasCapability(16)&&(e|=16),this.secondary.hasCapability(8)&&(e|=8),this.secondary.hasCapability(1024)&&(e|=1024),e|=256,e}get resource(){if(this.hasIdenticalSides)return this.primary.resource}registerListeners(){this._register(he.once(he.any(this.primary.onWillDispose,this.secondary.onWillDispose))(()=>{this.isDisposed()||this.dispose()})),this._register(this.primary.onDidChangeDirty(()=>this._onDidChangeDirty.fire())),this._register(this.primary.onDidChangeCapabilities(()=>this._onDidChangeCapabilities.fire())),this._register(this.secondary.onDidChangeCapabilities(()=>this._onDidChangeCapabilities.fire())),this._register(this.primary.onDidChangeLabel(()=>this._onDidChangeLabel.fire())),this._register(this.secondary.onDidChangeLabel(()=>this._onDidChangeLabel.fire()))}getName(){let e=this.getPreferredName();return e||(this.hasIdenticalSides?this.primary.getName():p(4922,null,this.secondary.getName(),this.primary.getName()))}getPreferredName(){return this.preferredName}getDescription(e){let n=this.getPreferredDescription();return n||(this.hasIdenticalSides?this.primary.getDescription(e):super.getDescription(e))}getPreferredDescription(){return this.preferredDescription}getTitle(e){let n;this.hasIdenticalSides?n=this.primary.getTitle(e)??this.getName():n=super.getTitle(e);let o=this.getPreferredTitle();return o&&(n=`${o} (${n})`),n}getPreferredTitle(){if(this.preferredName&&this.preferredDescription)return`${this.preferredName} ${this.preferredDescription}`;if(this.preferredName||this.preferredDescription)return this.preferredName??this.preferredDescription}getLabelExtraClasses(){return this.hasIdenticalSides?this.primary.getLabelExtraClasses():super.getLabelExtraClasses()}getAriaLabel(){return this.hasIdenticalSides?this.primary.getAriaLabel():super.getAriaLabel()}getTelemetryDescriptor(){return{...this.primary.getTelemetryDescriptor(),...super.getTelemetryDescriptor()}}isDirty(){return this.primary.isDirty()}isSaving(){return this.primary.isSaving()}async save(e,n){let o=await this.primary.save(e,n);return this.saveResultToEditor(o)}async saveAs(e,n){let o=await this.primary.saveAs(e,n);return this.saveResultToEditor(o)}saveResultToEditor(e){if(!e||!this.hasIdenticalSides)return e;if(this.primary.matches(e))return this;if(e instanceof kv)return new wi(this.preferredName,this.preferredDescription,e,e,this.editorService);if(!Ci(e)&&!Ap(e)&&!El(e)&&!Tl(e))return{primary:e,secondary:e,label:this.preferredName,description:this.preferredDescription}}revert(e,n){return this.primary.revert(e,n)}async rename(e,n){if(!this.hasIdenticalSides)return;let o=await this.primary.rename(e,n);if(o){if(yr(o.editor))return{editor:new wi(this.preferredName,this.preferredDescription,o.editor,o.editor,this.editorService),options:{...o.options,viewState:Cx(this,e,this.editorService)}};if(Z2(o.editor))return{editor:{label:this.preferredName,description:this.preferredDescription,primary:o.editor,secondary:o.editor,options:{...o.options,viewState:Cx(this,e,this.editorService)}}}}}isReadonly(){return this.primary.isReadonly()}toUntyped(e){let n=this.primary.toUntyped(e),o=this.secondary.toUntyped(e);if(n&&o&&!Ci(n)&&!Ci(o)&&!Ap(n)&&!Ap(o)&&!El(n)&&!El(o)&&!Tl(n)&&!Tl(o)){let i={label:this.preferredName,description:this.preferredDescription,primary:n,secondary:o};return typeof e?.preserveViewState=="number"&&(i.options={viewState:Cx(this,e.preserveViewState,this.editorService)}),i}}matches(e){return this===e?!0:VR(e)||Ci(e)?!1:e instanceof wi?this.primary.matches(e.primary)&&this.secondary.matches(e.secondary):El(e)?this.primary.matches(e.primary)&&this.secondary.matches(e.secondary):!1}};wi=_([C(4,Yx)],wi);var zp=class extends O{constructor(){super(...arguments);this._onWillDispose=this._register(new E);this.onWillDispose=this._onWillDispose.event;this.resolved=!1}async resolve(){this.resolved=!0}isResolved(){return this.resolved}isDisposed(){return this._store.isDisposed}dispose(){this._onWillDispose.fire(),super.dispose()}};var L3={ModesRegistry:"editor.modesRegistry"},xA=class extends O{constructor(){super();this._onDidChangeLanguages=this._register(new E);this.onDidChangeLanguages=this._onDidChangeLanguages.event;this._languages=[]}registerLanguage(e){return this._languages.push(e),this._onDidChangeLanguages.fire(void 0),{dispose:()=>{for(let n=0,o=this._languages.length;n<o;n++)if(this._languages[n]===e){this._languages.splice(n,1);return}}}}getLanguages(){return this._languages}},bW=new xA;vt.add(L3.ModesRegistry,bW);var Pv="plaintext",O3=".txt";bW.registerLanguage({id:Pv,extensions:[O3],aliases:[p(908,null),"text"],mimetypes:[Fo.text]});vt.as(xr.Configuration).registerDefaultConfigurations([{overrides:{"[plaintext]":{"editor.unicodeHighlight.ambiguousCharacters":!1,"editor.unicodeHighlight.invisibleCharacters":!1},"[go]":{"editor.insertSpaces":!1},"[makefile]":{"editor.insertSpaces":!1},"[shellscript]":{"files.eol":`
`},"[yaml]":{"editor.insertSpaces":!0,"editor.tabSize":2}}}]);var yW=R("ILanguageDetectionService"),SA="languageDetection";var fa=class extends zp{constructor(e,n,o,i,s){super();this.modelService=e;this.languageService=n;this.languageDetectionService=o;this.accessibilityService=i;this.textEditorModelHandle=void 0;this.modelDisposeListener=this._register(new sn);this.autoDetectLanguageThrottler=this._register(new vi(fa.AUTO_DETECT_LANGUAGE_THROTTLE_DELAY));this._blockLanguageChangeListener=!1;this._languageChangeSource=void 0;s&&this.handleExistingModel(s)}static{this.AUTO_DETECT_LANGUAGE_THROTTLE_DELAY=600}handleExistingModel(e){let n=this.modelService.getModel(e);if(!n)throw new Error(`Document with resource ${e.toString(!0)} does not exist`);this.textEditorModelHandle=e,this.registerModelDisposeListener(n)}registerModelDisposeListener(e){this.modelDisposeListener.value=e.onWillDispose(()=>{this.textEditorModelHandle=void 0,this.dispose()})}get textEditorModel(){return this.textEditorModelHandle?this.modelService.getModel(this.textEditorModelHandle):null}isReadonly(){return!0}get languageChangeSource(){return this._languageChangeSource}get hasLanguageSetExplicitly(){return typeof this._languageChangeSource=="string"}setLanguageId(e,n){this._languageChangeSource="user",this.setLanguageIdInternal(e,n)}setLanguageIdInternal(e,n){if(this.isResolved()&&!(!e||e===this.textEditorModel.getLanguageId())){this._blockLanguageChangeListener=!0;try{this.textEditorModel.setLanguage(this.languageService.createById(e),n)}finally{this._blockLanguageChangeListener=!1}}}installModelListeners(e){let n=this._register(e.onDidChangeLanguage(o=>{o.source===SA||this._blockLanguageChangeListener||(this._languageChangeSource="api",n.dispose())}))}getLanguageId(){return this.textEditorModel?.getLanguageId()}autoDetectLanguage(){return this.autoDetectLanguageThrottler.trigger(()=>this.doAutoDetectLanguage())}async doAutoDetectLanguage(){if(this.hasLanguageSetExplicitly||!this.textEditorModelHandle||!this.languageDetectionService.isEnabledForLanguage(this.getLanguageId()??Pv))return;let e=await this.languageDetectionService.detectLanguage(this.textEditorModelHandle),n=this.getLanguageId();if(e&&e!==n&&!this.isDisposed()){this.setLanguageIdInternal(e,SA);let o=this.languageService.getLanguageName(e);this.accessibilityService.alert(p(4923,null,o??e))}}createTextEditorModel(e,n,o){let i=this.getFirstLineText(e),s=this.getOrCreateLanguage(n,this.languageService,o,i);return this.doCreateTextEditorModel(e,s,n)}doCreateTextEditorModel(e,n,o){let i=o&&this.modelService.getModel(o);return i?this.updateTextEditorModel(e,n.languageId):(i=this.modelService.createModel(e,n,o),this.createdEditorModel=!0,this.registerModelDisposeListener(i)),this.textEditorModelHandle=i.uri,i}getFirstLineText(e){let n=e;return typeof n.getFirstLineText=="function"?n.getFirstLineText(1e3):e.getLineContent(1).substr(0,1e3)}getOrCreateLanguage(e,n,o,i){return!o||o===Pv?n.createByFilepathOrFirstLine(e??null,i):n.createById(o)}updateTextEditorModel(e,n,o){this.isResolved()&&(e&&this.modelService.updateModel(this.textEditorModel,e,o),n&&n!==Pv&&this.textEditorModel.getLanguageId()!==n&&this.textEditorModel.setLanguage(this.languageService.createById(n)))}createSnapshot(){return this.textEditorModel?this.textEditorModel.createSnapshot(!0):null}isResolved(){return!!this.textEditorModelHandle}dispose(){this.modelDisposeListener.dispose(),this.textEditorModelHandle&&this.createdEditorModel&&this.modelService.destroyModel(this.textEditorModelHandle),this.textEditorModelHandle=void 0,this.createdEditorModel=!1,super.dispose()}};fa=_([C(0,wv),C(1,Ev),C(2,yW),C(3,WF)],fa);var qp=class extends zp{get originalModel(){return this._originalModel}get modifiedModel(){return this._modifiedModel}constructor(t,e){super(),this._originalModel=t,this._modifiedModel=e}async resolve(){await Promise.all([this._originalModel?.resolve(),this._modifiedModel?.resolve()])}isResolved(){return!!(this._originalModel?.isResolved()&&this._modifiedModel?.isResolved())}dispose(){super.dispose()}};var Xx=class extends qp{constructor(e,n){super(e,n);this._textDiffEditorModel=void 0;this._originalModel=e,this._modifiedModel=n,this.updateTextDiffEditorModel()}get originalModel(){return this._originalModel}get modifiedModel(){return this._modifiedModel}get textDiffEditorModel(){return this._textDiffEditorModel}async resolve(){await super.resolve(),this.updateTextDiffEditorModel()}updateTextDiffEditorModel(){this.originalModel?.isResolved()&&this.modifiedModel?.isResolved()&&(this._textDiffEditorModel?(this._textDiffEditorModel.original=this.originalModel.textEditorModel,this._textDiffEditorModel.modified=this.modifiedModel.textEditorModel):this._textDiffEditorModel={original:this.originalModel.textEditorModel,modified:this.modifiedModel.textEditorModel})}isResolved(){return!!this._textDiffEditorModel}isReadonly(){return!!this.modifiedModel&&this.modifiedModel.isReadonly()}dispose(){this._textDiffEditorModel=void 0,super.dispose()}};function CA(r){let t=r;return typeof t?.resolve=="function"&&typeof t?.isResolved=="function"}var Al=class extends wi{constructor(e,n,o,i,s,a){super(e,n,o,i,a);this.original=o;this.modified=i;this.forceOpenAsBinary=s;this.cachedModel=void 0;this.labels=this.computeLabels()}static{this.ID="workbench.editors.diffEditorInput"}get typeId(){return Al.ID}get editorId(){return this.modified.editorId===this.original.editorId?this.modified.editorId:void 0}get capabilities(){let e=super.capabilities;return this.labels.forceDescription&&(e|=64),e}computeLabels(){let e,n=!1;if(this.preferredName)e=this.preferredName;else{let u=this.original.getName(),m=this.modified.getName();e=p(4921,null,u,m),n=u===m}let o,i,s;if(this.preferredDescription)o=this.preferredDescription,i=this.preferredDescription,s=this.preferredDescription;else{o=this.computeLabel(this.original.getDescription(0),this.modified.getDescription(0)),s=this.computeLabel(this.original.getDescription(2),this.modified.getDescription(2));let u=this.original.getDescription(1),m=this.modified.getDescription(1);if(typeof u=="string"&&typeof m=="string"&&(u||m)){let[g,h]=lH([u,m]);i=this.computeLabel(g,h)}}let a=this.computeLabel(this.original.getTitle(0)??this.original.getName(),this.modified.getTitle(0)??this.modified.getName()," \u2194 "),l=this.computeLabel(this.original.getTitle(1)??this.original.getName(),this.modified.getTitle(1)??this.modified.getName()," \u2194 "),d=this.computeLabel(this.original.getTitle(2)??this.original.getName(),this.modified.getTitle(2)??this.modified.getName()," \u2194 "),c=this.getPreferredTitle();return c&&(a=`${c} (${a})`,l=`${c} (${l})`,d=`${c} (${d})`),{name:e,shortDescription:o,mediumDescription:i,longDescription:s,forceDescription:n,shortTitle:a,mediumTitle:l,longTitle:d}}computeLabel(e,n,o=" - "){if(!(!e||!n))return e===n?n:`${e}${o}${n}`}getName(){return this.labels.name}getDescription(e=1){switch(e){case 0:return this.labels.shortDescription;case 2:return this.labels.longDescription;case 1:default:return this.labels.mediumDescription}}getTitle(e){switch(e){case 0:return this.labels.shortTitle;case 2:return this.labels.longTitle;default:case 1:return this.labels.mediumTitle}}async resolve(){let e=await this.createModel();return this.cachedModel?.dispose(),this.cachedModel=e,this.cachedModel}prefersEditorPane(e){return this.forceOpenAsBinary?e.find(n=>n.typeId===X2):e.find(n=>n.typeId===Y2)}async createModel(){let[e,n]=await Promise.all([this.original.resolve(),this.modified.resolve()]);return n instanceof fa&&e instanceof fa?new Xx(e,n):new qp(CA(e)?e:void 0,CA(n)?n:void 0)}toUntyped(e){let n=super.toUntyped(e);if(n)return{...n,modified:n.primary,original:n.secondary}}matches(e){return this===e?!0:e instanceof Al?this.modified.matches(e.modified)&&this.original.matches(e.original)&&e.forceOpenAsBinary===this.forceOpenAsBinary:Ci(e)?this.modified.matches(e.modified)&&this.original.matches(e.original):!1}dispose(){this.cachedModel&&(this.cachedModel.dispose(),this.cachedModel=void 0),super.dispose()}};Al=_([C(5,Yx)],Al);var Cbe=new w("workbenchState",void 0,{type:"string",description:p(4915,null)}),Tbe=new w("workspaceFolderCount",0,p(4916,null)),Ebe=new w("openFolderWorkspaceSupport",!0,!0),wbe=new w("enterMultiRootWorkspaceSupport",!0,!0),kbe=new w("emptyWorkspaceSupport",!0,!0),Pbe=new w("dirtyWorkingCopies",!1,p(4861,null)),IW=new w("remoteName","",p(4893,null)),_be=new w("virtualWorkspace","",p(4914,null)),Dbe=new w("temporaryWorkspace",!1,p(4908,null)),Rbe=new w("isSessionsWindow",!1,p(4880,null)),Abe=new w("hasWebFileSystemAccess",!1,!0),Mbe=new w("embedderIdentifier",void 0,p(4869,null)),Lbe=new w("inAutomation",!1,p(4872,null)),Obe=new w("isFullscreen",!1,p(4878,null)),Nbe=new w("isAuxiliaryWindowFocusedContext",!1,p(4875,null)),Ube=new w("isWindowAlwaysOnTop",!1,p(4881,null)),Fbe=new w("isAuxiliaryWindow",!1,p(4874,null)),Hbe=new w("activeEditorIsDirty",!1,p(4849,null)),Wbe=new w("activeEditorIsNotPreview",!1,p(4852,null)),Vbe=new w("activeEditorIsFirstInGroup",!1,p(4850,null)),Bbe=new w("activeEditorIsLastInGroup",!1,p(4851,null)),$be=new w("activeEditorIsPinned",!1,p(4853,null)),zbe=new w("activeEditorIsReadonly",!1,p(4854,null)),qbe=new w("activeCompareEditorCanSwap",!1,p(4840,null)),Kbe=new w("activeEditorCanToggleReadonly",!0,p(4844,null)),jbe=new w("activeEditorCanRevert",!1,p(4843,null)),Gbe=new w("activeEditorCanSplitInGroup",!0),Qbe=new w("activeEditor",null,{type:"string",description:p(4841,null)}),Jbe=new w("activeEditorAvailableEditorIds","",p(4842,null)),Ybe=new w("textCompareEditorVisible",!1,p(4910,null)),Xbe=new w("textCompareEditorActive",!1,p(4909,null)),Zbe=new w("sideBySideEditorActive",!1,p(4905,null)),eye=new w("groupEditorsCount",0,p(4871,null)),tye=new w("activeEditorGroupEmpty",!1,p(4845,null)),nye=new w("activeEditorGroupIndex",0,p(4846,null)),oye=new w("activeEditorGroupLast",!1,p(4847,null)),rye=new w("activeEditorGroupLocked",!1,p(4848,null)),N3=new w("multipleEditorGroups",!1,p(4883,null)),iye=N3.toNegated(),sye=new w("multipleEditorsSelectedInGroup",!1,p(4884,null)),aye=new w("twoEditorsSelectedInGroup",!1,p(4913,null)),lye=new w("SelectedEditorsInGroupFileOrUntitledResourceContextKey",!0,p(4902,null)),U3=new w("editorPartMultipleEditorGroups",!1,p(4867,null)),dye=U3.toNegated(),cye=new w("editorPartMaximizedEditorGroup",!1,p(4863,null)),uye=new w("editorPartModal",!1,p(4864,null)),pye=new w("editorPartModalMaximized",!1,p(4865,null)),mye=new w("editorPartModalNavigation",!1,p(4866,null)),gye=new w("editorIsOpen",!1,p(4862,null)),fye=new w("inZenMode",!1,p(4873,null)),hye=new w("isCenteredLayout",!1,p(4879,null)),vye=new w("splitEditorsVertically",!1,p(4906,null)),bye=new w("mainEditorAreaVisible",!0,p(4882,null)),yye=new w("editorTabsVisible",!0,p(4868,null)),Iye=new w("sideBarVisible",!1,p(4904,null)),xye=new w("sideBarFocus",!1,p(4903,null)),Sye=new w("activeViewlet","",p(4856,null)),Cye=new w("statusBarFocused",!1,p(4907,null)),Tye=new w("titleBarStyle","custom",p(4911,null)),Eye=new w("titleBarVisible",!1,p(4912,null)),wye=new w("isCompactTitleBar",!1,p(4876,null)),kye=new w("bannerFocused",!1,p(4860,null)),Pye=new w("notificationFocus",!0,p(4886,null)),_ye=new w("notificationCenterVisible",!1,p(4885,null)),Dye=new w("notificationToastsVisible",!1,p(4887,null)),Rye=new w("activeAuxiliary","",p(4839,null)),Aye=new w("auxiliaryBarFocus",!1,p(4857,null)),Mye=new w("auxiliaryBarVisible",!1,p(4859,null)),Lye=new w("auxiliaryBarMaximized",!1,p(4858,null)),Oye=new w("activePanel","",p(4855,null)),Nye=new w("panelFocus",!1,p(4889,null)),Uye=new w("panelPosition","bottom",p(4891,null)),Fye=new w("panelAlignment","center",p(4888,null)),Hye=new w("panelVisible",!1,p(4892,null)),Wye=new w("panelMaximized",!1,p(4890,null)),Vye=new w("focusedView","",p(4870,null));var tr=class{constructor(t,e,n,o){this._contextKeyService=t;this._fileService=e;this._languageService=n;this._modelService=o;this._schemeKey=tr.Scheme.bindTo(this._contextKeyService),this._filenameKey=tr.Filename.bindTo(this._contextKeyService),this._dirnameKey=tr.Dirname.bindTo(this._contextKeyService),this._pathKey=tr.Path.bindTo(this._contextKeyService),this._langIdKey=tr.LangId.bindTo(this._contextKeyService),this._resourceKey=tr.Resource.bindTo(this._contextKeyService),this._extensionKey=tr.Extension.bindTo(this._contextKeyService),this._hasResource=tr.HasResource.bindTo(this._contextKeyService),this._isFileSystemResource=tr.IsFileSystemResource.bindTo(this._contextKeyService)}static{this.Scheme=new w("resourceScheme",void 0,{type:"string",description:p(4900,null)})}static{this.Filename=new w("resourceFilename",void 0,{type:"string",description:p(4897,null)})}static{this.Dirname=new w("resourceDirname",void 0,{type:"string",description:p(4895,null)})}static{this.Path=new w("resourcePath",void 0,{type:"string",description:p(4899,null)})}static{this.LangId=new w("resourceLangId",void 0,{type:"string",description:p(4898,null)})}static{this.Resource=new w("resource",void 0,{type:"URI",description:p(4894,null)})}static{this.Extension=new w("resourceExtname",void 0,{type:"string",description:p(4896,null)})}static{this.HasResource=new w("resourceSet",void 0,{type:"boolean",description:p(4901,null)})}static{this.IsFileSystemResource=new w("isFileSystemResource",void 0,{type:"boolean",description:p(4877,null)})}_setLangId(){let t=this.get();if(!t){this._langIdKey.set(null);return}let e=this._modelService.getModel(t)?.getLanguageId()??this._languageService.guessLanguageIdByFilepathOrFirstLine(t);this._langIdKey.set(e)}set(t){t=t??void 0,!Ro(this._value,t)&&(this._value=t,this._contextKeyService.bufferChangeEvents(()=>{this._resourceKey.set(t?t.toString():null),this._schemeKey.set(t?t.scheme:null),this._filenameKey.set(t?Tt(t):null),this._dirnameKey.set(t?this.uriToPath(Go(t)):null),this._pathKey.set(t?this.uriToPath(t):null),this._setLangId(),this._extensionKey.set(t?xI(t):null),this._hasResource.set(!!t),this._isFileSystemResource.set(t?this._fileService.hasProvider(t):!1)}))}uriToPath(t){return t.scheme===V.file?t.fsPath:t.path}reset(){this._value=void 0,this._contextKeyService.bufferChangeEvents(()=>{this._resourceKey.reset(),this._schemeKey.reset(),this._filenameKey.reset(),this._dirnameKey.reset(),this._pathKey.reset(),this._langIdKey.reset(),this._extensionKey.reset(),this._hasResource.reset(),this._isFileSystemResource.reset()})}get(){return this._value}};tr=_([C(0,Oo),C(1,da),C(2,Ev),C(3,wv)],tr);var Zx=class extends tr{constructor(e,n,o,i){super(e,n,o,i);this._disposables=new $;this._disposables.add(n.onDidChangeFileSystemProviderRegistrations(()=>{let s=this.get();this._isFileSystemResource.set(!!(s&&n.hasProvider(s)))})),this._disposables.add(i.onModelAdded(s=>{Ro(s.uri,this.get())&&this._setLangId()})),this._disposables.add(i.onModelLanguageChanged(s=>{Ro(s.model.uri,this.get())&&this._setLangId()}))}dispose(){this._disposables.dispose()}};Zx=_([C(0,Oo),C(1,da),C(2,Ev),C(3,wv)],Zx);var eS=R("dialogService");var Xye=R("fileDialogService");var tS="__";function xW(r){return typeof r=="object"&&r!==null&&"wwwAuthenticate"in r&&typeof r.wwwAuthenticate=="string"}var SW=R("IAuthenticationService");var tIe=R("IAuthenticationExtensionsService");var CW=R("openerService");var Kp=xv;var TW=R("lifecycleService");var EW=R("defaultAccountService");var Me;(i=>(i.Setup={hidden:new w("chatSetupHidden",!1,!0),installed:new w("chatSetupInstalled",!1,!0),disabled:new w("chatSetupDisabled",!1,!0),untrusted:new w("chatSetupUntrusted",!1,!0),later:new w("chatSetupLater",!1,!0),registered:new w("chatSetupRegistered",!1,!0)},i.Entitlement={signedOut:new w("chatEntitlementSignedOut",!1,!0),canSignUp:new w("chatPlanCanSignUp",!1,!0),planFree:new w("chatPlanFree",!1,!0),planPro:new w("chatPlanPro",!1,!0),planEdu:new w("chatPlanEdu",!1,!0),planProPlus:new w("chatPlanProPlus",!1,!0),planBusiness:new w("chatPlanBusiness",!1,!0),planEnterprise:new w("chatPlanEnterprise",!1,!0),organisations:new w("chatEntitlementOrganisations",void 0,!0),internal:new w("chatEntitlementInternal",!1,!0),sku:new w("chatEntitlementSku",void 0,!0)},i.chatQuotaExceeded=new w("chatQuotaExceeded",!1,!0),i.completionsQuotaExceeded=new w("completionsQuotaExceeded",!1,!0),i.chatAnonymous=new w("chatAnonymous",!1,!0)))(Me||={});var F3=R("chatEntitlementService");function H3(r){return r===10||r===6||r===7||r===8||r===9}var nS={upgradePlanUrl:Yo.defaultChatAgent?.upgradePlanUrl??"",providerUriSetting:Yo.defaultChatAgent?.providerUriSetting??"",entitlementSignupLimitedUrl:Yo.defaultChatAgent?.entitlementSignupLimitedUrl??"",chatQuotaExceededContext:Yo.defaultChatAgent?.chatQuotaExceededContext??"",completionsQuotaExceededContext:Yo.defaultChatAgent?.completionsQuotaExceededContext??""},wW="chat.allowAnonymousAccess";function EA(r,t,e){return!(r.getValue(wW)!==!0||t!==1||e.hidden||e.disabled)}function kW(r,t,e){e.publicLog2("chatEntitlements",{chatHidden:!!r.hidden,chatDisabled:!!r.disabled,chatEntitlement:r.entitlement,chatRegistered:!!r.registered,chatAnonymous:EA(t,r.entitlement,r)})}var _v=class extends O{constructor(e,n,o,i,s,a){super();this.contextKeyService=i;this.configurationService=s;this.telemetryService=a;this._onDidChangeQuotaExceeded=this._register(new E);this.onDidChangeQuotaExceeded=this._onDidChangeQuotaExceeded.event;this._onDidChangeQuotaRemaining=this._register(new E);this.onDidChangeQuotaRemaining=this._onDidChangeQuotaRemaining.event;this._quotas={};this.ExtensionQuotaContextKeys={chatQuotaExceeded:nS.chatQuotaExceededContext,completionsQuotaExceeded:nS.completionsQuotaExceededContext};this._onDidChangeAnonymous=this._register(new E);this.onDidChangeAnonymous=this._onDidChangeAnonymous.event;this.anonymousObs=xo(this.onDidChangeAnonymous,()=>this.anonymous);if(this.chatQuotaExceededContextKey=Me.chatQuotaExceeded.bindTo(this.contextKeyService),this.completionsQuotaExceededContextKey=Me.completionsQuotaExceeded.bindTo(this.contextKeyService),this.anonymousContextKey=Me.chatAnonymous.bindTo(this.contextKeyService),this.anonymousContextKey.set(this.anonymous),this.onDidChangeEntitlement=he.map(he.filter(this.contextKeyService.onDidChangeContext,d=>d.affectsSome(new Set([Me.Entitlement.planEdu.key,Me.Entitlement.planPro.key,Me.Entitlement.planBusiness.key,Me.Entitlement.planEnterprise.key,Me.Entitlement.planProPlus.key,Me.Entitlement.planFree.key,Me.Entitlement.canSignUp.key,Me.Entitlement.signedOut.key,Me.Entitlement.organisations.key,Me.Entitlement.internal.key,Me.Entitlement.sku.key])),this._store),()=>{},this._store),this.entitlementObs=xo(this.onDidChangeEntitlement,()=>this.entitlement),this.onDidChangeSentiment=he.map(he.filter(this.contextKeyService.onDidChangeContext,d=>d.affectsSome(new Set([Me.Setup.hidden.key,Me.Setup.disabled.key,Me.Setup.untrusted.key,Me.Setup.installed.key,Me.Setup.later.key,Me.Setup.registered.key])),this._store),()=>{},this._store),this.sentimentObs=xo(this.onDidChangeSentiment,()=>this.sentiment),Pr&&!o.remoteAuthority){Me.Setup.hidden.bindTo(this.contextKeyService).set(!0);return}if(!n.defaultChatAgent)return;let l=this.context=new mt(()=>this._register(e.createInstance(fs)));this.requests=new mt(()=>this._register(e.createInstance(Dv,l.value,{clearQuotas:()=>this.clearQuotas(),acceptQuotas:d=>this.acceptQuotas(d)}))),this.registerListeners()}get entitlement(){return this.contextKeyService.getContextKeyValue(Me.Entitlement.planEdu.key)===!0?10:this.contextKeyService.getContextKeyValue(Me.Entitlement.planPro.key)===!0?6:this.contextKeyService.getContextKeyValue(Me.Entitlement.planBusiness.key)===!0?8:this.contextKeyService.getContextKeyValue(Me.Entitlement.planEnterprise.key)===!0?9:this.contextKeyService.getContextKeyValue(Me.Entitlement.planProPlus.key)===!0?7:this.contextKeyService.getContextKeyValue(Me.Entitlement.planFree.key)===!0?5:this.contextKeyService.getContextKeyValue(Me.Entitlement.canSignUp.key)===!0?3:this.contextKeyService.getContextKeyValue(Me.Entitlement.signedOut.key)===!0?1:2}get isInternal(){return this.contextKeyService.getContextKeyValue(Me.Entitlement.internal.key)===!0}get organisations(){return this.contextKeyService.getContextKeyValue(Me.Entitlement.organisations.key)}get sku(){return this.contextKeyService.getContextKeyValue(Me.Entitlement.sku.key)}get copilotTrackingId(){return this.context?.value.state.copilotTrackingId}get previewFeaturesDisabled(){return this.contextKeyService.getContextKeyValue("github.copilot.previewFeaturesDisabled")===!0}get quotas(){return this._quotas}registerListeners(){let e=new Set([this.ExtensionQuotaContextKeys.chatQuotaExceeded,this.ExtensionQuotaContextKeys.completionsQuotaExceeded]),n=this._register(new sn);this._register(this.contextKeyService.onDidChangeContext(s=>{s.affectsSome(e)&&(n.value&&n.value.cancel(),n.value=new Ce,this.update(n.value.token))}));let o=this.anonymous,i=()=>{let s=this.anonymous;s!==o&&(o=s,this.anonymousContextKey.set(s),this.context?.hasValue&&kW(this.context.value.state,this.configurationService,this.telemetryService),this._onDidChangeAnonymous.fire())};this._register(this.configurationService.onDidChangeConfiguration(s=>{s.affectsConfiguration(wW)&&i()})),this._register(this.onDidChangeEntitlement(()=>i())),this._register(this.onDidChangeSentiment(()=>i()))}acceptQuotas(e){let n=this._quotas;this._quotas=e,this.updateContextKeys();let{changed:o}=this.compareQuotas(n.chat,e.chat),{changed:i}=this.compareQuotas(n.completions,e.completions),{changed:s}=this.compareQuotas(n.premiumChat,e.premiumChat);(o.exceeded||i.exceeded||s.exceeded)&&this._onDidChangeQuotaExceeded.fire(),(o.remaining||i.remaining||s.remaining)&&this._onDidChangeQuotaRemaining.fire()}compareQuotas(e,n){return{changed:{exceeded:e?.percentRemaining===0!=(n?.percentRemaining===0),remaining:e?.percentRemaining!==n?.percentRemaining}}}clearQuotas(){this.acceptQuotas({})}updateContextKeys(){this.chatQuotaExceededContextKey.set(this._quotas.chat?.percentRemaining===0),this.completionsQuotaExceededContextKey.set(this._quotas.completions?.percentRemaining===0)}get sentiment(){return{installed:this.contextKeyService.getContextKeyValue(Me.Setup.installed.key)===!0,hidden:this.contextKeyService.getContextKeyValue(Me.Setup.hidden.key)===!0,disabled:this.contextKeyService.getContextKeyValue(Me.Setup.disabled.key)===!0,untrusted:this.contextKeyService.getContextKeyValue(Me.Setup.untrusted.key)===!0,later:this.contextKeyService.getContextKeyValue(Me.Setup.later.key)===!0,registered:this.contextKeyService.getContextKeyValue(Me.Setup.registered.key)===!0}}get anonymous(){return EA(this.configurationService,this.entitlement,this.sentiment)}markAnonymousRateLimited(){this.anonymous&&(this.chatQuotaExceededContextKey.set(!0),this._onDidChangeQuotaExceeded.fire())}async update(e){await this.requests?.value.forceResolveEntitlement(e)}};_v=_([C(0,Jo),C(1,ms),C(2,Kp),C(3,Oo),C(4,Kt),C(5,gs)],_v);var Dv=class extends O{constructor(e,n,o,i,s,a,l,d,c,u){super();this.context=e;this.chatQuotasAccessor=n;this.telemetryService=o;this.logService=i;this.requestService=s;this.dialogService=a;this.openerService=l;this.lifecycleService=d;this.defaultAccountService=c;this.authenticationService=u;this.pendingResolveCts=new Ce;this.state={entitlement:this.context.state.entitlement},this.registerListeners(),this.resolve()}registerListeners(){this._register(this.defaultAccountService.onDidChangeDefaultAccount(()=>this.resolve())),this._register(this.context.onDidChange(()=>{(!this.context.state.installed||this.context.state.disabled||this.context.state.entitlement===1)&&(this.state={entitlement:this.state.entitlement,quotas:void 0},this.chatQuotasAccessor.clearQuotas())}))}async resolve(){this.pendingResolveCts.dispose(!0);let e=this.pendingResolveCts=new Ce,n=await this.defaultAccountService.getDefaultAccount();if(e.token.isCancellationRequested)return;let o;n?this.state.entitlement===1&&(o={entitlement:2}):o={entitlement:1},o&&this.update(o),n&&await this.resolveEntitlement(n,e.token)}async resolveEntitlement(e,n){let o=await this.doResolveEntitlement(e,n);return typeof o?.entitlement=="number"&&!n.isCancellationRequested&&this.update(o),o}async doResolveEntitlement(e,n){if(n.isCancellationRequested)return;let o=e.entitlementsData;if(!o)return this.logService.trace("[chat entitlement]: no entitlements data available on default account"),{entitlement:o===null?1:2};let i;o.access_type_sku==="free_limited_copilot"?i=5:o.can_signup_for_limited?i=3:o.copilot_plan==="individual_edu"?i=10:o.copilot_plan==="individual"?i=6:o.copilot_plan==="individual_pro"?i=7:o.copilot_plan==="business"?i=8:o.copilot_plan==="enterprise"?i=9:i=4;let s={entitlement:i,organisations:o.organization_login_list,quotas:this.toQuotas(o),sku:o.access_type_sku,copilotTrackingId:o.analytics_tracking_id};return this.logService.trace(`[chat entitlement]: resolved to ${s.entitlement}, quotas: ${JSON.stringify(s.quotas)}`),this.telemetryService.publicLog2("chatInstallEntitlement",{entitlement:s.entitlement,tid:o.analytics_tracking_id,sku:s.sku,quotaChat:s.quotas?.chat?.remaining,quotaPremiumChat:s.quotas?.premiumChat?.remaining,quotaCompletions:s.quotas?.completions?.remaining,quotaResetDate:s.quotas?.resetDate}),s}toQuotas(e){let n={resetDate:e.quota_reset_date_utc??e.quota_reset_date??e.limited_user_reset_date,resetDateHasTime:typeof e.quota_reset_date_utc=="string"};if(e.monthly_quotas?.chat&&typeof e.limited_user_quotas?.chat=="number"&&(n.chat={total:e.monthly_quotas.chat,remaining:e.limited_user_quotas.chat,percentRemaining:Math.min(100,Math.max(0,e.limited_user_quotas.chat/e.monthly_quotas.chat*100)),overageEnabled:!1,overageCount:0,unlimited:!1}),e.monthly_quotas?.completions&&typeof e.limited_user_quotas?.completions=="number"&&(n.completions={total:e.monthly_quotas.completions,remaining:e.limited_user_quotas.completions,percentRemaining:Math.min(100,Math.max(0,e.limited_user_quotas.completions/e.monthly_quotas.completions*100)),overageEnabled:!1,overageCount:0,unlimited:!1}),e.quota_snapshots)for(let o of["chat","completions","premium_interactions"]){let i=e.quota_snapshots[o];if(!i)continue;let s={total:i.entitlement,remaining:i.remaining,percentRemaining:Math.min(100,Math.max(0,i.percent_remaining)),overageEnabled:i.overage_permitted,overageCount:i.overage_count,unlimited:i.unlimited};switch(o){case"chat":n.chat=s;break;case"completions":n.completions=s;break;case"premium_interactions":n.premiumChat=s;break}}return n}async request(e,n,o,i,s,a){let l;for(let d of i){if(s.isCancellationRequested)return l;try{let c=await this.requestService.request({type:n,url:e,data:n==="POST"?JSON.stringify(o):void 0,disableCache:!0,headers:{Authorization:`Bearer ${d.accessToken}`},callSite:a},s),u=c.res.statusCode;if(u&&u!==200){l=c;continue}return c}catch(c){s.isCancellationRequested||this.logService.error(`[chat entitlement] request: error ${c}`)}}return l}update(e){this.state=e,this.context.update({entitlement:this.state.entitlement,organisations:this.state.organisations,sku:this.state.sku,copilotTrackingId:this.state.copilotTrackingId}),e.quotas&&this.chatQuotasAccessor.acceptQuotas(e.quotas)}async forceResolveEntitlement(e=ve.None){let n=await this.defaultAccountService.refresh();if(n)return this.resolveEntitlement(n,e)}async signUpFree(){let e=await this.getSessions();if(e.length!==0)return this.doSignUpFree(e)}async doSignUpFree(e){let n={restricted_telemetry:this.telemetryService.telemetryLevel===0?"disabled":"enabled",public_code_suggestions:"enabled"},o=await this.request(nS.entitlementSignupLimitedUrl,"POST",n,e,ve.None,"chatEntitlementService.signUpFree");if(!o)return await this.onUnknownSignUpError(p(17413,null),"[chat entitlement] sign-up: no response")?this.doSignUpFree(e):{errorCode:1};if(o.res.statusCode&&o.res.statusCode!==200){if(o.res.statusCode===422)try{let l=await lA(o);if(l){let d=JSON.parse(l);if(typeof d.message=="string"&&d.message)return this.onUnprocessableSignUpError(`[chat entitlement] sign-up: unprocessable entity (${d.message})`,d.message),{errorCode:o.res.statusCode}}}catch{}return await this.onUnknownSignUpError(p(17414,null,o.res.statusCode),`[chat entitlement] sign-up: unexpected status code ${o.res.statusCode}`)?this.doSignUpFree(e):{errorCode:o.res.statusCode}}let i=null;try{i=await lA(o)}catch{}if(!i)return await this.onUnknownSignUpError(p(17412,null),"[chat entitlement] sign-up: response has no content")?this.doSignUpFree(e):{errorCode:2};let s;try{s=JSON.parse(i),this.logService.trace(`[chat entitlement] sign-up: response is ${i}`)}catch(a){return await this.onUnknownSignUpError(p(17411,null),`[chat entitlement] sign-up: error parsing response (${a})`)?this.doSignUpFree(e):{errorCode:3}}return this.update({entitlement:5}),!!s?.subscribed}async getSessions(){let e=await this.defaultAccountService.getDefaultAccount();if(e){let o=(await this.authenticationService.getSessions(e.authenticationProvider.id)).filter(i=>i.id===e.sessionId);if(o.length)return o}return[...await this.authenticationService.getSessions(this.defaultAccountService.getDefaultAccountAuthenticationProvider().id)]}async onUnknownSignUpError(e,n){if(this.logService.error(n),!this.lifecycleService.willShutdown){let{confirmed:o}=await this.dialogService.confirm({type:Xe.Error,message:p(17415,null),detail:e,primaryButton:p(17410,null)});return o}return!1}onUnprocessableSignUpError(e,n){this.logService.error(e),this.lifecycleService.willShutdown||this.dialogService.prompt({type:Xe.Error,message:p(17416,null),detail:n,buttons:[{label:p(17403,null),run:()=>{}},{label:p(17402,null),run:()=>this.openerService.open(b.parse(nS.upgradePlanUrl))}]})}async signIn(e){let n=await this.defaultAccountService.signIn({additionalScopes:e?.additionalScopes,extraAuthorizeParameters:{get_started_with:"copilot-vscode"},provider:e?.useSocialProvider});if(!n)return{};let o=await this.doResolveEntitlement(n,ve.None);return{defaultAccount:n,entitlements:o}}dispose(){this.pendingResolveCts.dispose(!0),super.dispose()}};Dv=_([C(2,gs),C(3,oe),C(4,Bx),C(5,eS),C(6,CW),C(7,TW),C(8,EW),C(9,SW)],Dv);var fs=class extends O{constructor(e,n,o,i,s){super();this.storageService=n;this.logService=o;this.configurationService=i;this.telemetryService=s;this.suspendedState=void 0;this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this.updateBarrier=void 0;this.canSignUpContextKey=Me.Entitlement.canSignUp.bindTo(e),this.signedOutContextKey=Me.Entitlement.signedOut.bindTo(e),this.freeContextKey=Me.Entitlement.planFree.bindTo(e),this.eduContextKey=Me.Entitlement.planEdu.bindTo(e),this.proContextKey=Me.Entitlement.planPro.bindTo(e),this.proPlusContextKey=Me.Entitlement.planProPlus.bindTo(e),this.businessContextKey=Me.Entitlement.planBusiness.bindTo(e),this.enterpriseContextKey=Me.Entitlement.planEnterprise.bindTo(e),this.organisationsContextKey=Me.Entitlement.organisations.bindTo(e),this.isInternalContextKey=Me.Entitlement.internal.bindTo(e),this.skuContextKey=Me.Entitlement.sku.bindTo(e),this.hiddenContext=Me.Setup.hidden.bindTo(e),this.laterContext=Me.Setup.later.bindTo(e),this.installedContext=Me.Setup.installed.bindTo(e),this.disabledContext=Me.Setup.disabled.bindTo(e),this.untrustedContext=Me.Setup.untrusted.bindTo(e),this.registeredContext=Me.Setup.registered.bindTo(e),this._state=this.storageService.getObject(fs.CHAT_ENTITLEMENT_CONTEXT_STORAGE_KEY,0)??{entitlement:1,organisations:void 0,sku:void 0,copilotTrackingId:void 0},this.updateContextSync(),this.registerListeners()}static{this.CHAT_ENTITLEMENT_CONTEXT_STORAGE_KEY="chat.setupContext"}static{this.CHAT_DISABLED_CONFIGURATION_KEY="chat.disableAIFeatures"}get state(){return this.withConfiguration(this.suspendedState??this._state)}registerListeners(){this._register(this.configurationService.onDidChangeConfiguration(e=>{e.affectsConfiguration(fs.CHAT_DISABLED_CONFIGURATION_KEY)&&this.updateContext()}))}withConfiguration(e){return this.configurationService.getValue(fs.CHAT_DISABLED_CONFIGURATION_KEY)===!0?{...e,hidden:!0}:e}async update(e){this.logService.trace(`[chat entitlement context] update(): ${JSON.stringify(e)}`);let n=JSON.stringify(this._state);if(typeof e.installed=="boolean"&&typeof e.disabled=="boolean"&&typeof e.untrusted=="boolean"&&(this._state.installed=e.installed,this._state.disabled=e.disabled,this._state.untrusted=e.untrusted,e.installed&&!e.disabled&&(e.hidden=!1)),typeof e.hidden=="boolean"&&(this._state.hidden=e.hidden),typeof e.later=="boolean"&&(this._state.later=e.later),typeof e.entitlement=="number"&&(this._state.entitlement=e.entitlement,this._state.organisations=e.organisations,this._state.sku=e.sku,this._state.copilotTrackingId=e.copilotTrackingId,this._state.entitlement===5||H3(this._state.entitlement)?this._state.registered=!0:this._state.entitlement===3&&(this._state.registered=!1)),EA(this.configurationService,this._state.entitlement,this._state)&&(this._state.sku="no_auth_limited_copilot"),n!==JSON.stringify(this._state))return this.storageService.store(fs.CHAT_ENTITLEMENT_CONTEXT_STORAGE_KEY,{...this._state,later:void 0},0,1),this.updateContext()}async updateContext(){await this.updateBarrier?.wait(),this.updateContextSync()}updateContextSync(){let e=this.withConfiguration(this._state);this.signedOutContextKey.set(e.entitlement===1),this.canSignUpContextKey.set(e.entitlement===3),this.freeContextKey.set(e.entitlement===5),this.eduContextKey.set(e.entitlement===10),this.proContextKey.set(e.entitlement===6),this.proPlusContextKey.set(e.entitlement===7),this.businessContextKey.set(e.entitlement===8),this.enterpriseContextKey.set(e.entitlement===9),this.organisationsContextKey.set(e.organisations),this.isInternalContextKey.set(!!e.organisations?.some(n=>n==="github"||n==="microsoft"||n==="ms-copilot"||n==="MicrosoftCopilot")),this.skuContextKey.set(e.sku),this.hiddenContext.set(!!e.hidden),this.laterContext.set(!!e.later),this.installedContext.set(!!e.installed),this.disabledContext.set(!!e.disabled),this.untrustedContext.set(!!e.untrusted),this.registeredContext.set(!!e.registered),this.logService.trace(`[chat entitlement context] updateContext(): ${JSON.stringify(e)}`),kW(e,this.configurationService,this.telemetryService),this._onDidChange.fire()}suspend(){this.suspendedState={...this._state},this.updateBarrier=new In}resume(){this.suspendedState=void 0,this.updateBarrier?.open(),this.updateBarrier=void 0}};fs=_([C(0,Oo),C(1,Sr),C(2,oe),C(3,Kt),C(4,gs)],fs);qe(F3,_v,0);var ki;(ie=>{ie.responseVote=new w("chatSessionResponseVote","",{type:"string",description:p(8187,null)}),ie.responseDetectedAgentCommand=new w("chatSessionResponseDetectedAgentOrCommand",!1,{type:"boolean",description:p(8165,null)}),ie.responseSupportsIssueReporting=new w("chatResponseSupportsIssueReporting",!1,{type:"boolean",description:p(8157,null)}),ie.responseIsFiltered=new w("chatSessionResponseFiltered",!1,{type:"boolean",description:p(8156,null)}),ie.responseHasError=new w("chatSessionResponseError",!1,{type:"boolean",description:p(8155,null)}),ie.requestInProgress=new w("chatSessionRequestInProgress",!1,{type:"boolean",description:p(8186,null)}),ie.currentlyEditing=new w("chatSessionCurrentlyEditing",!1,{type:"boolean",description:p(8184,null)}),ie.currentlyEditingInput=new w("chatSessionCurrentlyEditingInput",!1,{type:"boolean",description:p(8185,null)});let l;(ae=>(ae.Sent="s",ae.Queue="q",ae.Steer="st"))(l=ie.EditingRequestType||={}),ie.editingRequestType=new w("chatEditingSentRequest",void 0,{type:"string",description:p(8130,null)}),ie.isResponse=new w("chatResponse",!1,{type:"boolean",description:p(8154,null)}),ie.isRequest=new w("chatRequest",!1,{type:"boolean",description:p(8152,null)}),ie.isFirstRequest=new w("chatFirstRequest",!1,{type:"boolean",description:p(8132,null)}),ie.isPendingRequest=new w("chatRequestIsPending",!1,{type:"boolean",description:p(8153,null)}),ie.itemId=new w("chatItemId","",{type:"string",description:p(8141,null)}),ie.lastItemId=new w("chatLastItemId",[],{type:"string",description:p(8142,null)}),ie.editApplied=new w("chatEditApplied",!1,{type:"boolean",description:p(8124,null)}),ie.inputHasText=new w("chatInputHasText",!1,{type:"boolean",description:p(8183,null)}),ie.inputHasFocus=new w("chatInputHasFocus",!1,{type:"boolean",description:p(8182,null)}),ie.inChatInput=new w("inChatInput",!1,{type:"boolean",description:p(8180,null)}),ie.inChatSession=new w("inChat",!1,{type:"boolean",description:p(8174,null)}),ie.inChatQuestionCarousel=new w("inChatQuestionCarousel",!1,{type:"boolean",description:p(8176,null)}),ie.inChatEditor=new w("inChatEditor",!1,{type:"boolean",description:p(8175,null)}),ie.inChatTodoList=new w("inChatTodoList",!1,{type:"boolean",description:p(8179,null)}),ie.inChatTip=new w("inChatTip",!1,{type:"boolean",description:p(8178,null)}),ie.multipleChatTips=new w("multipleChatTips",!1,{type:"boolean",description:p(8190,null)}),ie.inChatTerminalToolOutput=new w("inChatTerminalToolOutput",!1,{type:"boolean",description:p(8177,null)}),ie.chatModeKind=new w("chatAgentKind","ask",{type:"string",description:p(8109,null)}),ie.chatPermissionLevel=new w("chatPermissionLevel","default",{type:"string",description:p(8150,null)}),ie.chatModeName=new w("chatModeName","",{type:"string",description:p(8145,null)}),ie.chatModelId=new w("chatModelId","",{type:"string",description:p(8143,null)}),ie.supported=Wt.or(mW.negate(),IW.notEqualsTo(""),Wt.has("config.chat.experimental.serverlessWebEnabled")),ie.enabled=new w("chatIsEnabled",!1,{type:"boolean",description:p(8139,null)}),ie.lockedToCodingAgent=new w("lockedToCodingAgent",!1,{type:"boolean",description:p(8189,null)}),ie.lockedCodingAgentId=new w("lockedCodingAgentId","",{type:"string",description:p(8188,null)}),ie.chatSessionHasCustomAgentTarget=new w("chatSessionHasCustomAgentTarget",!1,{type:"boolean",description:p(8158,null)}),ie.chatSessionHasTargetedModels=new w("chatSessionHasTargetedModels",!1,{type:"boolean",description:p(8162,null)}),ie.agentSupportsAttachments=new w("agentSupportsAttachments",!1,{type:"boolean",description:p(8121,null)}),ie.withinEditSessionDiff=new w("withinEditSessionDiff",!1,{type:"boolean",description:p(8192,null)}),ie.filePartOfEditSession=new w("filePartOfEditSession",!1,{type:"boolean",description:p(8171,null)}),ie.extensionParticipantRegistered=new w("chatPanelExtensionParticipantRegistered",!1,{type:"boolean",description:p(8147,null)}),ie.panelParticipantRegistered=new w("chatPanelParticipantRegistered",!1,{type:"boolean",description:p(8149,null)}),ie.chatEditingCanUndo=new w("chatEditingCanUndo",!1,{type:"boolean",description:p(8126,null)}),ie.chatEditingCanRedo=new w("chatEditingCanRedo",!1,{type:"boolean",description:p(8125,null)}),ie.languageModelsAreUserSelectable=new w("chatModelsAreUserSelectable",!1,{type:"boolean",description:p(8144,null)}),ie.chatSessionHasModels=new w("chatSessionHasModels",!1,{type:"boolean",description:p(8161,null)}),ie.chatSessionOptionsValid=new w("chatSessionOptionsValid",!0,{type:"boolean",description:p(8164,null)}),ie.extensionInvalid=new w("chatExtensionInvalid",!1,{type:"boolean",description:p(8131,null)}),ie.inputCursorAtTop=new w("chatCursorAtTop",!1),ie.inputHasAgent=new w("chatInputHasAgent",!1),ie.location=new w("chatLocation",void 0),ie.inQuickChat=new w("quickChatHasFocus",!1,{type:"boolean",description:p(8181,null)}),ie.inAgentSessionsWelcome=new w("inAgentSessionsWelcome",!1,{type:"boolean",description:p(8173,null)}),ie.chatSessionType=new w("chatSessionType","",{type:"string",description:p(8168,null)}),ie.hasFileAttachments=new w("chatHasFileAttachments",!1,{type:"boolean",description:p(8136,null)}),ie.chatSessionIsEmpty=new w("chatSessionIsEmpty",!0,{type:"boolean",description:p(8163,null)}),ie.hasPendingRequests=new w("chatHasPendingRequests",!1,{type:"boolean",description:p(8137,null)}),ie.chatSessionHasDebugData=new w("chatSessionHasDebugData",!1,{type:"boolean",description:p(8159,null)}),ie.chatSessionHasDebugTools=new w("chatSessionHasDebugTools",!1,{type:"boolean",description:p(8160,null)}),ie.remoteJobCreating=new w("chatRemoteJobCreating",!1,{type:"boolean",description:p(8151,null)}),ie.hasRemoteCodingAgent=new w("hasRemoteCodingAgent",!1,p(8172,null)),ie.hasCanDelegateProviders=new w("chatHasCanDelegateProviders",!1,{type:"boolean",description:p(8135,null)}),ie.enableRemoteCodingAgentPromptFileOverlay=new w("enableRemoteCodingAgentPromptFileOverlay",!1,p(8170,null)),ie.skipChatRequestInProgressMessage=new w("chatSkipRequestInProgressMessage",!1,{type:"boolean",description:p(8169,null)}),ie.Setup=Me.Setup,ie.Entitlement=Me.Entitlement,ie.chatQuotaExceeded=Me.chatQuotaExceeded,ie.completionsQuotaExceeded=Me.completionsQuotaExceeded,ie.Editing={hasToolConfirmation:new w("chatHasToolConfirmation",!1,{type:"boolean",description:p(8129,null)}),hasElicitationRequest:new w("chatHasElicitationRequest",!1,{type:"boolean",description:p(8127,null)}),hasQuestionCarousel:new w("chatHasQuestionCarousel",!1,{type:"boolean",description:p(8128,null)})},ie.Tools={toolsCount:new w("toolsCount",0,{type:"number",description:p(8191,null)})},ie.foregroundSessionCount=new w("chatForegroundSessionCount",0,{type:"number",description:p(8133,null)}),ie.Modes={hasCustomChatModes:new w("chatHasCustomAgents",!1,{type:"boolean",description:p(8134,null)}),agentModeDisabledByPolicy:new w("chatAgentModeDisabledByPolicy",!1,{type:"boolean",description:p(8122,null)})},ie.panelLocation=new w("chatPanelLocation",void 0,{type:"number",description:p(8148,null)}),ie.agentSessionsViewerFocused=new w("agentSessionsViewerFocused",!0,{type:"boolean",description:p(8116,null)}),ie.agentSessionsViewerOrientation=new w("agentSessionsViewerOrientation",void 0,{type:"number",description:p(8117,null)}),ie.agentSessionsViewerPosition=new w("agentSessionsViewerPosition",void 0,{type:"number",description:p(8118,null)}),ie.agentSessionsViewerVisible=new w("agentSessionsViewerVisible",void 0,{type:"boolean",description:p(8119,null)}),ie.agentSessionType=new w("chatSessionType","",{type:"string",description:p(8120,null)}),ie.chatSessionSupportsDelegation=new w("chatSessionSupportsDelegation",!0,{type:"boolean",description:p(8166,null)}),ie.chatSessionSupportsFork=new w("chatSessionSupportsFork",!1,{type:"boolean",description:p(8167,null)}),ie.agentSessionSection=new w("agentSessionSection","",{type:"string",description:p(8115,null)}),ie.isArchivedAgentSession=new w("agentSessionIsArchived",!1,{type:"boolean",description:p(8112,null)}),ie.isPinnedAgentSession=new w("agentSessionIsPinned",!1,{type:"boolean",description:p(8113,null)}),ie.isReadAgentSession=new w("agentSessionIsRead",!1,{type:"boolean",description:p(8114,null)}),ie.hasMultipleAgentSessionsSelected=new w("agentSessionHasMultipleSelected",!1,{type:"boolean",description:p(8111,null)}),ie.hasAgentSessionChanges=new w("agentSessionHasChanges",!1,{type:"boolean",description:p(8110,null)}),ie.isKatexMathElement=new w("chatIsKatexMathElement",!1,{type:"boolean",description:p(8140,null)}),ie.hasUsedCreateSlashCommands=new w("chatHasUsedCreateSlashCommands",!1,{type:"boolean",description:p(8138,null)}),ie.contextUsageHasBeenOpened=new w("chatContextUsageHasBeenOpened",!1,{type:"boolean",description:p(8123,null)}),ie.newChatButtonExperimentIcon=new w("chatNewChatButtonExperimentIcon","",{type:"string",description:p(8146,null)})})(ki||={});var V3;(e=>(e.inEditingMode=Wt.or(ki.chatModeKind.isEqualTo("edit"),ki.chatModeKind.isEqualTo("agent")),e.chatSetupTriggerContext=Wt.or(ki.Setup.installed.negate(),ki.Entitlement.canSignUp)))(V3||={});var PW=R("ILanguageModelsConfigurationService");var RW;(n=>{function r(o){return(typeof o.capabilities?.agentMode>"u"||o.capabilities.agentMode)&&!!o.capabilities?.toolCalling}n.suitableForAgentMode=r;function t(o){return`${o.name} (${o.vendor})`}n.asQualifiedName=t;function e(o,i){return i.vendor==="copilot"&&o===i.name?!0:o===t(i)}n.matchesQualifiedName=e})(RW||={});var rS=R("ILanguageModelsService"),_W={type:"object",required:["vendor","displayName"],properties:{vendor:{type:"string",description:p(8232,null)},displayName:{type:"string",description:p(8228,null)},configuration:{type:"object",description:p(8226,null),anyOf:[{$ref:"http://json-schema.org/draft-07/schema#"},{properties:{properties:{type:"object",additionalProperties:{$ref:"http://json-schema.org/draft-07/schema#",properties:{secret:{type:"boolean",description:p(8227,null)}}}},additionalProperties:{$ref:"http://json-schema.org/draft-07/schema#",properties:{secret:{type:"boolean",description:p(8227,null)}}}}}]},managementCommand:{type:"string",description:p(8230,null),deprecated:!0,deprecationMessage:p(8231,null)},when:{type:"string",description:p(8234,null)}}},B3=Jx.registerExtensionPoint({extensionPoint:"languageModelChatProviders",jsonSchema:{description:p(8225,null),oneOf:[_W,{type:"array",items:_W}]},activationEventsGenerator:function*(r){for(let t of r)yield`onLanguageModelChatProvider:${t.vendor}`}}),wA="chatModelPickerPreferences",DW="chatModelRecentlyUsed",kA="chat.participantNameRegistry",PA="chat.modelsControl",Dc=class{constructor(t,e,n,o,i,s,a,l,d){this._extensionService=t;this._logService=e;this._storageService=n;this._contextKeyService=o;this._languageModelsConfigurationService=i;this._quickInputService=s;this._secretStorageService=a;this._productService=l;this._requestService=d;this._store=new $;this._providers=new Map;this._vendors=new Map;this._onDidChangeLanguageModelVendors=this._store.add(new E);this.onDidChangeLanguageModelVendors=this._onDidChangeLanguageModelVendors.event;this._modelsGroups=new Map;this._modelCache=new Map;this._resolveLMSequencer=new pl;this._modelPickerUserPreferences={};this._modelConfigurations=new Map;this._onLanguageModelChange=this._store.add(new E);this.onDidChangeLanguageModels=this._onLanguageModelChange.event;this._recentlyUsedModelIds=[];this._onDidChangeModelsControlManifest=this._store.add(new E);this.onDidChangeModelsControlManifest=this._onDidChangeModelsControlManifest.event;this._modelsControlManifest={free:{},paid:{}};this._chatControlDisposed=!1;this._restrictedChatParticipants=to(this,Object.create(null));this.restrictedChatParticipants=this._restrictedChatParticipants;this._hasUserSelectableModels=ki.languageModelsAreUserSelectable.bindTo(o),this._modelPickerUserPreferences=this._readModelPickerPreferences(),this._recentlyUsedModelIds=this._readRecentlyUsedModels(),this._initChatControlData(),this._store.add(this._storageService.onDidChangeValue(0,wA,this._store)(()=>this._onDidChangeModelPickerPreferences())),this._store.add(this.onDidChangeLanguageModels(()=>{this._hasUserSelectableModels.set(this._modelCache.size>0&&Array.from(this._modelCache.values()).some(c=>c.isUserSelectable)),this._refreshModelsControlManifest()})),this._store.add(this._languageModelsConfigurationService.onDidChangeLanguageModelGroups(c=>this._onDidChangeLanguageModelGroups(c))),this._store.add(B3.setHandler((c,{added:u,removed:m})=>{let g=[],h=[];for(let f of u)for(let I of Nt.wrap(f.value)){if(this._vendors.has(I.vendor)){f.collector.error(p(8233,null,I.vendor));continue}if(rs(I.vendor)){f.collector.error(p(8229,null));continue}if(I.vendor.trim()!==I.vendor){f.collector.error(p(8235,null));continue}g.push(I)}for(let f of m)for(let I of Nt.wrap(f.value))h.push(I);this.deltaLanguageModelChatProviderDescriptors(g,h)}))}static{this.SECRET_KEY_PREFIX="chat.lm.secret."}static{this.SECRET_INPUT="${input:{0}}"}deltaLanguageModelChatProviderDescriptors(t,e){let n=[],o=[];for(let i of t){if(this._vendors.has(i.vendor)){this._logService.error(`The vendor '${i.vendor}' is already registered and cannot be registered twice`);continue}if(rs(i.vendor)){this._logService.error("The vendor field cannot be empty.");continue}if(i.vendor.trim()!==i.vendor){this._logService.error("The vendor field cannot start or end with whitespace.");continue}let s={vendor:i.vendor,displayName:i.displayName,configuration:i.configuration,managementCommand:i.managementCommand,when:i.when,isDefault:i.vendor==="copilot"};this._vendors.set(i.vendor,s),n.push(i.vendor),this._hasStoredModelForVendor(i.vendor)&&this._extensionService.activateByEvent(`onLanguageModelChatProvider:${i.vendor}`)}for(let i of e)this._vendors.delete(i.vendor),this._providers.delete(i.vendor),this._clearModelCache(i.vendor),o.push(i.vendor);for(let[i,s]of this._providers)this._vendors.has(i)||this._providers.delete(i);if((n.length>0||o.length>0)&&(this._onDidChangeLanguageModelVendors.fire([...n,...o]),o.length>0))for(let i of o)this._onLanguageModelChange.fire(i)}async _onDidChangeLanguageModelGroups(t){let e=new Set(t.map(n=>n.vendor));await Promise.all(Array.from(e).map(n=>this._resolveAllLanguageModels(n,!0)))}_readModelPickerPreferences(){return this._storageService.getObject(wA,0,{})}_onDidChangeModelPickerPreferences(){let t=this._readModelPickerPreferences(),e=this._modelPickerUserPreferences,n=new Set,o=!1;for(let i in t)if(e[i]!==t[i]){o=!0;let s=this._modelCache.get(i);s&&n.add(s.vendor)}for(let i in e)if(!t.hasOwnProperty(i)){o=!0;let s=this._modelCache.get(i);s&&n.add(s.vendor)}if(o){this._logService.trace("[LM] Updated model picker preferences from storage"),this._modelPickerUserPreferences=t;for(let i of n)this._onLanguageModelChange.fire(i)}}_hasStoredModelForVendor(t){return Object.keys(this._modelPickerUserPreferences).some(e=>e.startsWith(t))}_saveModelPickerPreferences(){this._storageService.store(wA,this._modelPickerUserPreferences,0,0)}updateModelPickerPreference(t,e){let n=this._modelCache.get(t);if(!n){this._logService.warn(`[LM] Cannot update model picker preference for unknown model ${t}`);return}this._modelPickerUserPreferences[t]=e,e===n.isUserSelectable?(delete this._modelPickerUserPreferences[t],this._saveModelPickerPreferences()):n.isUserSelectable!==e&&this._saveModelPickerPreferences(),this._onLanguageModelChange.fire(n.vendor),this._logService.trace(`[LM] Updated model picker preference for ${t} to ${e}`)}getVendors(){return Array.from(this._vendors.values()).filter(t=>{if(!t.when)return!0;let e=Wt.deserialize(t.when);return e?this._contextKeyService.contextMatchesRules(e):!1})}getLanguageModelIds(){return Array.from(this._modelCache.keys())}lookupLanguageModel(t){let e=this._modelCache.get(t);return e&&this._modelPickerUserPreferences[t]!==void 0?{...e,isUserSelectable:this._modelPickerUserPreferences[t]}:e}lookupLanguageModelByQualifiedName(t){for(let[e,n]of this._modelCache.entries())if(RW.matchesQualifiedName(t,n))return{metadata:n,identifier:e}}async _resolveAllLanguageModels(t,e){let n=this._vendors.get(t);if(!n)return;await this._extensionService.activateByEvent(`onLanguageModelChatProvider:${t}`);let o=this._providers.get(t);if(!o){this._logService.warn(`[LM] No provider registered for vendor ${t}`);return}return this._resolveLMSequencer.queue(t,async()=>{let i=[],s=[];try{let u=await o.provideLanguageModelChatInfo({silent:e},ve.None);if(u.length){i.push(...u);let m=[];for(let g of u)n.isDefault?g.metadata.isUserSelectable||this._modelPickerUserPreferences[g.identifier]===!0?m.push(g.identifier):this._logService.trace(`[LM] Skipping model ${g.identifier} from model picker as it is not user selectable.`):m.push(g.identifier);s.push({modelIdentifiers:m})}}catch(u){s.push({modelIdentifiers:[],status:{message:Xi(u),severity:Xe.Error}})}let a=this._languageModelsConfigurationService.getLanguageModelsProviderGroups(),l=new Map;for(let u of a){if(u.vendor!==t)continue;if(n.isDefault&&!n.configuration){if(u.settings)for(let g of i){let h=u.settings[g.metadata.id];h&&l.set(g.identifier,{...h})}s.push({group:u,modelIdentifiers:[]});continue}let m=await this._resolveConfiguration(u,n.configuration);try{let g=await o.provideLanguageModelChatInfo({group:u.name,silent:e,configuration:m},ve.None);if(g.length&&(i.push(...g),s.push({group:u,modelIdentifiers:g.map(h=>h.identifier)})),u.settings)for(let h of g){let f=u.settings[h.metadata.id];f&&l.set(h.identifier,{...f})}}catch(g){s.push({group:u,modelIdentifiers:[],status:{message:Xi(g),severity:Xe.Error}})}}this._modelsGroups.set(t,s);let d=this._clearModelCache(t),c=!1;for(let u of i){if(this._modelCache.has(u.identifier)){this._logService.warn(`[LM] Model ${u.identifier} is already registered. Skipping.`);continue}this._modelCache.set(u.identifier,u.metadata),c=c||!qt(d.get(u.identifier),u.metadata),d.delete(u.identifier)}this._logService.trace(`[LM] Resolved language models for vendor ${t}`,i),c=c||d.size>0,this._clearModelConfigurations(t);for(let[u,m]of l)this._modelCache.has(u)&&this._modelConfigurations.set(u,m);c?this._onLanguageModelChange.fire(t):this._logService.trace(`[LM] No changes in language models for vendor ${t}`)})}getLanguageModelGroups(t){return this._modelsGroups.get(t)??[]}async selectLanguageModels(t){if(t.vendor)await this._resolveAllLanguageModels(t.vendor,!0);else{let n=Array.from(this._vendors.keys());await Promise.all(n.map(o=>this._resolveAllLanguageModels(o,!0)))}let e=[];for(let[n,o]of this._modelCache)(t.vendor===void 0||o.vendor===t.vendor)&&(t.family===void 0||o.family===t.family)&&(t.version===void 0||o.version===t.version)&&(t.id===void 0||o.id===t.id)&&e.push(n);return this._logService.trace("[LM] selected language models",t,e),e}registerLanguageModelProvider(t,e){if(this._logService.trace("[LM] registering language model provider",t,e),!this._vendors.has(t))throw new Error(`Chat model provider uses UNKNOWN vendor ${t}.`);if(this._providers.has(t))throw new Error(`Chat model provider for vendor ${t} is already registered.`);this._providers.set(t,e),this._hasStoredModelForVendor(t)&&this._resolveAllLanguageModels(t,!0);let n=e.onDidChange(()=>{this._resolveAllLanguageModels(t,!0)});return K(()=>{this._logService.trace("[LM] UNregistered language model provider",t),this._clearModelCache(t),this._providers.delete(t),n.dispose()})}async sendChatRequest(t,e,n,o,i){let s=this._modelCache.get(t),a=this._providers.get(s?.vendor||"");if(!a)throw new Error(`Chat provider for model ${t} is not registered.`);let l=this.getModelConfiguration(t),d=l?{...o,configuration:{...l,...o.configuration}}:o;return a.sendChatRequest(t,n,e,d,i)}_resolveModelConfigurationWithDefaults(t,e){let n=this._modelConfigurations.get(t),o=e?.configurationSchema;if(!o?.properties&&!n)return;let i={};if(o?.properties)for(let[s,a]of Object.entries(o.properties))a.default!==void 0&&(i[s]=a.default);if(!(!n&&Object.keys(i).length===0))return{...i,...n}}computeTokenLength(t,e,n){let o=this._modelCache.get(t);if(!o)throw new Error(`Chat model ${t} could not be found.`);let i=this._providers.get(o.vendor);if(!i)throw new Error(`Chat provider for model ${t} is not registered.`);return i.provideTokenCount(t,e,n)}getModelConfiguration(t){let e=this._modelCache.get(t);return this._resolveModelConfigurationWithDefaults(t,e)}async setModelConfiguration(t,e){let n=this._modelCache.get(t);if(!n)return;let o=this._languageModelsConfigurationService.getLanguageModelsProviderGroups(),i;i=o.find(d=>d.vendor===n.vendor&&d.settings?.[n.id]!==void 0),i||(i=o.find(d=>d.vendor===n.vendor));let a={...this._modelConfigurations.get(t)??{},...e},l=n.configurationSchema;if(l?.properties)for(let[d,c]of Object.entries(a)){let u=l.properties[d];u?.default!==void 0&&u.default===c&&delete a[d]}if(i){let d=i.settings??{},c;Object.keys(a).length===0?(c={...d},delete c[n.id]):c={...d,[n.id]:a};let u={...i,settings:Object.keys(c).length>0?c:void 0};!u.settings&&Object.keys(u).filter(m=>m!=="name"&&m!=="vendor"&&m!=="range"&&m!=="settings").length===0?await this._languageModelsConfigurationService.removeLanguageModelsProviderGroup(i):await this._languageModelsConfigurationService.updateLanguageModelsProviderGroup(i,u)}else if(Object.keys(a).length>0){let d=this.getVendors().find(u=>u.vendor===n.vendor);if(!d)return;let c={name:d.displayName,vendor:n.vendor,settings:{[n.id]:a}};await this._languageModelsConfigurationService.addLanguageModelsProviderGroup(c)}Object.keys(a).length>0?this._modelConfigurations.set(t,a):this._modelConfigurations.delete(t),this._onLanguageModelChange.fire(n.vendor)}getModelConfigurationActions(t){let n=this._modelCache.get(t)?.configurationSchema;if(!n?.properties)return[];let o=[],i=this._modelConfigurations.get(t)??{};for(let[s,a]of Object.entries(n.properties)){if(!a.enum||!Array.isArray(a.enum))continue;let l=i[s]??a.default,d=(typeof a.title=="string"?a.title:void 0)??s.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/^./,h=>h.toUpperCase()),c=a.default,u=a.enumItemLabels,m=a.enumDescriptions,g=a.enum.map((h,f)=>{let I=u?.[f]??String(h),S=h===c?p(8220,null,I):I,T=m?.[f]??"";return{id:`configureModel.${s}.${h}`,label:S,class:void 0,enabled:!0,tooltip:T,checked:l===h,run:()=>this.setModelConfiguration(t,{[s]:h})}});o.push(new rv(`configureModel.${s}`,d,g))}return o}async configureLanguageModelsProviderGroup(t,e){let n=this.getVendors().find(({vendor:l})=>l===t);if(!n)throw new Error(`Vendor ${t} not found.`);if(n.managementCommand){await this._resolveAllLanguageModels(n.vendor,!1);return}let o=this._languageModelsConfigurationService.getLanguageModelsProviderGroups(),i=o.find(l=>l.vendor===t&&l.name===e),s=await this.promptForName(o,n,i);if(!s)return;let a=i?await this._resolveConfiguration(i,n.configuration):void 0;try{let l=n.configuration?await this.promptForConfiguration(s,n.configuration,a):void 0;if(n.configuration&&!l)return;let d=await this._resolveLanguageModelProviderGroup(s,t,l,n.configuration),c=i?await this._languageModelsConfigurationService.updateLanguageModelsProviderGroup(i,d):await this._languageModelsConfigurationService.addLanguageModelsProviderGroup(d);if(n.configuration&&this.requireConfiguring(n.configuration)){let u=this.getSnippetForFirstUnconfiguredProperty(l??{},n.configuration);await this._languageModelsConfigurationService.configureLanguageModels({group:c,snippet:u})}}catch(l){if(Qt(l))return;throw l}}async configureModel(t){let e=this._modelCache.get(t);if(!e||!e.configurationSchema)return;let n=this._modelsGroups.get(e.vendor),o;if(n){for(let s of n)if(s.modelIdentifiers.includes(t)&&s.group){o=s.group;break}}if(!o){let s=this.getVendors().find(d=>d.vendor===e.vendor);if(!s)return;let l={name:s.displayName,vendor:e.vendor,settings:{[e.id]:{}}};o=await this._languageModelsConfigurationService.addLanguageModelsProviderGroup(l),await this._resolveAllLanguageModels(e.vendor,!0)}let i=this._getModelConfigurationSnippet(e.id,e.configurationSchema);await this._languageModelsConfigurationService.configureLanguageModels({group:o,snippet:i})}_getModelConfigurationSnippet(t,e){let n=[];if(e.properties)for(let[i,s]of Object.entries(e.properties))if(s.defaultSnippets?.[0]){let a=s.defaultSnippets[0],l=a.bodyText??JSON.stringify(a.body,null,"			");l=l.replace(/"(\^[^"]*)"/g,(d,c)=>c.substring(1)),n.push(`			"${i}": ${l}`)}else s.default!==void 0?n.push(`			"${i}": ${JSON.stringify(s.default)}`):n.push(`			"${i}": \${${i}}`);let o=n.length>0?`{
${n.join(`,
`)}
		}`:`{
			$0
		}`;return`"settings": {
		"${t}": ${o}
	}`}async addLanguageModelsProviderGroup(t,e,n){let o=this.getVendors().find(({vendor:s})=>s===e);if(!o)throw new Error(`Vendor ${e} not found.`);let i=await this._resolveLanguageModelProviderGroup(t,e,n,o.configuration);await this._languageModelsConfigurationService.addLanguageModelsProviderGroup(i)}async removeLanguageModelsProviderGroup(t,e){let n=this.getVendors().find(({vendor:s})=>s===t);if(!n)throw new Error(`Vendor ${t} not found.`);let i=this._languageModelsConfigurationService.getLanguageModelsProviderGroups().find(s=>s.vendor===t&&s.name===e);if(!i)throw new Error(`Language model provider group ${e} for vendor ${t} not found.`);await this._deleteSecretsInConfiguration(i,n.configuration),await this._languageModelsConfigurationService.removeLanguageModelsProviderGroup(i)}requireConfiguring(t){if(t.additionalProperties)return!0;if(!t.properties)return!1;for(let e of Object.keys(t.properties))if(!this.canPromptForProperty(t.properties[e]))return!0;return!1}getSnippetForFirstUnconfiguredProperty(t,e){if(e.properties){for(let n of Object.keys(e.properties))if(t[n]===void 0){let o=e.properties[n];if(o&&typeof o!="boolean"&&o.defaultSnippets?.[0]){let i=o.defaultSnippets[0],s=i.bodyText??JSON.stringify(i.body,null,"	");return s=s.replace(/"(\^[^"]*)"/g,(a,l)=>l.substring(1)),`"${n}": ${s}`}}}}async promptForName(t,e,n){let o=n?.name;if(!o){o=e.displayName;let a=1;for(;t.some(l=>l.vendor===e.vendor&&l.name===o);)a++,o=`${e.displayName} ${a}`}let i,s=new $;try{await new Promise(a=>{let l=s.add(this._quickInputService.createInputBox());l.title=p(8216,null),l.placeholder=p(8219,null),l.value=o,l.ignoreFocusOut=!0,s.add(l.onDidChangeValue(d=>{if(!d){l.validationMessage=p(8217,null),l.severity=Xe.Error;return}if(!n&&t.some(c=>c.name===d)){l.validationMessage=p(8221,null),l.severity=Xe.Error;return}l.validationMessage=void 0,l.severity=Xe.Ignore})),s.add(l.onDidAccept(async()=>{i=l.value,l.hide()})),s.add(l.onDidHide(()=>a())),l.show()})}finally{s.dispose()}return i}async promptForConfiguration(t,e,n){if(!e.properties)return;let o=n?{...n}:{};for(let i of Object.keys(e.properties)){let s=e.properties[i],a=!!e.required?.includes(i),l=await this.promptForValue(t,i,s,a,n);l!==void 0&&(o[i]=l)}return o}async promptForValue(t,e,n,o,i){if(!n||!this.canPromptForProperty(n))return;if(n.type==="array"&&n.items&&!Array.isArray(n.items)&&n.items.enum){let a=await this.promptForArray(t,e,n);return a===void 0?void 0:a}let s=await this.promptForInput(t,e,n,o,i);if(s!==void 0)return s}canPromptForProperty(t){return!t||typeof t=="boolean"?!1:!!(t.type==="array"&&t.items&&!Array.isArray(t.items)&&t.items.enum||t.type==="string"||t.type==="number"||t.type==="integer"||t.type==="boolean")}async promptForArray(t,e,n){if(!n.items||Array.isArray(n.items)||!n.items.enum)return;let o=n.items.enum,i=new $;try{return await new Promise(s=>{let a=i.add(this._quickInputService.createQuickPick());a.title=`${t}: ${n.title??e}`,a.items=o.map(l=>({label:l})),a.placeholder=n.description??p(8223,null,e),a.canSelectMany=!0,a.ignoreFocusOut=!0,i.add(a.onDidAccept(()=>{s(a.selectedItems.map(l=>l.label)),a.hide()})),i.add(a.onDidHide(()=>{s(void 0)})),a.show()})}finally{i.dispose()}}async promptForInput(t,e,n,o,i){let s=new $;try{let a=await new Promise((l,d)=>{let c=s.add(this._quickInputService.createInputBox());c.title=`${t}: ${n.title??e}`,c.placeholder=p(8218,null,e),c.password=!!n.secret,c.ignoreFocusOut=!0,i?.[e]?c.value=String(i?.[e]):n.default&&(c.value=String(n.default)),n.description&&(c.prompt=n.description),s.add(c.onDidChangeValue(u=>{if(!u&&o){c.validationMessage=p(8224,null),c.severity=Xe.Error;return}if((n.type==="number"||n.type==="integer")&&isNaN(Number(u))){c.validationMessage=p(8222,null),c.severity=Xe.Error;return}if(n.type==="boolean"&&u!=="true"&&u!=="false"){c.validationMessage=p(8215,null),c.severity=Xe.Error;return}c.validationMessage=void 0,c.severity=Xe.Ignore})),s.add(c.onDidAccept(()=>{if(!c.value&&o){c.validationMessage=p(8224,null),c.severity=Xe.Error;return}l(c.value),c.hide()})),s.add(c.onDidHide(u=>{u.reason===2?d(new Be):l(void 0)})),c.show()});return a?n.type==="number"||n.type==="integer"?Number(a):n.type==="boolean"?a==="true":a:void 0}finally{s.dispose()}}encodeSecretKey(t){return EU(Dc.SECRET_INPUT,t)}decodeSecretKey(t){if(De(t))return t.substring(t.indexOf(":")+1,t.length-1)}_clearModelCache(t){let e=new Map;for(let[n,o]of this._modelCache.entries())o.vendor===t&&(e.set(n,o),this._modelCache.delete(n));return e}_clearModelConfigurations(t){for(let[e]of this._modelConfigurations)(this._modelCache.get(e)?.vendor===t||e.startsWith(`${t}/`))&&this._modelConfigurations.delete(e)}async _resolveConfiguration(t,e){if(!e)return{};let n={};for(let o in t){if(o==="vendor"||o==="name"||o==="range"||o==="settings")continue;let i=t[o];if(e.properties?.[o]?.secret){let s=this.decodeSecretKey(i);i=s?await this._secretStorageService.get(s):void 0}n[o]=i}return n}async _resolveLanguageModelProviderGroup(t,e,n,o){if(!o)return{name:t,vendor:e};let i={};for(let s in n){let a=n[s];if(o.properties?.[s]?.secret&&De(a)){let l=`${Dc.SECRET_KEY_PREFIX}${Gn(Ae()).toString(16)}`;await this._secretStorageService.set(l,a),a=this.encodeSecretKey(l)}i[s]=a}return{name:t,vendor:e,...i}}async _deleteSecretsInConfiguration(t,e){if(!e)return;let{vendor:n,name:o,range:i,...s}=t;for(let a in s){let l=t[a];if(e.properties?.[a]?.secret){let d=this.decodeSecretKey(l);d&&await this._secretStorageService.delete(d)}}}async migrateLanguageModelsProviderGroup(t){let{vendor:e,name:n,...o}=t;if(!this._vendors.get(e))throw new Error(`Vendor ${e} not found.`);await this._extensionService.activateByEvent(`onLanguageModelChatProvider:${e}`);let i=this._providers.get(e);if(!i)throw new Error(`Chat model provider for vendor ${e} is not registered.`);let s=await i.provideLanguageModelChatInfo({group:n,silent:!1,configuration:o},ve.None);for(let a of s){let l=`${e}/${a.metadata.id}`;this._modelPickerUserPreferences[l]===!0&&(this._modelPickerUserPreferences[a.identifier]=!0),delete this._modelPickerUserPreferences[l]}this._saveModelPickerPreferences(),await this.addLanguageModelsProviderGroup(n,e,o)}_readRecentlyUsedModels(){return this._storageService.getObject(DW,0,[])}_saveRecentlyUsedModels(){this._storageService.store(DW,this._recentlyUsedModelIds,0,0)}getRecentlyUsedModelIds(){return this._recentlyUsedModelIds.filter(t=>this._modelCache.has(t)&&t!=="copilot/auto").slice(0,4)}addToRecentlyUsedList(t){if(t==="copilot/auto")return;let e=this._recentlyUsedModelIds.indexOf(t);e!==-1&&this._recentlyUsedModelIds.splice(e,1),this._recentlyUsedModelIds.unshift(t),this._recentlyUsedModelIds.length>20&&(this._recentlyUsedModelIds.length=20),this._saveRecentlyUsedModels()}clearRecentlyUsedList(){this._recentlyUsedModelIds=[],this._saveRecentlyUsedModels()}getModelsControlManifest(){return this._modelsControlManifest}_setModelsControlManifest(t){this._modelsControlRawResponse=t,this._refreshModelsControlManifest()}_refreshModelsControlManifest(){let t=this._modelsControlRawResponse,e={},n={};if(t?.free){let o=Array.isArray(t.free)?t.free:Object.values(t.free);for(let i of o)!i||!it(i)||(e[i.id]={label:i.label,featured:i.featured,exists:this._modelCache.has(`copilot/${i.id}`)})}if(t?.paid){let o=Array.isArray(t.paid)?t.paid:Object.values(t.paid);for(let i of o)!i||!it(i)||(n[i.id]={label:i.label,featured:i.featured,minVSCodeVersion:i.minVSCodeVersion,exists:this._modelCache.has(`copilot/${i.id}`)})}this._modelsControlManifest={free:e,paid:n},this._onDidChangeModelsControlManifest.fire(this._modelsControlManifest)}_initChatControlData(){if(this._chatControlUrl=this._productService.chatParticipantRegistry,!this._chatControlUrl)return;let t=this._storageService.get(kA,-1);try{this._restrictedChatParticipants.set(JSON.parse(t??"{}"),void 0)}catch{this._storageService.remove(kA,-1)}let e=this._storageService.get(PA,-1);try{let n=JSON.parse(e??"{}");it(n)&&this._setModelsControlManifest(n)}catch{this._storageService.remove(PA,-1)}this._refreshChatControlData()}_refreshChatControlData(){this._chatControlDisposed||this._fetchChatControlData().catch(t=>this._logService.warn("Failed to fetch chat control data",t)).then(()=>Ut(300*1e3)).then(()=>this._refreshChatControlData())}async _fetchChatControlData(){this._logService.trace("[LM] Fetching chat control data from",this._chatControlUrl);let t;try{t=await this._requestService.request({type:"GET",url:this._chatControlUrl,callSite:"languageModels.fetchChatControlData"},ve.None)}catch(o){this._logService.warn("[LM] Failed to request chat control data",Xi(o));return}if(t.res.statusCode!==200){this._logService.warn(`[LM] Chat control data request failed with status ${t.res.statusCode}`);return}let e;try{e=await YH(t)}catch(o){this._logService.warn("[LM] Failed to parse chat control response",Xi(o));return}if(this._logService.trace("[LM] Received chat control response",e?Object.keys(e):"null"),!e||e.version!==1){this._logService.warn("[LM] Unexpected chat control response version",e?.version);return}let n=e.restrictedChatParticipants;this._restrictedChatParticipants.set(n,void 0),this._storageService.store(kA,JSON.stringify(n),-1,1),e.models&&(this._logService.trace("[LM] Updating models control manifest",{freeCount:Object.keys(e.models.free??{}).length,paidCount:Object.keys(e.models.paid??{}).length}),this._setModelsControlManifest(e.models),this._storageService.store(PA,JSON.stringify(e.models),-1,1))}dispose(){this._chatControlDisposed=!0,this._store.dispose(),this._providers.clear()}};Dc=_([C(0,Qx),C(1,oe),C(2,Sr),C(3,Oo),C(4,PW),C(5,XH),C(6,rW),C(7,ms),C(8,Bx)],Dc);var Hxe=new w("debugType",void 0,{type:"string",description:p(9867,null)}),Wxe=new w("debugConfigurationType",void 0,{type:"string",description:p(9858,null)}),Vxe=new w("debugState","inactive",{type:"string",description:p(9866,null)}),z3="debugUx",Bxe=new w(z3,"default",{type:"string",description:p(9868,null)}),$xe=new w("hasDebugged",!1,{type:"boolean",description:p(9876,null)}),zxe=new w("inDebugMode",!1,{type:"boolean",description:p(9878,null)}),qxe=new w("inDebugRepl",!1,{type:"boolean",description:p(9879,null)}),Kxe=new w("breakpointWidgetVisible",!1,{type:"boolean",description:p(9848,null)}),jxe=new w("inBreakpointWidget",!1,{type:"boolean",description:p(9877,null)}),Gxe=new w("breakpointsFocused",!0,{type:"boolean",description:p(9846,null)}),Qxe=new w("watchExpressionsFocused",!0,{type:"boolean",description:p(9904,null)}),Jxe=new w("watchExpressionsExist",!1,{type:"boolean",description:p(9903,null)}),Yxe=new w("variablesFocused",!0,{type:"boolean",description:p(9900,null)}),Xxe=new w("expressionSelected",!1,{type:"boolean",description:p(9872,null)}),Zxe=new w("breakpointInputFocused",!1,{type:"boolean",description:p(9842,null)}),eSe=new w("callStackItemType",void 0,{type:"string",description:p(9854,null)}),tSe=new w("callStackSessionIsAttach",!1,{type:"boolean",description:p(9856,null)}),nSe=new w("callStackItemStopped",!1,{type:"boolean",description:p(9853,null)}),oSe=new w("callStackSessionHasOneThread",!1,{type:"boolean",description:p(9855,null)}),rSe=new w("callStackFocused",!0,{type:"boolean",description:p(9852,null)}),iSe=new w("watchItemType",void 0,{type:"string",description:p(9905,null)}),sSe=new w("canViewMemory",void 0,{type:"boolean",description:p(9857,null)}),aSe=new w("breakpointItemType",void 0,{type:"string",description:p(9844,null)}),lSe=new w("breakpointItemBytes",void 0,{type:"boolean",description:p(9843,null)}),dSe=new w("breakpointHasModes",!1,{type:"boolean",description:p(9841,null)}),cSe=new w("breakpointSupportsCondition",!1,{type:"boolean",description:p(9847,null)}),uSe=new w("loadedScriptsSupported",!1,{type:"boolean",description:p(9884,null)}),pSe=new w("loadedScriptsItemType",void 0,{type:"string",description:p(9883,null)}),mSe=new w("focusedSessionIsAttach",!1,{type:"boolean",description:p(9873,null)}),gSe=new w("focusedSessionIsNoDebug",!1,{type:"boolean",description:p(9874,null)}),fSe=new w("stepBackSupported",!1,{type:"boolean",description:p(9889,null)}),hSe=new w("restartFrameSupported",!1,{type:"boolean",description:p(9887,null)}),vSe=new w("stackFrameSupportsRestart",!1,{type:"boolean",description:p(9888,null)}),bSe=new w("jumpToCursorSupported",!1,{type:"boolean",description:p(9881,null)}),ySe=new w("stepIntoTargetsSupported",!1,{type:"boolean",description:p(9890,null)}),ISe=new w("breakpointsExist",!1,{type:"boolean",description:p(9845,null)}),xSe=new w("debuggersAvailable",!1,{type:"boolean",description:p(9861,null)}),SSe=new w("debugExtensionAvailable",!0,{type:"boolean",description:p(9859,null)}),CSe=new w("debugProtocolVariableMenuContext",void 0,{type:"string",description:p(9862,null)}),TSe=new w("debugSetVariableSupported",!1,{type:"boolean",description:p(9865,null)}),ESe=new w("debugSetDataBreakpointAddressSupported",!1,{type:"boolean",description:p(9863,null)}),wSe=new w("debugSetExpressionSupported",!1,{type:"boolean",description:p(9864,null)}),kSe=new w("breakWhenValueChangesSupported",!1,{type:"boolean",description:p(9849,null)}),PSe=new w("breakWhenValueIsAccessedSupported",!1,{type:"boolean",description:p(9850,null)}),_Se=new w("breakWhenValueIsReadSupported",!1,{type:"boolean",description:p(9851,null)}),DSe=new w("terminateDebuggeeSupported",!1,{type:"boolean",description:p(9892,null)}),RSe=new w("suspendDebuggeeSupported",!1,{type:"boolean",description:p(9891,null)}),ASe=new w("terminateThreadsSupported",!1,{type:"boolean",description:p(9893,null)}),MSe=new w("variableEvaluateNamePresent",!1,{type:"boolean",description:p(9894,null)}),LSe=new w("variableIsReadonly",!1,{type:"boolean",description:p(9897,null)}),OSe=new w("variableValue",!1,{type:"string",description:p(9902,null)}),NSe=new w("variableType",!1,{type:"string",description:p(9901,null)}),USe=new w("variableInterfaces",!1,{type:"array",description:p(9896,null)}),FSe=new w("variableName",!1,{type:"string",description:p(9899,null)}),HSe=new w("variableLanguage",!1,{type:"string",description:p(9898,null)}),WSe=new w("variableExtensionId",!1,{type:"string",description:p(9895,null)}),VSe=new w("exceptionWidgetVisible",!1,{type:"boolean",description:p(9871,null)}),BSe=new w("multiSessionRepl",!1,{type:"boolean",description:p(9886,null)}),$Se=new w("multiSessionDebug",!1,{type:"boolean",description:p(9885,null)}),zSe=new w("disassembleRequestSupported",!1,{type:"boolean",description:p(9869,null)}),qSe=new w("disassemblyViewFocus",!1,{type:"boolean",description:p(9870,null)}),KSe=new w("languageSupportsDisassembleRequest",!1,{type:"boolean",description:p(9882,null)}),jSe=new w("focusedStackFrameHasInstructionReference",!1,{type:"boolean",description:p(9875,null)});var GSe={enum:["neverOpen","openOnSessionStart","openOnFirstSessionStart"],default:"openOnFirstSessionStart",description:p(9880,null)};var _A=(e=>(e[e.Initial=1]="Initial",e[e.Dynamic=2]="Dynamic",e))(_A||{});var QSe=R("debugService");var q3;(e=>(e.deserialize=n=>n,e.serialize=n=>n))(q3||={});var K3;(e=>(e.deserialize=n=>({id:n.id,name:n.name,iconPath:n.iconPath&&{light:b.revive(n.iconPath.light),dark:b.revive(n.iconPath.dark)},iconClass:n.iconClass,visualization:n.visualization}),e.serialize=n=>n))(K3||={});var XSe=R("IMcpGalleryManifestService");var Rv;(l=>(l.LATEST_PROTOCOL_VERSION="2025-11-25",l.JSONRPC_VERSION="2.0",l.PARSE_ERROR=-32700,l.INVALID_REQUEST=-32600,l.METHOD_NOT_FOUND=-32601,l.INVALID_PARAMS=-32602,l.INTERNAL_ERROR=-32603,l.URL_ELICITATION_REQUIRED=-32042))(Rv||={});function AW(r,t){return Ee.toKey(r)+"/"+t}var j3;(t=>{function r(e,n){return e.id===n.id&&e.remoteAuthority===n.remoteAuthority&&e.label===n.label&&e.trustBehavior===n.trustBehavior&&qt(e.sandbox,n.sandbox)}t.equals=r})(j3||={});var G3;(n=>{function r(o){return o}n.toSerialized=r;function t(o){return{id:o.id,label:o.label,cacheNonce:o.cacheNonce,staticMetadata:o.staticMetadata,launch:Rc.fromSerialized(o.launch),sandboxEnabled:o.sandboxEnabled,variableReplacement:o.variableReplacement?MW.fromSerialized(o.variableReplacement):void 0}}n.fromSerialized=t;function e(o,i){return o.id===i.id&&o.label===i.label&&o.cacheNonce===i.cacheNonce&&rn(o.roots,i.roots,(s,a)=>s.toString()===a.toString())&&qt(o.launch,i.launch)&&qt(o.presentation,i.presentation)&&qt(o.variableReplacement,i.variableReplacement)&&qt(o.devMode,i.devMode)&&o.sandboxEnabled===i.sandboxEnabled}n.equals=e})(G3||={});var MW;(e=>{function r(n){return n}e.toSerialized=r;function t(n){return{section:n.section,folder:n.folder?{...n.folder,uri:b.revive(n.folder.uri)}:void 0,target:n.target}}e.fromSerialized=t})(MW||={});var Q3;(t=>t.Empty={working:!1,starting:[],serversRequiringInteraction:[]})(Q3||={});var ICe=R("IMcpService");var J3;(t=>{let r;(s=>(s[s.Trusted=0]="Trusted",s[s.TrustedOnNonce=1]="TrustedOnNonce",s[s.Untrusted=2]="Untrusted",s[s.Unknown=3]="Unknown"))(r=t.Kind||={})})(J3||={});var Rc;(n=>{function r(o){return o}n.toSerialized=r;function t(o){switch(o.type){case 2:return{type:o.type,uri:b.revive(o.uri),headers:o.headers,authentication:o.authentication};case 1:return{type:o.type,cwd:o.cwd,command:o.command,args:o.args,env:o.env,envFile:o.envFile,sandbox:o.sandbox}}}n.fromSerialized=t;async function e(o){let i=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(JSON.stringify(o)));return gl(H.wrap(new Uint8Array(i)))}n.hash=e})(Rc||={});var So;(i=>{let r;(c=>(c[c.Stopped=0]="Stopped",c[c.Starting=1]="Starting",c[c.Running=2]="Running",c[c.Error=3]="Error"))(r=i.Kind||={}),i.toString=s=>{switch(s.state){case 0:return p(12124,null);case 1:return p(12123,null);case 2:return p(12122,null);case 3:return p(12121,null,s.message);default:Yu(s)}},i.toKindString=s=>{switch(s){case 0:return"stopped";case 1:return"starting";case 2:return"running";case 3:return"error";default:Yu(s)}},i.canBeStarted=s=>s===3||s===0,i.isRunning=s=>!(0,i.canBeStarted)(s.state)})(So||={});var Av=class r extends Error{constructor(e){super(`${r.prefix}${e}`);this.reason=e}static{this.prefix="User interaction required: "}static is(e){return e.message.startsWith(this.prefix)}};var Y3=R("IMcpWorkbenchService"),iS=class extends O{constructor(e,n){super();this.containers=e;this._register(n.onChange(this.update,this))}set mcpServer(e){this.containers.forEach(n=>n.mcpServer=e)}update(e){for(let n of this.containers)e&&n.mcpServer?e.id===n.mcpServer.id&&(n.mcpServer=e):n.update()}};iS=_([C(1,Y3)],iS);var xCe=new w("mcpServersGalleryStatus","unavailable"),SCe=new w("hasInstalledMcpServers",!0);var X3;(o=>{o.scheme="mcp-resource";let t="dylo78gyp";function e(i,s){return typeof s=="string"&&(s=b.parse(s)),s.with({scheme:o.scheme,authority:gl(H.fromString(i.id)),path:["",s.scheme,s.authority||t].join("/")+s.path})}o.fromServer=e;function n(i){if(typeof i=="string"&&(i=b.parse(i)),i.scheme!==o.scheme)throw new Error(`Invalid MCP resource URI: ${i.toString()}`);let s=i.path.split("/");if(s.length<3)throw new Error(`Invalid MCP resource URI: ${i.toString()}`);let[,a,l,...d]=s,c=new URL(`${a}://${l.toLowerCase()===t?"":l}`);return c.pathname=d.length?"/"+d.join("/"):"",c.search=i.query,c.hash=i.fragment,{definitionId:kh(i.authority).toString(),resourceURL:c}}o.toServer=n})(X3||={});var CCe=R("IMcpServerSampling");var TCe=R("IMcpElicitationService");function RA(){return Object.create(null)}var ha="**",lS="/",sS="[/\\\\]",aS="[^/\\\\]",Z3=/\//g;function LW(r,t){switch(r){case 0:return"";case 1:return`${aS}*?`;default:return`(?:${sS}|${aS}+${sS}${t?`|${sS}${aS}+`:""})*?`}}function va(r,t){if(!r)return[];let e=[],n=!1,o=!1,i="";for(let s of r){switch(s){case t:if(!n&&!o){e.push(i),i="";continue}break;case"{":n=!0;break;case"}":n=!1;break;case"[":o=!0;break;case"]":o=!1;break}i+=s}return i&&e.push(i),e}function HW(r){if(!r)return"";let t="",e=va(r,lS);if(e.every(n=>n===ha))t=".*";else{let n=!1;e.forEach((o,i)=>{if(o===ha){if(n)return;t+=LW(2,i===e.length-1)}else{let s=!1,a="",l=!1,d="";for(let c of o){if(c!=="}"&&s){a+=c;continue}if(l&&(c!=="]"||!d)){let u;c==="-"?u=c:(c==="^"||c==="!")&&!d?u="^":c===lS?u="":u=pr(c),d+=u;continue}switch(c){case"{":s=!0;continue;case"[":l=!0;continue;case"}":{let m=`(?:${va(a,",").map(g=>HW(g)).join("|")})`;t+=m,s=!1,a="";break}case"]":{t+="["+d+"]",l=!1,d="";break}case"?":t+=aS;continue;case"*":t+=LW(1);continue;default:t+=pr(c)}}i<e.length-1&&(e[i+1]!==ha||i+2<e.length)&&(t+=sS)}n=o===ha})}return t}var e6=/^\*\*\/\*\.[\w\.-]+$/,t6=/^\*\*\/([\w\.-]+)\/?$/,n6=/^{\*\*\/\*?[\w\.-]+\/?(,\*\*\/\*?[\w\.-]+\/?)*}$/,o6=/^{\*\*\/\*?[\w\.-]+(\/(\*\*)?)?(,\*\*\/\*?[\w\.-]+(\/(\*\*)?)?)*}$/,r6=/^\*\*((\/[\w\.-]+)+)\/?$/,i6=/^([\w\.-]+(\/[\w\.-]+)*)\/?$/,OW=new $r(1e4),NW=function(){return!1},hs=function(){return null};function AA(r,t){if(!r)return hs;let e;typeof r!="string"?e=r.pattern:e=r,e=e.trim();let n=t.ignoreCase??!1,o={...t,equals:n?wn:(l,d)=>l===d,endsWith:n?PU:(l,d)=>l.endsWith(d),isEqualOrParent:(l,d)=>_r(l,d,t.ignoreCase??!Qe)},i=`${n?e.toLowerCase():e}_${!!t.trimForExclusions}_${n}`,s=OW.get(i);if(s)return UW(s,r,o);let a;return e6.test(e)?s=s6(e.substring(4),e,o):(a=t6.exec(DA(e,o)))?s=a6(a[1],e,o):(t.trimForExclusions?o6:n6).test(e)?s=l6(e,o):(a=r6.exec(DA(e,o)))?s=FW(a[1].substring(1),e,!0,o):(a=i6.exec(DA(e,o)))?s=FW(a[1],e,!1,o):s=d6(e,o),OW.set(i,s),UW(s,r,o)}function UW(r,t,e){if(typeof t=="string")return r;let n=function(o,i){return e.isEqualOrParent(o,t.base)?r(r_(o.substring(t.base.length),xt),i):null};return n.allBasenames=r.allBasenames,n.allPaths=r.allPaths,n.basenames=r.basenames,n.patterns=r.patterns,n}function DA(r,t){return t.trimForExclusions&&r.endsWith("/**")?r.substring(0,r.length-2):r}function s6(r,t,e){return function(n,o){return typeof n=="string"&&e.endsWith(n,r)?t:null}}function a6(r,t,e){let n=`/${r}`,o=`\\${r}`,i=function(a,l){return typeof a!="string"?null:l?e.equals(l,r)?t:null:e.equals(a,r)||e.endsWith(a,n)||e.endsWith(a,o)?t:null},s=[r];return i.basenames=s,i.patterns=[t],i.allBasenames=s,i}function l6(r,t){let e=VW(r.slice(1,-1).split(",").map(a=>AA(a,t)).filter(a=>a!==hs),r),n=e.length;if(!n)return hs;if(n===1)return e[0];let o=function(a,l){for(let d=0,c=e.length;d<c;d++)if(e[d](a,l))return r;return null},i=e.find(a=>!!a.allBasenames);i&&(o.allBasenames=i.allBasenames);let s=e.reduce((a,l)=>l.allPaths?a.concat(l.allPaths):a,[]);return s.length&&(o.allPaths=s),o}function FW(r,t,e,n){let o=xt===Ge.sep,i=o?r:r.replace(Z3,xt),s=xt+i,a=Ge.sep+r,l;return e?l=function(d,c){return typeof d=="string"&&(n.equals(d,i)||n.endsWith(d,s)||!o&&(n.equals(d,r)||n.endsWith(d,a)))?t:null}:l=function(d,c){return typeof d=="string"&&(n.equals(d,i)||!o&&n.equals(d,r))?t:null},l.allPaths=[(e?"*/":"./")+r],l}function d6(r,t){try{let e=new RegExp(`^${HW(r)}$`,t.ignoreCase?"i":void 0);return function(n){return e.lastIndex=0,typeof n=="string"&&e.test(n)?r:null}}catch{return hs}}function nr(r,t,e){return!r||typeof t!="string"?!1:Co(r,e)(t)}function Co(r,t={}){if(!r)return NW;if(typeof r=="string"||WW(r)){let e=AA(r,t);if(e===hs)return NW;let n=function(o,i){return!!e(o,i)};return e.allBasenames&&(n.allBasenames=e.allBasenames),e.allPaths&&(n.allPaths=e.allPaths),n}return c6(r,t)}function WW(r){let t=r;return t?typeof t.base=="string"&&typeof t.pattern=="string":!1}function MA(r){return r.allBasenames||[]}function LA(r){return r.allPaths||[]}function c6(r,t){let e=VW(Object.getOwnPropertyNames(r).map(a=>u6(a,r[a],t)).filter(a=>a!==hs)),n=e.length;if(!n)return hs;if(!e.some(a=>!!a.requiresSiblings)){if(n===1)return e[0];let a=function(c,u){let m;for(let g=0,h=e.length;g<h;g++){let f=e[g](c,u);if(typeof f=="string")return f;qr(f)&&(m||(m=[]),m.push(f))}return m?(async()=>{for(let g of m){let h=await g;if(typeof h=="string")return h}return null})():null},l=e.find(c=>!!c.allBasenames);l&&(a.allBasenames=l.allBasenames);let d=e.reduce((c,u)=>u.allPaths?c.concat(u.allPaths):c,[]);return d.length&&(a.allPaths=d),a}let o=function(a,l,d){let c,u;for(let m=0,g=e.length;m<g;m++){let h=e[m];h.requiresSiblings&&d&&(l||(l=nt(a)),c||(c=l.substring(0,l.length-al(a).length)));let f=h(a,l,c,d);if(typeof f=="string")return f;qr(f)&&(u||(u=[]),u.push(f))}return u?(async()=>{for(let m of u){let g=await m;if(typeof g=="string")return g}return null})():null},i=e.find(a=>!!a.allBasenames);i&&(o.allBasenames=i.allBasenames);let s=e.reduce((a,l)=>l.allPaths?a.concat(l.allPaths):a,[]);return s.length&&(o.allPaths=s),o}function u6(r,t,e){if(t===!1)return hs;let n=AA(r,e);if(n===hs)return hs;if(typeof t=="boolean")return n;if(t){let o=t.when;if(typeof o=="string"){let i=(s,a,l,d)=>{if(!d||!n(s,a))return null;let c=o.replace("$(basename)",()=>l),u=d(c);return qr(u)?u.then(m=>m?r:null):u?r:null};return i.requiresSiblings=!0,i}}return n}function VW(r,t){let e=r.filter(a=>!!a.basenames);if(e.length<2)return r;let n=e.reduce((a,l)=>{let d=l.basenames;return d?a.concat(d):a},[]),o;if(t){o=[];for(let a=0,l=n.length;a<l;a++)o.push(t)}else o=e.reduce((a,l)=>{let d=l.patterns;return d?a.concat(d):a},[]);let i=function(a,l){if(typeof a!="string")return null;if(!l){let c;for(c=a.length;c>0;c--){let u=a.charCodeAt(c-1);if(u===47||u===92)break}l=a.substring(c)}let d=n.indexOf(l);return d!==-1?o[d]:null};i.basenames=n,i.patterns=o,i.allBasenames=n;let s=r.filter(a=>!a.basenames);return s.push(i),s}function OA(r,t){return rn(r,t,(e,n)=>typeof e=="string"&&typeof n=="string"?e===n:typeof e!="string"&&typeof n!="string"?e.base===n.base&&e.pattern===n.pattern:!1)}var p6=R("notebookDocumentService"),NA=["W","X","Y","Z","a","b","c","d","e","f"],m6=new RegExp(`^[${NA.join("")}]+`),BW=7;function dS(r){if(r.scheme!==V.vscodeNotebookCell)return;let t=r.fragment.indexOf("s");if(t<0)return;let e=parseInt(r.fragment.substring(0,t).replace(m6,""),BW),n=Rr(r.fragment.substring(t+1)).toString();if(!isNaN(e))return{handle:e,notebook:r.with({scheme:n,fragment:null})}}function $W(r,t){let e=t.toString(BW),o=`${e.length<NA.length?NA[e.length-1]:"z"}${e}s${Ao(H.fromString(r.scheme),!0,!0)}`;return r.with({scheme:V.vscodeNotebookCell,fragment:o})}function zW(r){if(r.scheme!==V.vscodeNotebookMetadata)return;let t=Rr(r.fragment).toString();return r.with({scheme:t,fragment:null})}function qW(r){let t=`${Ao(H.fromString(r.scheme),!0,!0)}`;return r.with({scheme:V.vscodeNotebookMetadata,fragment:t})}function FA(r){if(r.scheme!==V.vscodeNotebookCellOutput)return;let t=new URLSearchParams(r.query),e=t.get("openIn");if(!e)return;let n=t.get("outputId")??void 0,o=dS(r.with({scheme:V.vscodeNotebookCell,query:null})),i=t.get("outputIndex")?parseInt(t.get("outputIndex")||"",10):void 0,s=o?o.notebook:r.with({scheme:t.get("notebookScheme")||V.file,fragment:null,query:null}),a=t.get("cellIndex")?parseInt(t.get("cellIndex")||"",10):void 0;return{notebook:s,openIn:e,outputId:n,outputIndex:i,cellHandle:o?.handle,cellFragment:r.fragment,cellIndex:a}}var UA=class{constructor(){this._documents=new Ke}getNotebook(t){if(t.scheme===V.vscodeNotebookCell){let e=dS(t);if(e){let n=this._documents.get(e.notebook);if(n)return n}}if(t.scheme===V.vscodeNotebookCellOutput){let e=FA(t);if(e){let n=this._documents.get(e.notebook);if(n)return n}}return this._documents.get(t)}addNotebookDocument(t){this._documents.set(t.uri,t)}removeNotebookDocument(t){this._documents.delete(t.uri)}};qe(p6,UA,1);var QCe=["application/json","application/javascript","text/html","image/svg+xml",Fo.latex,Fo.markdown,"image/png","image/jpeg",Fo.text],JCe=[Fo.latex,Fo.markdown,"application/json","text/html","image/svg+xml","image/png","image/jpeg",Fo.text];var g6;(n=>{n.scheme=V.vscodeNotebookMetadata;function t(o){return qW(o)}n.generate=t;function e(o){return zW(o)}n.parse=e})(g6||={});var Mv;(d=>{d.scheme=V.vscodeNotebookCell;function t(c,u){return $W(c,u)}d.generate=t;function e(c){return dS(c)}d.parse=e;function n(c,u){return c.with({scheme:V.vscodeNotebookCellOutput,query:new URLSearchParams({openIn:"editor",outputId:u??"",notebookScheme:c.scheme!==V.file?c.scheme:""}).toString()})}d.generateCellOutputUriWithId=n;function o(c,u,m){return c.with({scheme:V.vscodeNotebookCellOutput,fragment:u.fragment,query:new URLSearchParams({openIn:"notebook",outputIndex:String(m)}).toString()})}d.generateCellOutputUriWithIndex=o;function i(c,u,m,g,h){return c.with({scheme:V.vscodeNotebookCellOutput,query:new URLSearchParams({openIn:"notebookOutputEditor",notebook:c.toString(),cellIndex:String(m),outputId:g,outputIndex:String(h)}).toString()})}d.generateOutputEditorUri=i;function s(c){return FA(c)}d.parseCellOutputUri=s;function a(c,u,m){return d.generate(c,u).with({scheme:m})}d.generateCellPropertyUri=a;function l(c,u){if(c.scheme===u)return d.parse(c.with({scheme:d.scheme}))}d.parseCellPropertyUri=l})(Mv||={});var YCe=new w("notebookEditorCursorAtBoundary","none"),XCe=new w("notebookEditorCursorAtLineBoundary","none");var KW=class r{static{this._prefix="notebook/"}static create(t,e){return`${r._prefix}${t}/${e??t}`}static parse(t){if(t.startsWith(r._prefix)){let e=t.substring(r._prefix.length).split("/");if(e.length===2)return{notebookType:e[0],viewType:e[1]}}}},f6=new TextDecoder;function jW(r){let t=[],e=!1;for(let s of r)(t.length===0||e)&&(t.push(s),e=!0);let n=v6(t),o=H.concat(t.map(s=>H.wrap(s))),i=S6(o);return n=n||i.byteLength!==o.byteLength,{data:i,didCompression:n}}var cS="\x1B[A",HA=cS.split("").map(r=>r.charCodeAt(0)),h6=10;function v6(r){let t=!1;return r.forEach((e,n)=>{if(n===0||e.length<cS.length)return;let o=r[n-1],i=e.subarray(0,cS.length);if(i[0]===HA[0]&&i[1]===HA[1]&&i[2]===HA[2]){let s=o.lastIndexOf(h6);if(s===-1)return;t=!0,r[n-1]=o.subarray(0,s),r[n]=e.subarray(cS.length)}}),t}function b6(r){let t=r;do r=t,t=r.replace(/[^\n]\x08/gm,"");while(t.length<r.length);return r}function y6(r){for(r=r.replace(/\r+\n/gm,`
`);r.search(/\r[^$]/g)>-1;){let t=r.match(/^(.*)\r+/m)[1],e=r.match(/\r+(.*)$/m)[1];e=e+t.slice(e.length,t.length),r=r.replace(/\r+.*$/m,"\r").replace(/^.*\r/m,e)}return r}var I6=8,x6=13;function S6(r){return!r.buffer.includes(I6)&&!r.buffer.includes(x6)?r:H.fromString(y6(b6(f6.decode(r.buffer))))}var eTe=R("scm");var tTe=R("scmView");var Ze=class r{constructor(t,e=t.length){this.path=t;this.viewEnd=e;if(t.length===0||e<1)throw new Error("cannot create test with empty path")}static fromExtHostTestItem(t,e,n=t.parent){if(t._isRoot)return new r([e]);let o=[t.id];for(let i=n;i&&i.id!==e;i=i.parent)o.push(i.id);return o.push(e),new r(o.reverse())}static isRoot(t){return!t.includes("\0")}static root(t){let e=t.indexOf("\0");return e===-1?t:t.slice(0,e)}static fromString(t){return new r(t.split("\0"))}static join(t,e){return new r([...t.path,e])}static split(t){return t.split("\0")}static joinToString(t,e){return t.toString()+"\0"+e}static parentId(t){let e=t.lastIndexOf("\0");return e===-1?void 0:t.slice(0,e)}static localId(t){let e=t.lastIndexOf("\0");return e===-1?t:t.slice(e+1)}static isChild(t,e){return e[t.length]==="\0"&&e.startsWith(t)}static compare(t,e){return t===e?0:r.isChild(t,e)?2:r.isChild(e,t)?3:1}static getLengthOfCommonPrefix(t,e){if(t===0)return 0;let n=0;for(;n<t-1;){for(let o=1;o<t;o++){let i=e(o-1),s=e(o);if(i.path[n]!==s.path[n])return n}n++}return n}get rootId(){return new r(this.path,1)}get parentId(){return this.viewEnd>1?new r(this.path,this.viewEnd-1):void 0}get localId(){return this.path[this.viewEnd-1]}get controllerId(){return this.path[0]}get isRoot(){return this.viewEnd===1}*idsFromRoot(){for(let t=1;t<=this.viewEnd;t++)yield new r(this.path,t)}*idsToRoot(){for(let t=this.viewEnd;t>0;t--)yield new r(this.path,t)}compare(t){if(typeof t=="string")return r.compare(this.toString(),t);for(let e=0;e<t.viewEnd&&e<this.viewEnd;e++)if(t.path[e]!==this.path[e])return 1;return t.viewEnd>this.viewEnd?2:t.viewEnd<this.viewEnd?3:0}toJSON(){return this.toString()}toString(){if(!this.stringifed){this.stringifed=this.path[0];for(let t=1;t<this.viewEnd;t++)this.stringifed+="\0",this.stringifed+=this.path[t]}return this.stringifed}};var pTe={2:p(16113,null),4:p(16112,null),8:p(16111,null)};var QW=r=>"runId"in r,Lv;(e=>(e.serialize=n=>({range:n.range.toJSON(),uri:n.uri.toJSON()}),e.deserialize=(n,o)=>({range:We.lift(o.range),uri:n.asCanonicalUri(b.revive(o.uri))})))(Lv||={});var WA;(e=>(e.serialize=n=>({label:n.label,uri:n.uri?.toJSON(),position:n.position?.toJSON()}),e.deserialize=(n,o)=>({label:o.label,uri:o.uri?n.asCanonicalUri(b.revive(o.uri)):void 0,position:o.position?An.lift(o.position):void 0})))(WA||={});var VA;(e=>(e.serialize=n=>({message:n.message,type:0,expected:n.expected,actual:n.actual,contextValue:n.contextValue,location:n.location&&Lv.serialize(n.location),stackTrace:n.stackTrace?.map(WA.serialize)}),e.deserialize=(n,o)=>({message:o.message,type:0,expected:o.expected,actual:o.actual,contextValue:o.contextValue,location:o.location&&Lv.deserialize(n,o.location),stackTrace:o.stackTrace&&o.stackTrace.map(i=>WA.deserialize(n,i))})))(VA||={});var BA;(e=>(e.serialize=n=>({message:n.message,type:1,offset:n.offset,length:n.length,location:n.location&&Lv.serialize(n.location)}),e.deserialize=(n,o)=>({message:o.message,type:1,offset:o.offset,length:o.length,location:o.location&&Lv.deserialize(n,o.location)})))(BA||={});var $A;(n=>(n.serialize=o=>o.type===0?VA.serialize(o):BA.serialize(o),n.deserialize=(o,i)=>i.type===0?VA.deserialize(o,i):BA.deserialize(o,i),n.isDiffable=o=>o.type===0&&o.actual!==void 0&&o.expected!==void 0))($A||={});var uS;(n=>(n.serializeWithoutMessages=o=>({state:o.state,duration:o.duration,messages:[]}),n.serialize=o=>({state:o.state,duration:o.duration,messages:o.messages.map($A.serialize)}),n.deserialize=(o,i)=>({state:i.state,duration:i.duration,messages:i.messages.map(s=>$A.deserialize(o,s))})))(uS||={});var JW="\0",Gp=(r,t)=>r+JW+t,gS=r=>{let t=r.indexOf(JW);return{ctrlId:r.slice(0,t),tagId:r.slice(t+1)}},zA;(e=>(e.serialize=n=>({extId:n.extId,label:n.label,tags:n.tags,busy:n.busy,children:void 0,uri:n.uri?.toJSON(),range:n.range?.toJSON()||null,description:n.description,error:n.error,sortText:n.sortText}),e.deserialize=(n,o)=>({extId:o.extId,label:o.label,tags:o.tags,busy:o.busy,children:void 0,uri:o.uri?n.asCanonicalUri(b.revive(o.uri)):void 0,range:o.range?We.lift(o.range):null,description:o.description,error:o.error,sortText:o.sortText})))(zA||={});var Ac;(e=>(e.serialize=n=>({expand:n.expand,item:zA.serialize(n.item)}),e.deserialize=(n,o)=>({controllerId:Ze.root(o.item.extId),expand:o.expand,item:zA.deserialize(n,o.item)})))(Ac||={});var pS;(e=>(e.serialize=n=>{let o;return n.item&&(o={},n.item.label!==void 0&&(o.label=n.item.label),n.item.tags!==void 0&&(o.tags=n.item.tags),n.item.busy!==void 0&&(o.busy=n.item.busy),n.item.uri!==void 0&&(o.uri=n.item.uri?.toJSON()),n.item.range!==void 0&&(o.range=n.item.range?.toJSON()),n.item.description!==void 0&&(o.description=n.item.description),n.item.error!==void 0&&(o.error=n.item.error),n.item.sortText!==void 0&&(o.sortText=n.item.sortText)),{extId:n.extId,expand:n.expand,item:o}},e.deserialize=n=>{let o;return n.item&&(o={},n.item.label!==void 0&&(o.label=n.item.label),n.item.tags!==void 0&&(o.tags=n.item.tags),n.item.busy!==void 0&&(o.busy=n.item.busy),n.item.range!==void 0&&(o.range=n.item.range?We.lift(n.item.range):null),n.item.description!==void 0&&(o.description=n.item.description),n.item.error!==void 0&&(o.error=n.item.error),n.item.sortText!==void 0&&(o.sortText=n.item.sortText)),{extId:n.extId,expand:n.expand,item:o}}))(pS||={});var fS=(r,t)=>{t.expand!==void 0&&(r.expand=t.expand),t.item!==void 0&&(r.item=r.item?Object.assign(r.item,t.item):t.item)},C6;(n=>(n.serializeWithoutMessages=o=>({...Ac.serialize(o),ownComputedState:o.ownComputedState,computedState:o.computedState,tasks:o.tasks.map(uS.serializeWithoutMessages)}),n.serialize=o=>({...Ac.serialize(o),ownComputedState:o.ownComputedState,computedState:o.computedState,tasks:o.tasks.map(uS.serialize)}),n.deserialize=(o,i)=>({...Ac.deserialize(o,i),ownComputedState:i.ownComputedState,computedState:i.computedState,tasks:i.tasks.map(s=>uS.deserialize(o,s)),retired:!0})))(C6||={});var YW;(e=>(e.empty=()=>({covered:0,total:0}),e.sum=(n,o)=>{n.covered+=o.covered,n.total+=o.total}))(YW||={});var T6;(n=>(n.serialize=o=>({id:o.id,statement:o.statement,branch:o.branch,declaration:o.declaration,testIds:o.testIds,uri:o.uri.toJSON()}),n.deserialize=(o,i)=>({id:i.id,statement:i.statement,branch:i.branch,declaration:i.declaration,testIds:i.testIds,uri:o.asCanonicalUri(b.revive(i.uri))}),n.empty=(o,i)=>({id:o,uri:i,statement:YW.empty()})))(T6||={});function GA(r){return{...r,location:r.location?.toJSON()}}function QA(r){return r.location=r.location?An.isIPosition(r.location)?An.lift(r.location):We.lift(r.location):void 0,r}var E6;(e=>(e.serialize=n=>n.type===0?KA.serialize(n):jA.serialize(n),e.deserialize=n=>n.type===0?KA.deserialize(n):jA.deserialize(n)))(E6||={});var qA;(e=>(e.serialize=GA,e.deserialize=QA))(qA||={});var KA;(e=>(e.serialize=GA,e.deserialize=QA))(KA||={});var jA;(e=>(e.serialize=n=>({...GA(n),branches:n.branches?.map(qA.serialize)}),e.deserialize=n=>({...QA(n),branches:n.branches?.map(qA.deserialize)})))(jA||={});var hS;(e=>(e.deserialize=(n,o)=>o.op===0?{op:o.op,item:Ac.deserialize(n,o.item)}:o.op===1?{op:o.op,item:pS.deserialize(o.item)}:o.op===2?{op:o.op,uri:n.asCanonicalUri(b.revive(o.uri)),docv:o.docv}:o,e.serialize=n=>n.op===0?{op:n.op,item:Ac.serialize(n.item)}:n.op===1?{op:n.op,item:pS.serialize(n.item)}:n))(hS||={});var mS=class{constructor(t){this.uriIdentity=t;this._tags=new Map;this.items=new Map;this.roots=new Set;this.busyControllerCount=0;this.pendingRootCount=0;this.tags=this._tags}apply(t){let e=this.createChangeCollector();for(let n of t)switch(n.op){case 0:this.add(Ac.deserialize(this.uriIdentity,n.item),e);break;case 1:this.update(pS.deserialize(n.item),e);break;case 3:this.remove(n.itemId,e);break;case 5:this.retireTest(n.itemId);break;case 4:this.updatePendingRoots(n.amount);break;case 6:this._tags.set(n.tag.id,n.tag);break;case 7:this._tags.delete(n.id);break}e.complete?.()}add(t,e){let n=Ze.parentId(t.item.extId)?.toString(),o;if(!n)o=this.createItem(t),this.roots.add(o),this.items.set(t.item.extId,o);else if(this.items.has(n)){let i=this.items.get(n);i.children.add(t.item.extId),o=this.createItem(t,i),this.items.set(t.item.extId,o)}else{console.error(`Test with unknown parent ID: ${JSON.stringify(t)}`);return}return e.add?.(o),t.expand===2&&this.busyControllerCount++,o}update(t,e){let n=this.items.get(t.extId);if(n)return t.expand!==void 0&&(n.expand===2&&this.busyControllerCount--,t.expand===2&&this.busyControllerCount++),fS(n,t),e.update?.(n),n}remove(t,e){let n=this.items.get(t);if(!n)return;let o=Ze.parentId(n.item.extId)?.toString();o?this.items.get(o).children.delete(n.item.extId):this.roots.delete(n);let i=[[t]];for(;i.length;)for(let s of i.pop()){let a=this.items.get(s);a&&(i.push(a.children),this.items.delete(s),e.remove?.(a,a!==n),a.expand===2&&this.busyControllerCount--)}}retireTest(t){}updatePendingRoots(t){this.pendingRootCount+=t}createChangeCollector(){return{}}};var fTe=R("IAiSettingsSearchService");var Ov=(r,t)=>r===t,w6={range:(r,t)=>r===t?!0:!r||!t?!1:r.equalsRange(t),busy:Ov,label:Ov,description:Ov,error:Ov,sortText:Ov,tags:(r,t)=>!(r.length!==t.length||r.some(e=>!t.includes(e)))},k6=Object.entries(w6),P6=(r,t)=>{let e;for(let[n,o]of k6)o(r[n],t[n])||(e?e[n]=t[n]:e={[n]:t[n]});return e},vS=class extends O{constructor(e){super();this.options=e;this.debounceSendDiff=this._register(new jn(()=>this.flushDiff(),200));this.diffOpEmitter=this._register(new E);this.tree=new Map;this.tags=new Map;this.diff=[];this.onDidGenerateDiff=this.diffOpEmitter.event;this.root.canResolveChildren=!0,this.upsertItem(this.root,void 0)}get root(){return this.options.root}set resolveHandler(e){this._resolveHandler=e;for(let n of this.tree.values())this.updateExpandability(n)}get resolveHandler(){return this._resolveHandler}collectDiff(){let e=this.diff;return this.diff=[],e}pushDiff(e){switch(e.op){case 2:{for(let n of this.diff)if(n.op===2&&n.uri===e.uri){n.docv=e.docv;return}break}case 1:{let n=this.diff[this.diff.length-1];if(n){if(n.op===1&&n.item.extId===e.item.extId){fS(n.item,e.item);return}if(n.op===0&&n.item.item.extId===e.item.extId){fS(n.item,e.item);return}}break}}this.diff.push(e),this.debounceSendDiff.isScheduled()||this.debounceSendDiff.schedule()}expand(e,n){let o=this.tree.get(e);if(o){if((o.expandLevels===void 0||n>o.expandLevels)&&(o.expandLevels=n),o.expand===1){let i=this.resolveChildren(o);return i.isOpen()?this.expandChildren(o,n-1):i.wait().then(()=>this.expandChildren(o,n-1))}else if(o.expand===3)return o.resolveBarrier?.isOpen()===!1?o.resolveBarrier.wait().then(()=>this.expandChildren(o,n-1)):this.expandChildren(o,n-1)}}dispose(){for(let e of this.tree.values())this.options.getApiFor(e.actual).listener=void 0;this.tree.clear(),this.diff=[],super.dispose()}onTestItemEvent(e,n){switch(n.op){case 3:this.removeItem(Ze.joinToString(e.fullId,n.id));break;case 0:this.upsertItem(n.item,e);break;case 5:for(let o of n.ops)this.onTestItemEvent(e,o);break;case 1:this.diffTagRefs(n.new,n.old,e.fullId.toString());break;case 2:this.updateExpandability(e);break;case 4:this.pushDiff({op:1,item:{extId:e.fullId.toString(),item:n.update}});break;case 6:this.documentSynced(e.actual.uri);break;default:Yu(n)}}documentSynced(e){e&&this.pushDiff({op:2,uri:e,docv:this.options.getDocumentVersion(e)})}upsertItem(e,n){let o=Ze.fromExtHostTestItem(e,this.root.id,n?.actual),i=this.options.getApiFor(e);i.parent&&i.parent!==n?.actual&&this.options.getChildren(i.parent).delete(e.id);let s=this.tree.get(o.toString());if(!s){s={fullId:o,actual:e,expandLevels:n?.expandLevels?n.expandLevels-1:void 0,expand:0},e.tags.forEach(this.incrementTagRefs,this),this.tree.set(s.fullId.toString(),s),this.setItemParent(e,n),this.pushDiff({op:0,item:{controllerId:this.options.controllerId,expand:s.expand,item:this.options.toITestItem(e)}}),this.connectItemAndChildren(e,s,n);return}if(s.actual===e){this.connectItem(e,s,n);return}if(s.actual.uri?.toString()!==e.uri?.toString())return this.removeItem(o.toString()),this.upsertItem(e,n);let a=this.options.getChildren(s.actual),l=s.actual,d=P6(this.options.toITestItem(l),this.options.toITestItem(e));this.options.getApiFor(l).listener=void 0,s.actual=e,s.resolveBarrier=void 0,s.expand=0,d&&(d.hasOwnProperty("tags")&&(this.diffTagRefs(e.tags,l.tags,o.toString()),delete d.tags),this.onTestItemEvent(s,{op:4,update:d})),this.connectItemAndChildren(e,s,n);for(let[u,m]of a)this.options.getChildren(e).get(m.id)||this.removeItem(Ze.joinToString(o,m.id));let c=s.expandLevels;c!==void 0&&queueMicrotask(()=>{s.expand===1&&(s.expandLevels=void 0,this.expand(o.toString(),c))}),this.documentSynced(s.actual.uri)}diffTagRefs(e,n,o){let i=new Set(n.map(s=>s.id));for(let s of e)i.delete(s.id)||this.incrementTagRefs(s);this.pushDiff({op:1,item:{extId:o,item:{tags:e.map(s=>Gp(this.options.controllerId,s.id))}}}),i.forEach(this.decrementTagRefs,this)}incrementTagRefs(e){let n=this.tags.get(e.id);n?n.refCount++:(this.tags.set(e.id,{refCount:1}),this.pushDiff({op:6,tag:{id:Gp(this.options.controllerId,e.id)}}))}decrementTagRefs(e){let n=this.tags.get(e);n&&!--n.refCount&&(this.tags.delete(e),this.pushDiff({op:7,id:Gp(this.options.controllerId,e)}))}setItemParent(e,n){this.options.getApiFor(e).parent=n&&n.actual!==this.root?n.actual:void 0}connectItem(e,n,o){this.setItemParent(e,o);let i=this.options.getApiFor(e);i.parent=o?.actual,i.listener=s=>this.onTestItemEvent(n,s),this.updateExpandability(n)}connectItemAndChildren(e,n,o){this.connectItem(e,n,o);for(let[i,s]of this.options.getChildren(e))this.upsertItem(s,n)}updateExpandability(e){let n;this._resolveHandler?e.resolveBarrier?n=e.resolveBarrier.isOpen()?3:2:n=e.actual.canResolveChildren?1:0:n=0,n!==e.expand&&(e.expand=n,this.pushDiff({op:1,item:{extId:e.fullId.toString(),expand:n}}),n===1&&e.expandLevels!==void 0&&this.resolveChildren(e))}expandChildren(e,n){if(n<0)return;let o=[];for(let[i,s]of this.options.getChildren(e.actual)){let a=this.expand(Ze.joinToString(e.fullId,s.id),n);qr(a)&&o.push(a)}if(o.length)return Promise.all(o).then(()=>{})}resolveChildren(e){if(e.resolveBarrier)return e.resolveBarrier;if(!this._resolveHandler){let s=new In;return s.open(),s}e.expand=2,this.pushExpandStateUpdate(e);let n=e.resolveBarrier=new In,o=s=>{console.error(`Unhandled error in resolveHandler of test controller "${this.options.controllerId}"`,s)},i;try{i=this._resolveHandler(e.actual===this.root?void 0:e.actual)}catch(s){o(s)}return qr(i)?i.catch(o).then(()=>{n.open(),this.updateExpandability(e)}):(n.open(),this.updateExpandability(e)),e.resolveBarrier}pushExpandStateUpdate(e){this.pushDiff({op:1,item:{extId:e.fullId.toString(),expand:e.expand}})}removeItem(e){let n=this.tree.get(e);if(!n)throw new Error("attempting to remove non-existent child");this.pushDiff({op:3,itemId:e});let o=[n];for(;o.length;){let i=o.pop();if(i){this.options.getApiFor(i.actual).listener=void 0;for(let s of i.actual.tags)this.decrementTagRefs(s.id);this.tree.delete(i.fullId.toString());for(let[s,a]of this.options.getChildren(i.actual))o.push(this.tree.get(Ze.joinToString(i.fullId,a.id)))}}}flushDiff(){let e=this.collectDiff();e.length&&this.diffOpEmitter.fire(e)}},JA=class extends Error{constructor(t){super(`Attempted to insert a duplicate test item ID ${t}`)}},Ml=class extends Error{constructor(t){super(`TestItem with ID "${t}" is invalid. Make sure to create it from the createTestItem method.`)}},YA=class extends Error{constructor(t,e,n){super(`TestItem with ID "${t}" is from controller "${e}" and cannot be added as a child of an item from controller "${n}".`)}},XW=(r,t,e)=>{let n=new Map;return{get size(){return n.size},forEach(o,i){for(let s of n.values())o.call(i,s,this)},[Symbol.iterator](){return n.entries()},replace(o){let i=new Map,s=new Set(n.keys()),a={op:5,ops:[]};for(let l of o){if(!(l instanceof e))throw new Ml(l.id);let d=t(l).controllerId;if(d!==r.controllerId)throw new YA(l.id,d,r.controllerId);if(i.has(l.id))throw new JA(l.id);i.set(l.id,l),s.delete(l.id),a.ops.push({op:0,item:l})}for(let l of s.keys())a.ops.push({op:3,id:l});r.listener?.(a),n=i},add(o){if(!(o instanceof e))throw new Ml(o.id);n.set(o.id,o),r.listener?.({op:0,item:o})},delete(o){n.delete(o)&&r.listener?.({op:3,id:o})},get(o){return n.get(o)},toJSON(){return Array.from(n.values())}}};var ZW=new WeakMap,e4=(r,t)=>{let e={controllerId:t};return ZW.set(r,e),e},Qp=r=>{let t=ZW.get(r);if(!t)throw new Ml(r?.id||"<unknown>");return t};var t4=R("remoteAuthorityResolverService");var Jp=class{constructor(t){this.id=t;this.type=1}toString(){return`Managed(${this.id})`}},bS=class{constructor(t,e){this.host=t;this.port=e;this.type=0}toString(){return`WebSocket(${this.host}:${this.port})`}};var Yp=class r extends ho{static isNotAvailable(t){return t instanceof r&&t._code==="NotAvailable"}static isTemporarilyNotAvailable(t){return t instanceof r&&t._code==="TemporarilyNotAvailable"}static isNoResolverFound(t){return t instanceof r&&t._code==="NoResolverFound"}static isInvalidAuthority(t){return t instanceof r&&t._code==="InvalidAuthority"}static isHandled(t){return t instanceof r&&t.isHandled}constructor(t,e="Unknown",n){super(t),this._message=t,this._code=e,this._detail=n,this.isHandled=e==="NotAvailable"&&n===!0,Object.setPrototypeOf(this,r.prototype)}};function XA(r){let t=r.indexOf("+");return t===-1?r:r.substring(0,t)}function me(r){return Object.assign(r,{apply:function(...e){if(e.length===0)return Reflect.construct(r,[]);{let n=e.length===1?[]:e[1];return Reflect.construct(r,n,e[0].constructor)}},call:function(...e){if(e.length===0)return Reflect.construct(r,[]);{let[n,...o]=e;return Reflect.construct(r,o,n.constructor)}}})}var no,Zt=class{constructor(t,e=!1){Ku(this,no);oh(this,no,new Bt(t,{supportThemeIcons:e}))}static isMarkdownString(t){return t instanceof Zt?!0:!t||typeof t!="object"?!1:t.appendCodeblock&&t.appendMarkdown&&t.appendText&&t.value!==void 0}get value(){return gn(this,no).value}set value(t){gn(this,no).value=t}get isTrusted(){return gn(this,no).isTrusted}set isTrusted(t){gn(this,no).isTrusted=t}get supportThemeIcons(){return gn(this,no).supportThemeIcons}set supportThemeIcons(t){gn(this,no).supportThemeIcons=t}get supportHtml(){return gn(this,no).supportHtml}set supportHtml(t){gn(this,no).supportHtml=t}get supportAlertSyntax(){return gn(this,no).supportAlertSyntax}set supportAlertSyntax(t){gn(this,no).supportAlertSyntax=t}get baseUri(){return gn(this,no).baseUri}set baseUri(t){gn(this,no).baseUri=t}appendText(t){return gn(this,no).appendText(t),this}appendMarkdown(t){return gn(this,no).appendMarkdown(t),this}appendCodeblock(t,e){return gn(this,no).appendCodeblock(e??"",t),this}};no=new WeakMap,Zt=_([me],Zt);var we=class{static Min(...t){if(t.length===0)throw new TypeError;let e=t[0];for(let n=1;n<t.length;n++){let o=t[n];o.isBefore(e)&&(e=o)}return e}static Max(...t){if(t.length===0)throw new TypeError;let e=t[0];for(let n=1;n<t.length;n++){let o=t[n];o.isAfter(e)&&(e=o)}return e}static isPosition(t){if(!t)return!1;if(t instanceof we)return!0;let{line:e,character:n}=t;return typeof e=="number"&&typeof n=="number"}static of(t){if(t instanceof we)return t;if(this.isPosition(t))return new we(t.line,t.character);throw new Error("Invalid argument, is NOT a position-like object")}get line(){return this._line}get character(){return this._character}constructor(t,e){if(t<0)throw Fe("line must be non-negative");if(e<0)throw Fe("character must be non-negative");this._line=t,this._character=e}isBefore(t){return this._line<t._line?!0:t._line<this._line?!1:this._character<t._character}isBeforeOrEqual(t){return this._line<t._line?!0:t._line<this._line?!1:this._character<=t._character}isAfter(t){return!this.isBeforeOrEqual(t)}isAfterOrEqual(t){return!this.isBefore(t)}isEqual(t){return this._line===t._line&&this._character===t._character}compareTo(t){return this._line<t._line?-1:this._line>t.line?1:this._character<t._character?-1:this._character>t._character?1:0}translate(t,e=0){if(t===null||e===null)throw Fe();let n;return typeof t>"u"?n=0:typeof t=="number"?n=t:(n=typeof t.lineDelta=="number"?t.lineDelta:0,e=typeof t.characterDelta=="number"?t.characterDelta:0),n===0&&e===0?this:new we(this.line+n,this.character+e)}with(t,e=this.character){if(t===null||e===null)throw Fe();let n;return typeof t>"u"?n=this.line:typeof t=="number"?n=t:(n=typeof t.line=="number"?t.line:this.line,e=typeof t.character=="number"?t.character:this.character),n===this.line&&e===this.character?this:new we(n,e)}toJSON(){return{line:this.line,character:this.character}}[Symbol.for("debug.description")](){return`(${this.line}:${this.character})`}};we=_([me],we);var fe=class{static isRange(t){return t instanceof fe?!0:!t||typeof t!="object"?!1:we.isPosition(t.start)&&we.isPosition(t.end)}static of(t){if(t instanceof fe)return t;if(this.isRange(t))return new fe(t.start,t.end);throw new Error("Invalid argument, is NOT a range-like object")}get start(){return this._start}get end(){return this._end}constructor(t,e,n,o){let i,s;if(typeof t=="number"&&typeof e=="number"&&typeof n=="number"&&typeof o=="number"?(i=new we(t,e),s=new we(n,o)):we.isPosition(t)&&we.isPosition(e)&&(i=we.of(t),s=we.of(e)),!i||!s)throw new Error("Invalid arguments");i.isBefore(s)?(this._start=i,this._end=s):(this._start=s,this._end=i)}contains(t){return fe.isRange(t)?this.contains(t.start)&&this.contains(t.end):we.isPosition(t)?!(we.of(t).isBefore(this._start)||this._end.isBefore(t)):!1}isEqual(t){return this._start.isEqual(t._start)&&this._end.isEqual(t._end)}intersection(t){let e=we.Max(t.start,this._start),n=we.Min(t.end,this._end);if(!e.isAfter(n))return new fe(e,n)}union(t){if(this.contains(t))return this;if(t.contains(this))return t;let e=we.Min(t.start,this._start),n=we.Max(t.end,this.end);return new fe(e,n)}get isEmpty(){return this._start.isEqual(this._end)}get isSingleLine(){return this._start.line===this._end.line}with(t,e=this.end){if(t===null||e===null)throw Fe();let n;return t?we.isPosition(t)?n=t:(n=t.start||this.start,e=t.end||this.end):n=this.start,n.isEqual(this._start)&&e.isEqual(this.end)?this:new fe(n,e)}toJSON(){return[this.start,this.end]}[Symbol.for("debug.description")](){return ZA(this)}};fe=_([me],fe);function ZA(r){return r.isEmpty?`[${r.start.line}:${r.start.character})`:`[${r.start.line}:${r.start.character} -> ${r.end.line}:${r.end.character})`}var St=class{constructor(t){this.value=t}append(t){return new St(this.value?this.value+St.sep+t:t)}intersects(t){return this.contains(t)||t.contains(this)}contains(t){return this.value===t.value||t.value.startsWith(this.value+St.sep)}};St.sep=".",St=_([me],St);St.Empty=new St("");St.QuickFix=St.Empty.append("quickfix");St.Refactor=St.Empty.append("refactor");St.RefactorExtract=St.Refactor.append("extract");St.RefactorInline=St.Refactor.append("inline");St.RefactorMove=St.Refactor.append("move");St.RefactorRewrite=St.Refactor.append("rewrite");St.Source=St.Empty.append("source");St.SourceOrganizeImports=St.Source.append("organizeImports");St.SourceFixAll=St.Source.append("fixAll");St.Notebook=St.Empty.append("notebook");var Nv=(e=>(e[e.Unnecessary=1]="Unnecessary",e[e.Deprecated=2]="Deprecated",e))(Nv||{}),Mc=(o=>(o[o.Hint=3]="Hint",o[o.Information=2]="Information",o[o.Warning=1]="Warning",o[o.Error=0]="Error",o))(Mc||{}),vs=class{static is(t){return t?typeof t.message=="string"&&t.location&&fe.isRange(t.location.range)&&b.isUri(t.location.uri):!1}constructor(t,e){this.location=t,this.message=e}static isEqual(t,e){return t===e?!0:!t||!e?!1:t.message===e.message&&t.location.range.isEqual(e.location.range)&&t.location.uri.toString()===e.location.uri.toString()}};vs=_([me],vs);var ba=class{constructor(t,e,n=0){if(!fe.isRange(t))throw new TypeError("range must be set");if(!e)throw new TypeError("message must be set");this.range=t,this.message=e,this.severity=n}toJSON(){return{severity:Mc[this.severity],message:this.message,range:this.range,source:this.source,code:this.code}}static isEqual(t,e){return t===e?!0:!t||!e?!1:t.message===e.message&&t.severity===e.severity&&t.code===e.code&&t.severity===e.severity&&t.source===e.source&&t.range.isEqual(e.range)&&rn(t.tags,e.tags)&&rn(t.relatedInformation,e.relatedInformation,vs.isEqual)}};ba=_([me],ba);var en=class{static isLocation(t){return t instanceof en?!0:t?fe.isRange(t.range)&&b.isUri(t.uri):!1}constructor(t,e){if(this.uri=t,e)if(fe.isRange(e))this.range=fe.of(e);else if(we.isPosition(e))this.range=new fe(e,e);else throw new Error("Illegal argument")}toJSON(){return{uri:this.uri,range:this.range}}};en=_([me],en);var Uv=(e=>(e[e.Markup=1]="Markup",e[e.Code=2]="Code",e))(Uv||{}),oo=class r{static isNotebookRange(t){return t instanceof r?!0:t?typeof t.start=="number"&&typeof t.end=="number":!1}get start(){return this._start}get end(){return this._end}get isEmpty(){return this._start===this._end}constructor(t,e){if(t<0)throw Fe("start must be positive");if(e<0)throw Fe("end must be positive");t<=e?(this._start=t,this._end=e):(this._start=e,this._end=t)}with(t){let e=this._start,n=this._end;return t.start!==void 0&&(e=t.start),t.end!==void 0&&(n=t.end),e===this._start&&n===this._end?this:new r(e,n)}},bs=class r{static validate(t){if(typeof t.kind!="number")throw new Error("NotebookCellData MUST have 'kind' property");if(typeof t.value!="string")throw new Error("NotebookCellData MUST have 'value' property");if(typeof t.languageId!="string")throw new Error("NotebookCellData MUST have 'languageId' property")}static isNotebookCellDataArray(t){return Array.isArray(t)&&t.every(e=>r.isNotebookCellData(e))}static isNotebookCellData(t){return!0}constructor(t,e,n,o,i,s,a){this.kind=t,this.value=e,this.languageId=n,this.mime=o,this.outputs=i??[],this.metadata=s,this.executionSummary=a,r.validate(this)}},Lc=class{constructor(t){this.cells=t}},Bo=class{static isNotebookCellEdit(t){return t instanceof Bo?!0:t?oo.isNotebookRange(t)&&Array.isArray(t.newCells):!1}static replaceCells(t,e){return new Bo(t,e)}static insertCells(t,e){return new Bo(new oo(t,t),e)}static deleteCells(t){return new Bo(t,[])}static updateCellMetadata(t,e){let n=new Bo(new oo(t,t),[]);return n.newCellMetadata=e,n}static updateNotebookMetadata(t){let e=new Bo(new oo(0,0),[]);return e.newNotebookMetadata=t,e}constructor(t,e){this.range=t,this.newCells=e}};Bo=_([me],Bo);var Oc=class r{constructor(t,e){this.data=t;this.mime=e;let n=DR(e,!0);if(!n)throw new Error(`INVALID mime type: ${e}. Must be in the format "type/subtype[;optionalparameter]"`);this.mime=n}static isNotebookCellOutputItem(t){return t instanceof r?!0:t?typeof t.mime=="string"&&t.data instanceof Uint8Array:!1}static error(t){let e={name:t.name,message:t.message,stack:t.stack};return r.json(e,"application/vnd.code.notebook.error")}static stdout(t){return r.text(t,"application/vnd.code.notebook.stdout")}static stderr(t){return r.text(t,"application/vnd.code.notebook.stderr")}static bytes(t,e="application/octet-stream"){return new r(t,e)}static#e=new TextEncoder;static text(t,e=Fo.text){let n=r.#e.encode(String(t));return new r(n,e)}static json(t,e="text/x-json"){let n=JSON.stringify(t,void 0,"	");return r.text(n,e)}},ys=class r{static isNotebookCellOutput(t){return t instanceof r?!0:!t||typeof t!="object"?!1:typeof t.id=="string"&&Array.isArray(t.items)}static ensureUniqueMimeTypes(t,e=!1){let n=new Set,o=new Set;for(let i=0;i<t.length;i++){let s=t[i],a=DR(s.mime);if(!n.has(a)||fx(a)){n.add(a);continue}o.add(i),e&&console.warn(`DUPLICATED mime type '${s.mime}' will be dropped`)}return o.size===0?t:t.filter((i,s)=>!o.has(s))}constructor(t,e,n){this.items=r.ensureUniqueMimeTypes(t,!0),typeof e=="string"?(this.id=e,this.metadata=n):(this.id=Ae(),this.metadata=e??n)}};var Jn=class extends fe{static isSelection(t){return t instanceof Jn?!0:!t||typeof t!="object"?!1:fe.isRange(t)&&we.isPosition(t.anchor)&&we.isPosition(t.active)&&typeof t.isReversed=="boolean"}get anchor(){return this._anchor}get active(){return this._active}constructor(t,e,n,o){let i,s;if(typeof t=="number"&&typeof e=="number"&&typeof n=="number"&&typeof o=="number"?(i=new we(t,e),s=new we(n,o)):we.isPosition(t)&&we.isPosition(e)&&(i=we.of(t),s=we.of(e)),!i||!s)throw new Error("Invalid arguments");super(i,s),this._anchor=i,this._active=s}get isReversed(){return this._anchor===this._end}toJSON(){return{start:this.start,end:this.end,active:this.active,anchor:this.anchor}}[Symbol.for("debug.description")](){return _6(this)}};Jn=_([me],Jn);function _6(r){let t=ZA(r);return r.isEmpty||(r.active.isEqual(r.start)?t=`|${t}`:t=`${t}|`),t}var Yn=class{constructor(t){this._tabstop=1;this.value=t||""}static isSnippetString(t){return t instanceof Yn?!0:!t||typeof t!="object"?!1:typeof t.value=="string"}static _escape(t){return t.replace(/\$|}|\\/g,"\\$&")}appendText(t){return this.value+=Yn._escape(t),this}appendTabstop(t=this._tabstop++){return this.value+="$",this.value+=t,this}appendPlaceholder(t,e=this._tabstop++){if(typeof t=="function"){let n=new Yn;n._tabstop=this._tabstop,t(n),this._tabstop=n._tabstop,t=n.value}else t=Yn._escape(t);return this.value+="${",this.value+=e,this.value+=":",this.value+=t,this.value+="}",this}appendChoice(t,e=this._tabstop++){let n=t.map(o=>o.replaceAll(/[|\\,]/g,"\\$&")).join(",");return this.value+="${",this.value+=e,this.value+="|",this.value+=n,this.value+="|}",this}appendVariable(t,e){if(typeof e=="function"){let n=new Yn;n._tabstop=this._tabstop,e(n),this._tabstop=n._tabstop,e=n.value}else typeof e=="string"&&(e=e.replace(/\$|}/g,"\\$&"));return this.value+="${",this.value+=t,e&&(this.value+=":",this.value+=e),this.value+="}",this}};Yn=_([me],Yn);var ya=class r{static isSnippetTextEdit(t){return t instanceof r?!0:t?fe.isRange(t.range)&&Yn.isSnippetString(t.snippet):!1}static replace(t,e){return new r(t,e)}static insert(t,e){return r.replace(new fe(t,t),e)}constructor(t,e){this.range=t,this.snippet=e}};var Xp=(Y=>(Y[Y.File=0]="File",Y[Y.Module=1]="Module",Y[Y.Namespace=2]="Namespace",Y[Y.Package=3]="Package",Y[Y.Class=4]="Class",Y[Y.Method=5]="Method",Y[Y.Property=6]="Property",Y[Y.Field=7]="Field",Y[Y.Constructor=8]="Constructor",Y[Y.Enum=9]="Enum",Y[Y.Interface=10]="Interface",Y[Y.Function=11]="Function",Y[Y.Variable=12]="Variable",Y[Y.Constant=13]="Constant",Y[Y.String=14]="String",Y[Y.Number=15]="Number",Y[Y.Boolean=16]="Boolean",Y[Y.Array=17]="Array",Y[Y.Object=18]="Object",Y[Y.Key=19]="Key",Y[Y.Null=20]="Null",Y[Y.EnumMember=21]="EnumMember",Y[Y.Struct=22]="Struct",Y[Y.Event=23]="Event",Y[Y.Operator=24]="Operator",Y[Y.TypeParameter=25]="TypeParameter",Y))(Xp||{}),Fv=(t=>(t[t.Deprecated=1]="Deprecated",t))(Fv||{}),Or=class{static validate(t){if(!t.name)throw new Error("name must not be falsy")}constructor(t,e,n,o,i){this.name=t,this.kind=e,this.containerName=i,typeof n=="string"&&(this.containerName=n),o instanceof en?this.location=o:n instanceof fe&&(this.location=new en(o,n)),Or.validate(this)}toJSON(){return{name:this.name,kind:Xp[this.kind],location:this.location,containerName:this.containerName}}};Or=_([me],Or);var Nc=(e=>(e[e.LF=1]="LF",e[e.CRLF=2]="CRLF",e))(Nc||{}),Wn=class{static isTextEdit(t){return t instanceof Wn?!0:!t||typeof t!="object"?!1:fe.isRange(t)&&typeof t.newText=="string"}static replace(t,e){return new Wn(t,e)}static insert(t,e){return Wn.replace(new fe(t,t),e)}static delete(t){return Wn.replace(t,"")}static setEndOfLine(t){let e=new Wn(new fe(new we(0,0),new we(0,0)),"");return e.newEol=t,e}get range(){return this._range}set range(t){if(t&&!fe.isRange(t))throw Fe("range");this._range=t}get newText(){return this._newText||""}set newText(t){if(t&&typeof t!="string")throw Fe("newText");this._newText=t}get newEol(){return this._newEol}set newEol(t){if(t&&typeof t!="number")throw Fe("newEol");this._newEol=t}constructor(t,e){this._range=t,this._newText=e}toJSON(){return{range:this.range,newText:this.newText,newEol:this._newEol}}};Wn=_([me],Wn);var Cr=class{constructor(){this._edits=[]}_allEntries(){return this._edits}renameFile(t,e,n,o){this._edits.push({_type:1,from:t,to:e,options:n,metadata:o})}createFile(t,e,n){this._edits.push({_type:1,from:void 0,to:t,options:e,metadata:n})}deleteFile(t,e,n){this._edits.push({_type:1,from:t,to:void 0,options:e,metadata:n})}replaceNotebookMetadata(t,e,n){this._edits.push({_type:3,metadata:n,uri:t,edit:{editType:5,metadata:e}})}replaceNotebookCells(t,e,n,o){let i=e.start,s=e.end;(i!==s||n.length>0)&&this._edits.push({_type:5,uri:t,index:i,count:s-i,cells:n,metadata:o})}replaceNotebookCellMetadata(t,e,n,o){this._edits.push({_type:3,metadata:o,uri:t,edit:{editType:3,index:e,metadata:n}})}replace(t,e,n,o){this._edits.push({_type:2,uri:t,edit:new Wn(e,n),metadata:o})}insert(t,e,n,o){this.replace(t,new fe(e,e),n,o)}delete(t,e,n){this.replace(t,e,"",n)}has(t){return this._edits.some(e=>e._type===2&&e.uri.toString()===t.toString())}set(t,e){if(e)for(let n of e){if(!n)continue;let o,i;Array.isArray(n)?(o=n[0],i=n[1]):o=n,Bo.isNotebookCellEdit(o)?o.newCellMetadata?this.replaceNotebookCellMetadata(t,o.range.start,o.newCellMetadata,i):o.newNotebookMetadata?this.replaceNotebookMetadata(t,o.newNotebookMetadata,i):this.replaceNotebookCells(t,o.range,o.newCells,i):ya.isSnippetTextEdit(o)?this._edits.push({_type:6,uri:t,range:o.range,edit:o.snippet,metadata:i,keepWhitespace:o.keepWhitespace}):this._edits.push({_type:2,uri:t,edit:o,metadata:i})}else{for(let n=0;n<this._edits.length;n++){let o=this._edits[n];switch(o._type){case 2:case 6:case 3:case 5:o.uri.toString()===t.toString()&&(this._edits[n]=void 0);break}}WN(this._edits)}}get(t){let e=[];for(let n of this._edits)n._type===2&&n.uri.toString()===t.toString()&&e.push(n.edit);return e}entries(){let t=new Ke;for(let e of this._edits)if(e._type===2){let n=t.get(e.uri);n||(n=[e.uri,[]],t.set(e.uri,n)),n[1].push(e.edit)}return[...t.values()]}get size(){return this.entries().length}toJSON(){return this.entries()}};Cr=_([me],Cr);var e1=(e=>(e[e.Top=0]="Top",e[e.Bottom=1]="Bottom",e))(e1||{});var Vc,be=class{constructor(t){Ku(this,Vc);oh(this,Vc,t)}static from(...t){let e=t;return new be(function(){if(e){for(let n of e)n&&typeof n.dispose=="function"&&n.dispose();e=void 0}})}dispose(){typeof gn(this,Vc)=="function"&&(gn(this,Vc).call(this),oh(this,Vc,void 0))}};Vc=new WeakMap,be=_([me],be);var o4=r=>{if(typeof r!="string"||r.length===0||!/^[0-9A-Za-z_\-]+$/.test(r))throw Fe("connectionToken")},yS=class{static isResolvedAuthority(t){return t&&typeof t=="object"&&typeof t.host=="string"&&typeof t.port=="number"&&(t.connectionToken===void 0||typeof t.connectionToken=="string")}constructor(t,e,n){if(typeof t!="string"||t.length===0)throw Fe("host");if(typeof e!="number"||e===0||Math.round(e)!==e)throw Fe("port");typeof n<"u"&&o4(n),this.host=t,this.port=Math.round(e),this.connectionToken=n}},Ql=class{constructor(t,e){this.makeConnection=t;this.connectionToken=e;typeof e<"u"&&o4(e)}static isManagedResolvedAuthority(t){return t&&typeof t=="object"&&typeof t.makeConnection=="function"&&(t.connectionToken===void 0||typeof t.connectionToken=="string")}},Ps=class r extends Error{static NotAvailable(t,e){return new r(t,"NotAvailable",e)}static TemporarilyNotAvailable(t){return new r(t,"TemporarilyNotAvailable")}constructor(t,e="Unknown",n){super(t),this._message=t,this._code=e,this._detail=n,Object.setPrototypeOf(this,r.prototype)}},XS=(n=>(n[n.Replace=1]="Replace",n[n.Append=2]="Append",n[n.Prepend=3]="Prepend",n))(XS||{}),Uc=class{constructor(t,e){if(!t)throw new Error("Illegal argument, contents must be defined");Array.isArray(t)?this.contents=t:this.contents=[t],this.range=e}};Uc=_([me],Uc);var Ll=class extends Uc{constructor(t,e,n,o){super(t,e),this.canIncreaseVerbosity=n,this.canDecreaseVerbosity=o}};Ll=_([me],Ll);var t1=(e=>(e[e.Increase=0]="Increase",e[e.Decrease=1]="Decrease",e))(t1||{}),ZS=(n=>(n[n.Text=0]="Text",n[n.Read=1]="Read",n[n.Write=2]="Write",n))(ZS||{}),Ol=class{constructor(t,e=0){this.range=t,this.kind=e}toJSON(){return{range:this.range,kind:ZS[this.kind]}}};Ol=_([me],Ol);var Nl=class{constructor(t,e){this.uri=t,this.highlights=e}toJSON(){return{uri:this.uri,highlights:this.highlights.map(t=>t.toJSON())}}};Nl=_([me],Nl);var Nr=class{static validate(t){if(!t.name)throw new Error("name must not be falsy");if(!t.range.contains(t.selectionRange))throw new Error("selectionRange must be contained in fullRange");t.children?.forEach(Nr.validate)}constructor(t,e,n,o,i){this.name=t,this.detail=e,this.kind=n,this.range=o,this.selectionRange=i,this.children=[],Nr.validate(this)}};Nr=_([me],Nr);var eC=(e=>(e[e.Invoke=1]="Invoke",e[e.Automatic=2]="Automatic",e))(eC||{}),xs=class{constructor(t,e){this.title=t,this.kind=e}};xs=_([me],xs);var Ss=class{constructor(t,e){if(this.range=t,this.parent=e,e&&!e.range.contains(this.range))throw new Error("Invalid argument: parent must contain this range")}};Ss=_([me],Ss);var Jl=class{constructor(t,e,n,o,i,s){this.kind=t,this.name=e,this.detail=n,this.uri=o,this.range=i,this.selectionRange=s}},lm=class{constructor(t,e){this.fromRanges=e,this.from=t}},dm=class{constructor(t,e){this.fromRanges=e,this.to=t}},tC=(n=>(n[n.Information=0]="Information",n[n.Warning=1]="Warning",n[n.Error=2]="Error",n))(tC||{}),Ul=class{constructor(t,e){this.range=t,this.command=e}get isResolved(){return!!this.command}};Ul=_([me],Ul);var Zp=class{constructor(t,e){this.label=t,this.documentation=e}};Zp=_([me],Zp);var em=class{constructor(t,e){this.label=t,this.documentation=e,this.parameters=[]}};em=_([me],em);var tm=class{constructor(){this.activeSignature=0;this.activeParameter=0;this.signatures=[]}};tm=_([me],tm);var n1=(n=>(n[n.Invoke=1]="Invoke",n[n.TriggerCharacter=2]="TriggerCharacter",n[n.ContentChange=3]="ContentChange",n))(n1||{}),o1=(e=>(e[e.Type=1]="Type",e[e.Parameter=2]="Parameter",e))(o1||{}),Fl=class{constructor(t){this.value=t}};Fl=_([me],Fl);var Hl=class{constructor(t,e,n){this.position=t,this.label=e,this.kind=n}};Hl=_([me],Hl);var nC=(n=>(n[n.Invoke=0]="Invoke",n[n.TriggerCharacter=1]="TriggerCharacter",n[n.TriggerForIncompleteCompletions=2]="TriggerForIncompleteCompletions",n))(nC||{}),Wv=(re=>(re[re.Text=0]="Text",re[re.Method=1]="Method",re[re.Function=2]="Function",re[re.Constructor=3]="Constructor",re[re.Field=4]="Field",re[re.Variable=5]="Variable",re[re.Class=6]="Class",re[re.Interface=7]="Interface",re[re.Module=8]="Module",re[re.Property=9]="Property",re[re.Unit=10]="Unit",re[re.Value=11]="Value",re[re.Enum=12]="Enum",re[re.Keyword=13]="Keyword",re[re.Snippet=14]="Snippet",re[re.Color=15]="Color",re[re.File=16]="File",re[re.Reference=17]="Reference",re[re.Folder=18]="Folder",re[re.EnumMember=19]="EnumMember",re[re.Constant=20]="Constant",re[re.Struct=21]="Struct",re[re.Event=22]="Event",re[re.Operator=23]="Operator",re[re.TypeParameter=24]="TypeParameter",re[re.User=25]="User",re[re.Issue=26]="Issue",re))(Wv||{}),oC=(t=>(t[t.Deprecated=1]="Deprecated",t))(oC||{}),Wl=class{constructor(t,e){this.label=t,this.kind=e}toJSON(){return{label:this.label,kind:this.kind&&Wv[this.kind],detail:this.detail,documentation:this.documentation,sortText:this.sortText,filterText:this.filterText,preselect:this.preselect,insertText:this.insertText,textEdit:this.textEdit}}};Wl=_([me],Wl);var Pi=class{constructor(t=[],e=!1){this.items=t,this.isIncomplete=e}};Pi=_([me],Pi);var nm=class{constructor(t,e,n){this.insertText=t,this.range=e,this.command=n}};nm=_([me],nm);var om=class{constructor(t){this.commands=void 0;this.suppressSuggestions=void 0;this.items=t}};om=_([me],om);var rC=(o=>(o[o.Unknown=0]="Unknown",o[o.Word=1]="Word",o[o.Line=2]="Line",o[o.Suggest=3]="Suggest",o))(rC||{}),iC=(n=>(n[n.Accepted=0]="Accepted",n[n.Rejected=1]="Rejected",n[n.Ignored=2]="Ignored",n))(iC||{}),sC=(e=>(e[e.Code=1]="Code",e[e.Label=2]="Label",e))(sC||{}),aC=(u=>(u[u.Active=-1]="Active",u[u.Beside=-2]="Beside",u[u.One=1]="One",u[u.Two=2]="Two",u[u.Three=3]="Three",u[u.Four=4]="Four",u[u.Five=5]="Five",u[u.Six=6]="Six",u[u.Seven=7]="Seven",u[u.Eight=8]="Eight",u[u.Nine=9]="Nine",u))(aC||{}),lC=(e=>(e[e.Left=1]="Left",e[e.Right=2]="Right",e))(lC||{});function r4(r,t){return`${Ee.toKey(r)}.${t}`}var dC=(o=>(o[o.Off=0]="Off",o[o.On=1]="On",o[o.Relative=2]="Relative",o[o.Interval=3]="Interval",o))(dC||{}),cC=(n=>(n[n.Manual=1]="Manual",n[n.AfterDelay=2]="AfterDelay",n[n.FocusOut=3]="FocusOut",n))(cC||{}),uC=(o=>(o[o.Default=0]="Default",o[o.InCenter=1]="InCenter",o[o.InCenterIfOutsideViewport=2]="InCenterIfOutsideViewport",o[o.AtTop=3]="AtTop",o))(uC||{}),eu=(n=>(n[n.Keyboard=1]="Keyboard",n[n.Mouse=2]="Mouse",n[n.Command=3]="Command",n))(eu||{}),pC=(n=>(n[n.Addition=1]="Addition",n[n.Deletion=2]="Deletion",n[n.Modification=3]="Modification",n))(pC||{}),mC=(e=>(e[e.Undo=1]="Undo",e[e.Redo=2]="Redo",e))(mC||{}),gC=(o=>(o[o.OpenOpen=0]="OpenOpen",o[o.ClosedClosed=1]="ClosedClosed",o[o.OpenClosed=2]="OpenClosed",o[o.ClosedOpen=3]="ClosedOpen",o))(gC||{});(t=>{function r(e){switch(e){case"keyboard":return 1;case"mouse":return 2;case"api":case"code.jump":case"code.navigation":return 3}}t.fromValue=r})(eu||={});var tu=(o=>(o[o.Other=0]="Other",o[o.Comment=1]="Comment",o[o.String=2]="String",o[o.RegEx=3]="RegEx",o))(tu||{});(t=>{function r(e){switch(e){case 0:return"other";case 1:return"comment";case 2:return"string";case 3:return"regex"}return"other"}t.toString=r})(tu||={});var Vl=class{constructor(t,e){if(e&&!b.isUri(e))throw Fe("target");if(!fe.isRange(t)||t.isEmpty)throw Fe("range");this.range=t,this.target=e}};Vl=_([me],Vl);var _i=class{constructor(t,e,n,o){this.red=t,this.green=e,this.blue=n,this.alpha=o}};_i=_([me],_i);var Bl=class{constructor(t,e){if(e&&!(e instanceof _i))throw Fe("color");if(!fe.isRange(t)||t.isEmpty)throw Fe("range");this.range=t,this.color=e}};Bl=_([me],Bl);var $l=class{constructor(t){if(!t||typeof t!="string")throw Fe("label");this.label=t}};$l=_([me],$l);var fC=(n=>(n[n.Error=0]="Error",n[n.Warning=1]="Warning",n[n.Information=2]="Information",n))(fC||{}),r1=(i=>(i[i.Unknown=0]="Unknown",i[i.Shutdown=1]="Shutdown",i[i.Process=2]="Process",i[i.User=3]="User",i[i.Extension=4]="Extension",i))(r1||{}),hC=(n=>(n[n.Low=0]="Low",n[n.Medium=1]="Medium",n[n.High=2]="High",n))(hC||{}),i1=(h=>(h[h.Sh=1]="Sh",h[h.Bash=2]="Bash",h[h.Fish=3]="Fish",h[h.Csh=4]="Csh",h[h.Ksh=5]="Ksh",h[h.Zsh=6]="Zsh",h[h.CommandPrompt=7]="CommandPrompt",h[h.GitBash=8]="GitBash",h[h.PowerShell=9]="PowerShell",h[h.Python=10]="Python",h[h.Julia=11]="Julia",h[h.NuShell=12]="NuShell",h[h.Node=13]="Node",h[h.Xonsh=14]="Xonsh",h))(i1||{}),IS=class{constructor(t,e,n){this.startIndex=t;this.length=e;this.tooltip=n;if(typeof t!="number"||t<0)throw Fe("startIndex");if(typeof e!="number"||e<1)throw Fe("length");if(n!==void 0&&typeof n!="string")throw Fe("tooltip")}},xS=class{constructor(t){this.uri=t}},SS=class{constructor(t){this.terminalCommand=t}},s1=(e=>(e[e.Panel=1]="Panel",e[e.Editor=2]="Editor",e))(s1||{}),CS=class{constructor(t){this.options=t;if(typeof t!="object")throw Fe("options")}},a1=(S=>(S[S.File=0]="File",S[S.Folder=1]="Folder",S[S.Method=2]="Method",S[S.Alias=3]="Alias",S[S.Argument=4]="Argument",S[S.Option=5]="Option",S[S.OptionValue=6]="OptionValue",S[S.Flag=7]="Flag",S[S.SymbolicLinkFile=8]="SymbolicLinkFile",S[S.SymbolicLinkFolder=9]="SymbolicLinkFolder",S[S.ScmCommit=10]="ScmCommit",S[S.ScmBranch=11]="ScmBranch",S[S.ScmTag=12]="ScmTag",S[S.ScmStash=13]="ScmStash",S[S.ScmRemote=14]="ScmRemote",S[S.PullRequest=15]="PullRequest",S[S.PullRequestDone=16]="PullRequestDone",S))(a1||{}),TS=class{constructor(t,e,n,o,i,s,a,l){this.label=t,this.replacementRange=e,this.kind=n,this.detail=o,this.documentation=i,this.isFile=s,this.isDirectory=a,this.isKeyword=l}},ES=class{constructor(t,e){this.items=t??[],this.resourceOptions=e}},l1=(n=>(n[n.Always=1]="Always",n[n.Silent=2]="Silent",n[n.Never=3]="Never",n))(l1||{}),d1=(g=>(g.Changed="changed",g.ProcessStarted="processStarted",g.ProcessEnded="processEnded",g.Terminated="terminated",g.Start="start",g.AcquiredInput="acquiredInput",g.DependsOnStarted="dependsOnStarted",g.Active="active",g.Inactive="inactive",g.End="end",g.ProblemMatcherStarted="problemMatcherStarted",g.ProblemMatcherEnded="problemMatcherEnded",g.ProblemMatcherFoundErrors="problemMatcherFoundErrors",g))(d1||{}),c1=(n=>(n[n.Shared=1]="Shared",n[n.Dedicated=2]="Dedicated",n[n.New=3]="New",n))(c1||{}),Mn=class{constructor(t,e){this.label=e;if(typeof t!="string")throw Fe("name");if(typeof e!="string")throw Fe("name");this._id=t}static from(t){switch(t){case"clean":return Mn.Clean;case"build":return Mn.Build;case"rebuild":return Mn.Rebuild;case"test":return Mn.Test;default:return}}get id(){return this._id}};Mn.Clean=new Mn("clean","Clean"),Mn.Build=new Mn("build","Build"),Mn.Rebuild=new Mn("rebuild","Rebuild"),Mn.Test=new Mn("test","Test"),Mn=_([me],Mn);function i4(r){let t="";for(let e=0;e<r.length;e++)t+=r[e].replace(/,/g,",,")+",";return t}var Cs=class{constructor(t,e,n){if(typeof t!="string")throw Fe("process");this._args=[],this._process=t,e!==void 0&&(Array.isArray(e)?(this._args=e,this._options=n):this._options=e)}get process(){return this._process}set process(t){if(typeof t!="string")throw Fe("process");this._process=t}get args(){return this._args}set args(t){Array.isArray(t)||(t=[]),this._args=t}get options(){return this._options}set options(t){this._options=t}computeId(){let t=[];if(t.push("process"),this._process!==void 0&&t.push(this._process),this._args&&this._args.length>0)for(let e of this._args)t.push(e);return i4(t)}};Cs=_([me],Cs);var Di=class{constructor(t,e,n){this._args=[];if(Array.isArray(e)){if(!t)throw Fe("command can't be undefined or null");if(typeof t!="string"&&typeof t.value!="string")throw Fe("command");this._command=t,e&&(this._args=e),this._options=n}else{if(typeof t!="string")throw Fe("commandLine");this._commandLine=t,this._options=e}}get commandLine(){return this._commandLine}set commandLine(t){if(typeof t!="string")throw Fe("commandLine");this._commandLine=t}get command(){return this._command?this._command:""}set command(t){if(typeof t!="string"&&typeof t.value!="string")throw Fe("command");this._command=t}get args(){return this._args}set args(t){this._args=t||[]}get options(){return this._options}set options(t){this._options=t}computeId(){let t=[];if(t.push("shell"),this._commandLine!==void 0&&t.push(this._commandLine),this._command!==void 0&&t.push(typeof this._command=="string"?this._command:this._command.value),this._args&&this._args.length>0)for(let e of this._args)t.push(typeof e=="string"?e:e.value);return i4(t)}};Di=_([me],Di);var u1=(n=>(n[n.Escape=1]="Escape",n[n.Strong=2]="Strong",n[n.Weak=3]="Weak",n))(u1||{}),vC=(e=>(e[e.Global=1]="Global",e[e.Workspace=2]="Workspace",e))(vC||{}),p1=(n=>(n[n.Default=1]="Default",n[n.FolderOpen=2]="FolderOpen",n[n.WorktreeCreated=3]="WorktreeCreated",n))(p1||{}),zc=class{constructor(t){this._callback=t}computeId(){return"customExecution"+Ae()}set callback(t){this._callback=t}get callback(){return this._callback}},Vn=class{constructor(t,e,n,o,i,s){this.__deprecated=!1;this._definition=this.definition=t;let a;typeof e=="string"?(this._name=this.name=e,this._source=this.source=n,this.execution=o,a=i,this.__deprecated=!0):e===1||e===2?(this.target=e,this._name=this.name=n,this._source=this.source=o,this.execution=i,a=s):(this.target=e,this._name=this.name=n,this._source=this.source=o,this.execution=i,a=s),typeof a=="string"?(this._problemMatchers=[a],this._hasDefinedMatchers=!0):Array.isArray(a)?(this._problemMatchers=a,this._hasDefinedMatchers=!0):(this._problemMatchers=[],this._hasDefinedMatchers=!1),this._isBackground=!1,this._presentationOptions=Object.create(null),this._runOptions=Object.create(null)}get _id(){return this.__id}set _id(t){this.__id=t}get _deprecated(){return this.__deprecated}clear(){this.__id!==void 0&&(this.__id=void 0,this._scope=void 0,this.computeDefinitionBasedOnExecution())}computeDefinitionBasedOnExecution(){this._execution instanceof Cs?this._definition={type:Vn.ProcessType,id:this._execution.computeId()}:this._execution instanceof Di?this._definition={type:Vn.ShellType,id:this._execution.computeId()}:this._execution instanceof zc?this._definition={type:Vn.ExtensionCallbackType,id:this._execution.computeId()}:this._definition={type:Vn.EmptyType,id:Ae()}}get definition(){return this._definition}set definition(t){if(t==null)throw Fe("Kind can't be undefined or null");this.clear(),this._definition=t}get scope(){return this._scope}set target(t){this.clear(),this._scope=t}get name(){return this._name}set name(t){if(typeof t!="string")throw Fe("name");this.clear(),this._name=t}get execution(){return this._execution}set execution(t){t===null&&(t=void 0),this.clear(),this._execution=t;let e=this._definition.type;(Vn.EmptyType===e||Vn.ProcessType===e||Vn.ShellType===e||Vn.ExtensionCallbackType===e)&&this.computeDefinitionBasedOnExecution()}get problemMatchers(){return this._problemMatchers}set problemMatchers(t){if(Array.isArray(t))this.clear(),this._problemMatchers=t,this._hasDefinedMatchers=!0;else{this.clear(),this._problemMatchers=[],this._hasDefinedMatchers=!1;return}}get hasDefinedMatchers(){return this._hasDefinedMatchers}get isBackground(){return this._isBackground}set isBackground(t){t!==!0&&t!==!1&&(t=!1),this.clear(),this._isBackground=t}get source(){return this._source}set source(t){if(typeof t!="string"||t.length===0)throw Fe("source must be a string of length > 0");this.clear(),this._source=t}get group(){return this._group}set group(t){t===null&&(t=void 0),this.clear(),this._group=t}get detail(){return this._detail}set detail(t){t===null&&(t=void 0),this._detail=t}get presentationOptions(){return this._presentationOptions}set presentationOptions(t){t==null&&(t=Object.create(null)),this.clear(),this._presentationOptions=t}get runOptions(){return this._runOptions}set runOptions(t){t==null&&(t=Object.create(null)),this.clear(),this._runOptions=t}};Vn.ExtensionCallbackType="customExecution",Vn.ProcessType="process",Vn.ShellType="shell",Vn.EmptyType="$empty",Vn=_([me],Vn);var Vv=(n=>(n[n.SourceControl=1]="SourceControl",n[n.Window=10]="Window",n[n.Notification=15]="Notification",n))(Vv||{}),m1;(t=>{function r(e){let n=e;return Un(n.value)?n.tooltip&&!De(n.tooltip)?(console.log("INVALID view badge, invalid tooltip",n.tooltip),!1):!0:(console.log("INVALID view badge, invalid value",n.value),!1)}t.isViewBadge=r})(m1||={});var Ts=class{constructor(t,e=0){this.collapsibleState=e;b.isUri(t)?this.resourceUri=t:this.label=t}static isTreeItem(t,e){let n=t;if(n.checkboxState!==void 0){let o=Un(n.checkboxState)?n.checkboxState:it(n.checkboxState)&&Un(n.checkboxState.state)?n.checkboxState.state:void 0,i=!Un(n.checkboxState)&&it(n.checkboxState)?n.checkboxState.tooltip:void 0;if(o===void 0||o!==1&&o!==0||i!==void 0&&!De(i))return console.log("INVALID tree item, invalid checkboxState",n.checkboxState),!1}if(t instanceof Ts)return!0;if(n.label!==void 0&&!De(n.label)&&!n.label?.label)return console.log("INVALID tree item, invalid label",n.label),!1;if(n.id!==void 0&&!De(n.id))return console.log("INVALID tree item, invalid id",n.id),!1;if(n.iconPath!==void 0&&!De(n.iconPath)&&!b.isUri(n.iconPath)&&(!n.iconPath||!De(n.iconPath.id))){let o=n.iconPath;if(!o||!De(o.light)&&!b.isUri(o.light)&&!De(o.dark)&&!b.isUri(o.dark))return console.log("INVALID tree item, invalid iconPath",n.iconPath),!1}return n.description!==void 0&&!De(n.description)&&typeof n.description!="boolean"?(console.log("INVALID tree item, invalid description",n.description),!1):n.resourceUri!==void 0&&!b.isUri(n.resourceUri)?(console.log("INVALID tree item, invalid resourceUri",n.resourceUri),!1):n.tooltip!==void 0&&!De(n.tooltip)&&!(n.tooltip instanceof Zt)?(console.log("INVALID tree item, invalid tooltip",n.tooltip),!1):n.command!==void 0&&!n.command.command?(console.log("INVALID tree item, invalid command",n.command),!1):n.collapsibleState!==void 0&&n.collapsibleState<0&&n.collapsibleState>2?(console.log("INVALID tree item, invalid collapsibleState",n.collapsibleState),!1):n.contextValue!==void 0&&!De(n.contextValue)?(console.log("INVALID tree item, invalid contextValue",n.contextValue),!1):n.accessibilityInformation!==void 0&&!n.accessibilityInformation?.label?(console.log("INVALID tree item, invalid accessibilityInformation",n.accessibilityInformation),!1):!0}};Ts=_([me],Ts);var bC=(n=>(n[n.None=0]="None",n[n.Collapsed=1]="Collapsed",n[n.Expanded=2]="Expanded",n))(bC||{}),yC=(e=>(e[e.Unchecked=0]="Unchecked",e[e.Checked=1]="Checked",e))(yC||{}),Fc=class{constructor(t){this.value=t}async asString(){return typeof this.value=="string"?this.value:JSON.stringify(this.value)}asFile(){}};Fc=_([me],Fc);var Yl=class extends Fc{},wS=class extends Yl{#e;constructor(t){super(""),this.#e=t}asFile(){return this.#e}},kS=class{constructor(t,e,n,o){this.name=t,this.uri=e,this._itemId=n,this._getData=o}data(){return this._getData()}},Ia,Bc,Hv,Zr=class{constructor(t){Ku(this,Bc);Ku(this,Ia,new Map);for(let[e,n]of t??[]){let o=gn(this,Ia).get(rh(this,Bc,Hv).call(this,e));o?o.push(n):gn(this,Ia).set(rh(this,Bc,Hv).call(this,e),[n])}}get(t){return gn(this,Ia).get(rh(this,Bc,Hv).call(this,t))?.[0]}set(t,e){gn(this,Ia).set(rh(this,Bc,Hv).call(this,t),[e])}forEach(t,e){for(let[n,o]of gn(this,Ia))for(let i of o)t.call(e,i,n,this)}*[Symbol.iterator](){for(let[t,e]of gn(this,Ia))for(let n of e)yield[t,n]}};Ia=new WeakMap,Bc=new WeakSet,Hv=function(t){return t.toLowerCase()},Zr=_([me],Zr);var rm=class{constructor(t,e,n){this.insertText=t,this.title=e,this.kind=n}};rm=_([me],rm);var g1=(e=>(e[e.Automatic=0]="Automatic",e[e.PasteAs=1]="PasteAs",e))(g1||{}),ei=class r{constructor(t){this.value=t}static{this.sep="."}append(...t){return new r((this.value?[this.value,...t]:t).join(r.sep))}intersects(t){return this.contains(t)||t.contains(this)}contains(t){return this.value===t.value||t.value.startsWith(this.value+r.sep)}};ei.Empty=new ei("");ei.Text=new ei("text");ei.TextUpdateImports=ei.Text.append("updateImports");var PS=class{constructor(t,e,n){this.title=e,this.insertText=t,this.kind=n}},un=class{constructor(t,e){this.id=t,this.color=e}static isThemeIcon(t){return typeof t.id!="string"?(console.log("INVALID ThemeIcon, invalid id",t.id),!1):!0}};un=_([me],un);un.File=new un("file");un.Folder=new un("folder");var xa=class{constructor(t){this.id=t}};xa=_([me],xa);var IC=(n=>(n[n.Global=1]="Global",n[n.Workspace=2]="Workspace",n[n.WorkspaceFolder=3]="WorkspaceFolder",n))(IC||{}),Es=class{get base(){return this._base}set base(t){this._base=t,this._baseUri=b.file(t)}get baseUri(){return this._baseUri}set baseUri(t){this._baseUri=t,this._base=t.fsPath}constructor(t,e){if(typeof t!="string"&&(!t||!b.isUri(t)&&!b.isUri(t.uri)))throw Fe("base");if(typeof e!="string")throw Fe("pattern");typeof t=="string"?this.baseUri=b.file(t):b.isUri(t)?this.baseUri=t:this.baseUri=t.uri,this.pattern=e}toJSON(){return{pattern:this.pattern,base:this.base,baseUri:this.baseUri.toJSON()}}};Es=_([me],Es);var s4=new WeakMap;function a4(r,t){s4.set(r,t)}var Sa=class{constructor(t,e,n,o,i){this.enabled=typeof t=="boolean"?t:!0,typeof e=="string"&&(this.condition=e),typeof n=="string"&&(this.hitCondition=n),typeof o=="string"&&(this.logMessage=o),typeof i=="string"&&(this.mode=i)}get id(){return this._id||(this._id=s4.get(this)??Ae()),this._id}};Sa=_([me],Sa);var Ri=class extends Sa{constructor(t,e,n,o,i,s){if(super(e,n,o,i,s),t===null)throw Fe("location");this.location=t}};Ri=_([me],Ri);var Ai=class extends Sa{constructor(t,e,n,o,i,s){super(e,n,o,i,s),this.functionName=t}};Ai=_([me],Ai);var Hc=class extends Sa{constructor(t,e,n,o,i,s,a,l){if(super(o,i,s,a,l),!e)throw Fe("dataId");this.label=t,this.dataId=e,this.canPersist=n}};Hc=_([me],Hc);var Mi=class{constructor(t,e,n){this.command=t,this.args=e||[],this.options=n}};Mi=_([me],Mi);var Li=class{constructor(t,e){this.port=t,this.host=e}};Li=_([me],Li);var ws=class{constructor(t){this.path=t}};ws=_([me],ws);var Ca=class{constructor(t){this.implementation=t}};Ca=_([me],Ca);var cm=class{constructor(t,e,n){this.session=t;this.threadId=e;this.frameId=n}},um=class{constructor(t,e){this.session=t;this.threadId=e}},zl=class{constructor(t,e){this.range=t,this.expression=e}};zl=_([me],zl);var xC=(e=>(e[e.Invoke=0]="Invoke",e[e.Automatic=1]="Automatic",e))(xC||{}),SC=(i=>(i[i.Other=0]="Other",i[i.Empty=1]="Empty",i[i.TokenCancellation=2]="TokenCancellation",i[i.LostRace=3]="LostRace",i[i.NotTaken=4]="NotTaken",i))(SC||{}),ql=class{constructor(t,e){this.range=t,this.text=e}};ql=_([me],ql);var Kl=class{constructor(t,e,n=!0){this.range=t,this.variableName=e,this.caseSensitiveLookup=n}};Kl=_([me],Kl);var jl=class{constructor(t,e){this.range=t,this.expression=e}};jl=_([me],jl);var im=class{constructor(t,e){this.frameId=t,this.stoppedLocation=e}};im=_([me],im);var f1=(t=>(t[t.AIGenerated=1]="AIGenerated",t))(f1||{}),CC=(e=>(e[e.Invoke=0]="Invoke",e[e.Automatic=1]="Automatic",e))(CC||{}),_S=class{constructor(t,e){this.newSymbolName=t,this.tags=e}},TC=(n=>(n[n.Changed=1]="Changed",n[n.Created=2]="Created",n[n.Deleted=3]="Deleted",n))(TC||{}),bt=class extends Error{static FileExists(t){return new bt(t,"EntryExists",bt.FileExists)}static FileNotFound(t){return new bt(t,"EntryNotFound",bt.FileNotFound)}static FileNotADirectory(t){return new bt(t,"EntryNotADirectory",bt.FileNotADirectory)}static FileIsADirectory(t){return new bt(t,"EntryIsADirectory",bt.FileIsADirectory)}static NoPermissions(t){return new bt(t,"NoPermissions",bt.NoPermissions)}static Unavailable(t){return new bt(t,"Unavailable",bt.Unavailable)}constructor(t,e="Unknown",n){super(b.isUri(t)?t.toString(!0):t),this.code=n?.name??"Unknown",pR(this,e),Object.setPrototypeOf(this,bt.prototype),typeof Error.captureStackTrace=="function"&&typeof n=="function"&&Error.captureStackTrace(this,n)}};bt=_([me],bt);var sm=class{constructor(t,e,n){this.start=t,this.end=e,this.kind=n}};sm=_([me],sm);var EC=(n=>(n[n.Comment=1]="Comment",n[n.Imports=2]="Imports",n[n.Region=3]="Region",n))(EC||{}),wC=(e=>(e[e.Collapsed=0]="Collapsed",e[e.Expanded=1]="Expanded",e))(wC||{}),h1=(e=>(e[e.Editing=0]="Editing",e[e.Preview=1]="Preview",e))(h1||{}),v1=(e=>(e[e.Published=0]="Published",e[e.Draft=1]="Draft",e))(v1||{}),kC=(e=>(e[e.Unresolved=0]="Unresolved",e[e.Resolved=1]="Resolved",e))(kC||{}),PC=(e=>(e[e.Current=0]="Current",e[e.Outdated=1]="Outdated",e))(PC||{}),_C=(e=>(e[e.Reply=1]="Reply",e[e.Comment=2]="Comment",e))(_C||{}),qc=class{constructor(t,e=[]){this.tokenTypes=t,this.tokenModifiers=e}};function A6(r){return typeof r>"u"||GN(r)}var DS=class r{constructor(t){if(this._prevLine=0,this._prevChar=0,this._dataIsSortedAndDeltaEncoded=!0,this._data=[],this._dataLen=0,this._tokenTypeStrToInt=new Map,this._tokenModifierStrToInt=new Map,this._hasLegend=!1,t){this._hasLegend=!0;for(let e=0,n=t.tokenTypes.length;e<n;e++)this._tokenTypeStrToInt.set(t.tokenTypes[e],e);for(let e=0,n=t.tokenModifiers.length;e<n;e++)this._tokenModifierStrToInt.set(t.tokenModifiers[e],e)}}push(t,e,n,o,i){if(typeof t=="number"&&typeof e=="number"&&typeof n=="number"&&typeof o=="number"&&(typeof i=="number"||typeof i>"u"))return typeof i>"u"&&(i=0),this._pushEncoded(t,e,n,o,i);if(fe.isRange(t)&&typeof e=="string"&&A6(n))return this._push(t,e,n);throw Fe()}_push(t,e,n){if(!this._hasLegend)throw new Error("Legend must be provided in constructor");if(t.start.line!==t.end.line)throw new Error("`range` cannot span multiple lines");if(!this._tokenTypeStrToInt.has(e))throw new Error("`tokenType` is not in the provided legend");let o=t.start.line,i=t.start.character,s=t.end.character-t.start.character,a=this._tokenTypeStrToInt.get(e),l=0;if(n)for(let d of n){if(!this._tokenModifierStrToInt.has(d))throw new Error("`tokenModifier` is not in the provided legend");let c=this._tokenModifierStrToInt.get(d);l|=1<<c>>>0}this._pushEncoded(o,i,s,a,l)}_pushEncoded(t,e,n,o,i){if(this._dataIsSortedAndDeltaEncoded&&(t<this._prevLine||t===this._prevLine&&e<this._prevChar)){this._dataIsSortedAndDeltaEncoded=!1;let l=this._data.length/5|0,d=0,c=0;for(let u=0;u<l;u++){let m=this._data[5*u],g=this._data[5*u+1];m===0?(m=d,g+=c):m+=d,this._data[5*u]=m,this._data[5*u+1]=g,d=m,c=g}}let s=t,a=e;this._dataIsSortedAndDeltaEncoded&&this._dataLen>0&&(s-=this._prevLine,s===0&&(a-=this._prevChar)),this._data[this._dataLen++]=s,this._data[this._dataLen++]=a,this._data[this._dataLen++]=n,this._data[this._dataLen++]=o,this._data[this._dataLen++]=i,this._prevLine=t,this._prevChar=e}static _sortAndDeltaEncode(t){let e=[],n=t.length/5|0;for(let a=0;a<n;a++)e[a]=a;e.sort((a,l)=>{let d=t[5*a],c=t[5*l];if(d===c){let u=t[5*a+1],m=t[5*l+1];return u-m}return d-c});let o=new Uint32Array(t.length),i=0,s=0;for(let a=0;a<n;a++){let l=5*e[a],d=t[l+0],c=t[l+1],u=t[l+2],m=t[l+3],g=t[l+4],h=d-i,f=h===0?c-s:c,I=5*a;o[I+0]=h,o[I+1]=f,o[I+2]=u,o[I+3]=m,o[I+4]=g,i=d,s=c}return o}build(t){return this._dataIsSortedAndDeltaEncoded?new Oi(new Uint32Array(this._data),t):new Oi(r._sortAndDeltaEncode(this._data),t)}},Oi=class{constructor(t,e){this.resultId=e,this.data=t}},pm=class{constructor(t,e,n){this.start=t,this.deleteCount=e,this.data=n}},Xl=class{constructor(t,e){this.resultId=e,this.edits=t}},DC=(e=>(e[e.Separate=0]="Separate",e[e.MergeWithParent=1]="MergeWithParent",e))(DC||{}),RS=class{constructor(t){this.name=t}},b1=(n=>(n[n.Title=1]="Title",n[n.Inline=2]="Inline",n[n.Input=3]="Input",n))(b1||{}),Is=class{constructor(){}};Is.Back={iconPath:new un("arrow-left")},Is=_([me],Is);var RC=(e=>(e[e.Separator=-1]="Separator",e[e.Default=0]="Default",e))(RC||{}),AC=(n=>(n[n.Info=1]="Info",n[n.Warning=2]="Warning",n[n.Error=3]="Error",n))(AC||{}),MC=(e=>(e[e.UI=1]="UI",e[e.Workspace=2]="Workspace",e))(MC||{}),Kc=class{static validate(t){if(typeof t.badge=="string"){let e=a_(t.badge,0);if(e<t.badge.length&&(e+=a_(t.badge,e)),t.badge.length>e)throw new Error("The 'badge'-property must be undefined or a short character")}else if(t.badge&&!un.isThemeIcon(t.badge))throw new Error("The 'badge'-property is not a valid ThemeIcon");if(!t.color&&!t.badge&&!t.tooltip)throw new Error("The decoration is empty");return!0}constructor(t,e,n){this.badge=t,this.tooltip=e,this.color=n}},Wc=class{constructor(t){this.kind=t}};Wc=_([me],Wc);var LC=(o=>(o[o.Light=1]="Light",o[o.Dark=2]="Dark",o[o.HighContrast=3]="HighContrast",o[o.HighContrastLight=4]="HighContrastLight",o))(LC||{}),AS=class{constructor(t,e,n){this.label=t;this.uri=e;this.position=n}},y1=(n=>(n[n.Idle=1]="Idle",n[n.Pending=2]="Pending",n[n.Executing=3]="Executing",n))(y1||{}),OC=(e=>(e[e.Left=1]="Left",e[e.Right=2]="Right",e))(OC||{}),NC=(o=>(o[o.Default=0]="Default",o[o.InCenter=1]="InCenter",o[o.InCenterIfOutsideViewport=2]="InCenterIfOutsideViewport",o[o.AtTop=3]="AtTop",o))(NC||{}),MS=class{constructor(t,e){this.text=t;this.alignment=e}},I1=(e=>(e[e.Default=1]="Default",e[e.Preferred=2]="Preferred",e))(I1||{}),UC=(n=>(n[n.Default=1]="Default",n[n.Preferred=2]="Preferred",n[n.Hidden=-1]="Hidden",n))(UC||{}),mm=class{constructor(t,e=[]){this.uri=t;this.provides=Dn(e)}},LS=class{constructor(t){this.label=t}},FC=(e=>(e[e.Named=1]="Named",e[e.Indexed=2]="Indexed",e))(FC||{}),am=class{constructor(t,e){this.label=t;this.timestamp=e}};am=_([me],am);var HC=(n=>(n[n.Production=1]="Production",n[n.Development=2]="Development",n[n.Test=3]="Test",n))(HC||{}),WC=(e=>(e[e.Node=1]="Node",e[e.Webworker=2]="Webworker",e))(WC||{}),Bv=(o=>(o[o.Other=0]="Other",o[o.Comment=1]="Comment",o[o.String=2]="String",o[o.RegEx=3]="RegEx",o))(Bv||{}),OS=class{constructor(t,e){this.ranges=t;this.wordPattern=e}},NS=class{constructor(t){this._autoForwardAction=t}get autoForwardAction(){return this._autoForwardAction}},x1=(s=>(s[s.Queued=1]="Queued",s[s.Running=2]="Running",s[s.Passed=3]="Passed",s[s.Failed=4]="Failed",s[s.Skipped=5]="Skipped",s[s.Errored=6]="Errored",s))(x1||{}),VC=(n=>(n[n.Run=1]="Run",n[n.Debug=2]="Debug",n[n.Coverage=3]="Coverage",n))(VC||{}),gm=class{constructor(t,e,n){this.controllerId=t;this.profileId=e;this.kind=n}},Gl=class{constructor(t=void 0,e=void 0,n=void 0,o=!1,i=!0){this.include=t;this.exclude=e;this.profile=n;this.continuous=o;this.preserveFocus=i}};Gl=_([me],Gl);var ks=class{constructor(t){this.message=t}static diff(t,e,n){let o=new ks(t);return o.expectedOutput=e,o.actualOutput=n,o}};ks=_([me],ks);var Ta=class{constructor(t){this.id=t}};Ta=_([me],Ta);var US=class{constructor(t,e,n){this.label=t;this.uri=e;this.position=n}},$c=class{constructor(t,e){this.covered=t;this.total=e;$v(this)}};function $v(r){if(r){if(r.covered>r.total)throw new Error(`The total number of covered items (${r.covered}) cannot be greater than the total (${r.total})`);if(r.total<0)throw new Error(`The number of covered items (${r.total}) cannot be negative`)}}var Ea=class r{constructor(t,e,n,o,i=[]){this.uri=t;this.statementCoverage=e;this.branchCoverage=n;this.declarationCoverage=o;this.includesTests=i}static fromDetails(t,e){let n=new $c(0,0),o=new $c(0,0),i=new $c(0,0);for(let a of e)if("branches"in a){n.total+=1,n.covered+=a.executed?1:0;for(let l of a.branches)o.total+=1,o.covered+=l.executed?1:0}else i.total+=1,i.covered+=a.executed?1:0;let s=new r(t,n,o.total>0?o:void 0,i.total>0?i:void 0);return s.detailedCoverage=e,s}},fm=class{constructor(t,e,n=[]){this.executed=t;this.location=e;this.branches=n}get executionCount(){return+this.executed}set executionCount(t){this.executed=t}},hm=class{constructor(t,e,n){this.executed=t;this.location=e;this.label=n}get executionCount(){return+this.executed}set executionCount(t){this.executed=t}},vm=class{constructor(t,e,n){this.name=t;this.executed=e;this.location=n}get executionCount(){return+this.executed}set executionCount(t){this.executed=t}},S1=(o=>(o[o.None=0]="None",o[o.Option=1]="Option",o[o.Default=2]="Default",o[o.Preferred=3]="Preferred",o))(S1||{}),C1=(n=>(n[n.Untrusted=0]="Untrusted",n[n.Trusted=1]="Trusted",n[n.Unspecified=2]="Unspecified",n))(C1||{}),T1=(s=>(s[s.Notify=1]="Notify",s[s.OpenBrowser=2]="OpenBrowser",s[s.OpenPreview=3]="OpenPreview",s[s.Silent=4]="Silent",s[s.Ignore=5]="Ignore",s[s.OpenBrowserOnce=6]="OpenBrowserOnce",s))(T1||{}),Zl=class{constructor(t,e,n,o,i,s){this.kind=t,this.name=e,this.detail=n,this.uri=o,this.range=i,this.selectionRange=s}},ed=class{constructor(t){this.uri=t}},wa=class{constructor(t,e){this.original=t;this.modified=e}},bm=class{constructor(t,e,n,o){this.base=t;this.input1=e;this.input2=n;this.result=o}},td=class{constructor(t,e){this.uri=t;this.viewType=e}},ym=class{constructor(t){this.viewType=t}},nd=class{constructor(t,e){this.uri=t;this.notebookType=e}},od=class{constructor(t,e,n){this.original=t;this.modified=e;this.notebookType=n}},Im=class{constructor(){}},xm=class{constructor(t,e){this.uri=t;this.inputBoxUri=e}},Sm=class{constructor(){}},Cm=class{constructor(t){this.textDiffs=t}},E1=(e=>(e[e.Down=0]="Down",e[e.Up=1]="Up",e))(E1||{}),w1=(e=>(e[e.Action=1]="Action",e[e.Toolbar=2]="Toolbar",e))(w1||{}),k1=(n=>(n[n.Short=1]="Short",n[n.Medium=2]="Medium",n[n.Full=3]="Full",n))(k1||{}),FS=class{constructor(t,e,n){this.id=t,this.label=e,this.values=n}},BC=(n=>(n[n.Accepted=1]="Accepted",n[n.Rejected=2]="Rejected",n[n.Saved=3]="Saved",n))(BC||{}),P1=(n=>(n[n.Keep=1]="Keep",n[n.Undo=2]="Undo",n[n.UserModification=3]="UserModification",n))(P1||{}),_1=(i=>(i[i.Unhelpful=0]="Unhelpful",i[i.Helpful=1]="Helpful",i[i.Undone=2]="Undone",i[i.Accepted=3]="Accepted",i[i.Bug=4]="Bug",i))(_1||{}),$C=(e=>(e[e.Unhelpful=0]="Unhelpful",e[e.Helpful=1]="Helpful",e))($C||{}),ka=class{constructor(t){if(typeof t!="string"&&t.isTrusted===!0)throw new Error("The boolean form of MarkdownString.isTrusted is NOT supported for chat participants.");this.value=typeof t=="string"?new Zt(t):t}},_s=class{constructor(t,e){if(typeof t!="string"&&t.isTrusted===!0)throw new Error("The boolean form of MarkdownString.isTrusted is NOT supported for chat participants.");this.value=typeof t=="string"?new Zt(t):t,this.vulnerabilities=e}},Pa=class{constructor(t,e,n,o){this.title=t,this.message=e,this.data=n,this.buttons=o}},_a=class{constructor(t,e){this.value=t,this.baseUri=e}},jc=class{constructor(t,e,n){this.value=t,this.title=e,this.readOnly=n}},HS=class{constructor(t,e){this.data=t,this.mimeType=e}},Tm=class{constructor(t,e,n,o){this.description=t,this.agentName=e,this.prompt=n,this.result=o}},Gc=class{constructor(t,e){this.uris=t;this.callback=e;this.applied=new Promise(n=>{this.didGetApplied=n})}},Ds=class{constructor(t,e){this.value=t,this.value2=t,this.title=e}},Qc=class{constructor(t){this.value=t}},rd=class{constructor(t,e){this.value=t,this.task=e}},Ni=class{constructor(t,e,n){this.value=t,this.id=e,this.metadata=n}},Da=class{constructor(t,e,n,o){this.hookType=t,this.stopReason=e,this.systemMessage=n,this.metadata=o}},Rs=class{constructor(t){if(typeof t!="string"&&t.isTrusted===!0)throw new Error("The boolean form of MarkdownString.isTrusted is NOT supported for chat participants.");this.value=typeof t=="string"?new Zt(t):t}},Ra=class{constructor(t){this.value=t}},ti=class{constructor(t,e,n){this.value=t,this.iconPath=e,this.options=n}},Aa=class{constructor(t,e,n){this.value=t,this.isEdit=e,this.undoStopId=n}},Ma=class{constructor(t,e,n){this.value=t,this.license=e,this.snippet=n}},La=class{constructor(t,e){this.uri=t;this.range=e}},id=class{constructor(t){this.extensions=t}},sd=class{constructor(t,e,n,o,i){this.title=e;this.description=n;this.author=o;this.linkTag=i;cl(t)?(this.uri=t,this.command={title:"Open Pull Request",command:"vscode.open",arguments:[t]}):this.command=t}toJSON(){return{$mid:26,uri:this.uri,title:this.title,description:this.description,author:this.author}}},zC=(n=>(n[n.Text=1]="Text",n[n.SingleSelect=2]="SingleSelect",n[n.MultiSelect=3]="MultiSelect",n))(zC||{}),Em=class{constructor(t,e,n,o){this.id=t,this.type=e,this.title=n,this.message=o?.message,this.options=o?.options,this.defaultValue=o?.defaultValue,this.allowFreeformInput=o?.allowFreeformInput}},As=class{constructor(t,e=!0){this.questions=t,this.allowSkip=e}},Ms=class{constructor(t,e){this.uri=t,e===!0?(this.isDone=!0,this.edits=[]):this.edits=Array.isArray(e)?e:[e]}},Oa=class{constructor(t,e){this.uri=t,e===!0?(this.isDone=!0,this.edits=[]):this.edits=Array.isArray(e)?e:[e]}},ad=class{constructor(t){this.edits=t}},qC=(n=>(n[n.NotStarted=1]="NotStarted",n[n.InProgress=2]="InProgress",n[n.Completed=3]="Completed",n))(qC||{}),KC=(n=>(n[n.Running=0]="Running",n[n.Completed=1]="Completed",n[n.Failed=2]="Failed",n))(KC||{}),Jc=class{constructor(t,e,n){this.toolName=t,this.toolCallId=e,this.errorMessage=n}},Ls=class{constructor(t,e,n,o,i,s,a,l,d){this.prompt=t;this.command=e;this.references=n;this.participant=o;this.toolReferences=i;this.editedFileEvents=s;this.id=a;this.modelId=l;this.modeInstructions2=d}},wm=class{constructor(t,e,n,o){this.response=t;this.result=e;this.participant=n;this.command=o}},WS=class{constructor(t,e,n,o){this.response=t;this.result=e;this.participant=n;this.command=o}},jC=(o=>(o[o.Panel=1]="Panel",o[o.Terminal=2]="Terminal",o[o.Notebook=3]="Notebook",o[o.Editor=4]="Editor",o))(jC||{}),D1=(o=>(o[o.Failed=0]="Failed",o[o.Completed=1]="Completed",o[o.InProgress=2]="InProgress",o[o.NeedsInput=3]="NeedsInput",o))(D1||{}),VS=class r{constructor(t){this.id=t}static{this.Agent=new r("agent")}static{this.Skill=new r("skill")}static{this.Instructions=new r("instructions")}static{this.Prompt=new r("prompt")}static{this.Hook=new r("hook")}},R1=(o=>(o[o.Trace=0]="Trace",o[o.Info=1]="Info",o[o.Warning=2]="Warning",o[o.Error=3]="Error",o))(R1||{}),GC=(e=>(e[e.Success=0]="Success",e[e.Error=1]="Error",e))(GC||{}),QC=(n=>(n[n.Success=0]="Success",n[n.Error=1]="Error",n[n.NonBlockingError=2]="NonBlockingError",n))(QC||{}),km=class{constructor(t,e){this._kind="toolCall";this.toolName=t,this.created=e}},Pm=class{constructor(t){this._kind="modelTurn";this.created=t}},_m=class{constructor(t,e,n){this._kind="generic";this.name=t,this.level=e,this.created=n}},Dm=class{constructor(t,e){this._kind="subagentInvocation";this.agentName=t,this.created=e}},Yc=class{constructor(t,e){this.name=t,this.content=e}},Rm=class{constructor(t,e){this._kind="userMessage";this.message=t,this.created=e,this.sections=[]}},Am=class{constructor(t,e){this._kind="agentResponse";this.message=t,this.created=e,this.sections=[]}},BS=class{constructor(t){this._kind="text";this.value=t}},JC=(e=>(e[e.User=0]="User",e[e.Agent=1]="Agent",e))(JC||{}),$S=class{constructor(t,e,n){this._kind="messageContent";this.type=t,this.message=e,this.sections=n}},zS=class{constructor(t){this._kind="toolCallContent";this.toolName=t}},qS=class{constructor(t){this._kind="modelTurnContent";this.requestName=t}},KS=class{constructor(t){this._kind="hookContent";this.hookType=t}},jS=class{constructor(t,e,n,o){this.modifiedUri=t;this.insertions=e;this.deletions=n;this.originalUri=o}},GS=class{constructor(t,e,n,o,i){this.uri=t;this.originalUri=e;this.modifiedUri=n;this.insertions=o;this.deletions=i}},A1=(n=>(n[n.Complete=1]="Complete",n[n.Partial=2]="Partial",n[n.Omitted=3]="Omitted",n))(A1||{}),M1=(n=>(n[n.NoReason=0]="NoReason",n[n.FilteredContentRetry=1]="FilteredContentRetry",n[n.CopyrightContentRetry=2]="CopyrightContentRetry",n))(M1||{}),Mm=class{constructor(t,e,n,o){this.editor=t;this.document=e;this.selection=n;this.wholeRange=o}},Lm=class{constructor(t){this.cell=t}},Om=class{constructor(t,e,n){this.mimeType=t,this.data=e,this.reference=n}},ld=class{constructor(t){this.diagnostics=t}},zv=(n=>(n[n.User=1]="User",n[n.Assistant=2]="Assistant",n[n.System=3]="System",n))(zv||{}),Os=class{constructor(t,e,n){this.callId=t,this.content=e,this.isError=n??!1}},L1=(n=>(n[n.Info=0]="Info",n[n.Warning=1]="Warning",n[n.Error=2]="Error",n))(L1||{}),Nm=class r{constructor(t,e,n){this._content=[];this.role=t,this.content=e,this.name=n}static User(t,e){return new r(1,t,e)}static Assistant(t,e){return new r(2,t,e)}set content(t){typeof t=="string"?this._content=[new tn(t)]:this._content=t}get content(){return this._content}},Um=class r{constructor(t,e,n){this._content=[];this.role=t,this.content=e,this.name=n}static User(t,e){return new r(1,t,e)}static Assistant(t,e){return new r(2,t,e)}set content(t){typeof t=="string"?this._content=[new tn(t)]:this._content=t}get content(){return this._content}set content2(t){t&&(this.content=t.map(e=>typeof e=="string"?new tn(e):e))}get content2(){return this.content.map(t=>t instanceof tn?t.value:t)}},ni=class{constructor(t,e,n){this.callId=t,this.name=e,this.input=n}},YC=(n=>(n[n.Assistant=0]="Assistant",n[n.User=1]="User",n[n.Extension=2]="Extension",n))(YC||{}),tn=class{constructor(t,e){this.value=t,e=e}toJSON(){return{$mid:21,value:this.value,audience:this.audience}}},Ln=class r{constructor(t,e,n){this.mimeType=e,this.data=t,this.audience=n}static image(t,e){return new r(t,e)}static json(t,e="text/x-json"){let n=JSON.stringify(t,void 0,"	");return new r(H.fromString(n).buffer,e)}static text(t,e=Fo.text){return new r(H.fromString(t).buffer,e)}toJSON(){return{$mid:24,mimeType:this.mimeType,data:this.data,audience:this.audience}}},O1=(i=>(i.PNG="image/png",i.JPEG="image/jpeg",i.GIF="image/gif",i.WEBP="image/webp",i.BMP="image/bmp",i))(O1||{}),Ui=class{constructor(t,e,n){this.value=t,this.id=e,this.metadata=n}toJSON(){return{$mid:22,value:this.value,id:this.id,metadata:this.metadata}}},oi=class{constructor(t){this.value=t}toJSON(){return{$mid:23,value:this.value}}};var Tr=class r extends Error{static#e="LanguageModelError";static NotFound(t){return new r(t,r.NotFound.name)}static NoPermissions(t){return new r(t,r.NoPermissions.name)}static Blocked(t){return new r(t,r.Blocked.name)}static tryDeserialize(t){if(t.name===r.#e)return new r(t.message,t.code,t.cause)}constructor(t,e,n){super(t,{cause:n}),this.name=r.#e,this.code=e??""}},dd=class{constructor(t){this.content=t}toJSON(){return{$mid:20,content:this.content}}},QS=class{constructor(t){this.content=t}toJSON(){return{$mid:20,content:this.content}}},JS=class extends dd{},XC=(e=>(e[e.Auto=1]="Auto",e[e.Required=2]="Required",e))(XC||{}),Fm=class{constructor(t,e){this.id=t;this.label=e}},Hm=class{constructor(t,e,n){this.label=t;this.name=e;this.instructions=n}},N1=(o=>(o[o.SymbolInformation=1]="SymbolInformation",o[o.CommandInformation=2]="CommandInformation",o[o.SearchInformation=3]="SearchInformation",o[o.SettingInformation=4]="SettingInformation",o))(N1||{}),U1=(n=>(n[n.EMBEDDED=1]="EMBEDDED",n[n.LLM_RANKED=2]="LLM_RANKED",n[n.CANCELED=3]="CANCELED",n))(U1||{}),F1=(i=>(i[i.Started=1]="Started",i[i.Recognizing=2]="Recognizing",i[i.Recognized=3]="Recognized",i[i.Stopped=4]="Stopped",i[i.Error=5]="Error",i))(F1||{}),H1=(n=>(n[n.Started=1]="Started",n[n.Stopped=2]="Stopped",n[n.Error=3]="Error",n))(H1||{}),W1=(e=>(e[e.Recognized=1]="Recognized",e[e.Stopped=2]="Stopped",e))(W1||{}),ZC=(e=>(e[e.Initial=0]="Initial",e[e.Dynamic=1]="Dynamic",e))(ZC||{}),Xc=class{constructor(t,e,n,o={},i,s){this.label=t;this.command=e;this.args=n;this.env=o;this.version=i;this.metadata=s}},Zc=class{constructor(t,e,n={},o,i,s){this.label=t;this.uri=e;this.headers=n;this.version=o;this.metadata=i;this.authentication=s}};var Eo;(e=>{function r(n){let{selectionStartLineNumber:o,selectionStartColumn:i,positionLineNumber:s,positionColumn:a}=n,l=new we(o-1,i-1),d=new we(s-1,a-1);return new Jn(l,d)}e.to=r;function t(n){let{anchor:o,active:i}=n;return{selectionStartLineNumber:o.line+1,selectionStartColumn:o.character+1,positionLineNumber:i.line+1,positionColumn:i.character+1}}e.from=t})(Eo||={});var j;(e=>{function r(n){if(!n)return;let{start:o,end:i}=n;return{startLineNumber:o.line+1,startColumn:o.character+1,endLineNumber:i.line+1,endColumn:i.character+1}}e.from=r;function t(n){if(!n)return;let{startLineNumber:o,startColumn:i,endLineNumber:s,endColumn:a}=n;return new fe(o-1,i-1,s-1,a-1)}e.to=t})(j||={});var ri;(e=>{function r(n){return{uri:n.uri,range:j.from(n.range)}}e.from=r;function t(n){return new en(b.revive(n.uri),j.to(n.range))}e.to=t})(ri||={});var G1;(t=>{function r(e){switch(e){case 1:return 1;case 0:return 0;case 3:return 3;case 2:return 2}}t.to=r})(G1||={});var ct;(e=>{function r(n){return new we(n.lineNumber-1,n.column-1)}e.to=r;function t(n){return{lineNumber:n.line+1,column:n.character+1}}e.from=t})(ct||={});var Fi;(n=>{function r(o,i,s){return tt(Dn(o).map(a=>t(a,i,s)))}n.from=r;function t(o,i,s){if(typeof o=="string")return{$serialized:!0,language:o,isBuiltin:s?.isBuiltin};if(o)return{$serialized:!0,language:o.language,scheme:e(o.scheme,i),pattern:$o.from(o.pattern)??void 0,exclusive:o.exclusive,notebookType:o.notebookType,isBuiltin:s?.isBuiltin}}function e(o,i){return i&&typeof o=="string"?i.transformOutgoingScheme(o):o}})(Fi||={});var V1;(e=>{function r(n){switch(n){case 1:return 1;case 2:return 2}}e.from=r;function t(n){switch(n){case 1:return 1;case 2:return 2;default:return}}e.to=t})(V1||={});var Fa;(e=>{function r(n){let o;return n.code&&(De(n.code)||Un(n.code)?o=String(n.code):o={value:String(n.code.value),target:n.code.target}),{...j.from(n.range),message:n.message,source:n.source,code:o,severity:eT.from(n.severity),relatedInformation:n.relatedInformation&&n.relatedInformation.map(B1.from),tags:Array.isArray(n.tags)?tt(n.tags.map(V1.from)):void 0}}e.from=r;function t(n){let o=new ba(j.to(n),n.message,eT.to(n.severity));return o.source=n.source,o.code=De(n.code)?n.code:n.code?.value,o.relatedInformation=n.relatedInformation&&n.relatedInformation.map(B1.to),o.tags=n.tags&&tt(n.tags.map(V1.to)),o}e.to=t})(Fa||={});var B1;(e=>{function r(n){return{...j.from(n.location.range),message:n.message,resource:n.location.uri}}e.from=r;function t(n){return new vs(new en(n.resource,j.to(n)),n.message)}e.to=t})(B1||={});var eT;(e=>{function r(n){switch(n){case 0:return 8;case 1:return 4;case 2:return 2;case 3:return 1}return 8}e.from=r;function t(n){switch(n){case 2:return 2;case 4:return 1;case 8:return 0;case 1:return 3;default:return 0}}e.to=t})(eT||={});var Vt;(e=>{function r(n){return typeof n=="number"&&n>=1?n-1:n===-2?vW:hW}e.from=r;function t(n){if(typeof n=="number"&&n>=0)return n+1;throw new Error("invalid 'EditorGroupColumn'")}e.to=t})(Vt||={});function F6(r){return typeof r.range<"u"}function Q1(r){return r.length===0?!0:!!F6(r[0])}var ue;(s=>{function r(a){return a.map(s.from)}s.fromMany=r;function t(a){return a&&typeof a=="object"&&typeof a.language=="string"&&typeof a.value=="string"}function e(a){let l;if(t(a)){let{language:u,value:m}=a;l={value:"```"+u+`
`+m+"\n```\n"}}else Zt.isMarkdownString(a)?l={value:a.value,isTrusted:a.isTrusted,supportThemeIcons:a.supportThemeIcons,supportHtml:a.supportHtml,supportAlertSyntax:a.supportAlertSyntax,baseUri:a.baseUri}:typeof a=="string"?l={value:a}:l={value:""};let d=Object.create(null);l.uris=d;let c=({href:u})=>{try{let m=b.parse(u,!0);m=m.with({query:n(m.query,d)}),d[u]=m}catch{}return""};return $t.walkTokens($t.lexer(l.value),u=>{u.type==="link"?c({href:u.href}):u.type==="image"&&typeof u.href=="string"&&c(w2(u.href))}),l}s.from=e;function n(a,l){if(!a)return a;let d;try{d=AI(a)}catch{}if(!d)return a;let c=!1;return d=ra(d,u=>{if(b.isUri(u)){let m=`__uri_${Math.random().toString(16).slice(2,8)}`;return l[m]=u,c=!0,m}else return}),c?JSON.stringify(d):a}function o(a){let l=new Zt(a.value,a.supportThemeIcons);return l.isTrusted=a.isTrusted,l.supportHtml=a.supportHtml,l.supportAlertSyntax=a.supportAlertSyntax,l.baseUri=a.baseUri?b.from(a.baseUri):void 0,l}s.to=o;function i(a){if(a)return typeof a=="string"?a:s.from(a)}s.fromStrict=i})(ue||={});function d4(r){return Q1(r)?r.map(t=>({range:j.from(t.range),hoverMessage:Array.isArray(t.hoverMessage)?ue.fromMany(t.hoverMessage):t.hoverMessage?ue.from(t.hoverMessage):void 0,renderOptions:t.renderOptions})):r.map(t=>({range:j.from(t)}))}function Xv(r){return typeof r>"u"?r:typeof r=="string"?b.file(r):r}var qv;(t=>{function r(e){return typeof e>"u"?e:{contentText:e.contentText,contentIconPath:e.contentIconPath?Xv(e.contentIconPath):void 0,border:e.border,borderColor:e.borderColor,fontStyle:e.fontStyle,fontWeight:e.fontWeight,textDecoration:e.textDecoration,color:e.color,backgroundColor:e.backgroundColor,margin:e.margin,width:e.width,height:e.height}}t.from=r})(qv||={});var $1;(t=>{function r(e){return typeof e>"u"?e:{backgroundColor:e.backgroundColor,outline:e.outline,outlineColor:e.outlineColor,outlineStyle:e.outlineStyle,outlineWidth:e.outlineWidth,border:e.border,borderColor:e.borderColor,borderRadius:e.borderRadius,borderSpacing:e.borderSpacing,borderStyle:e.borderStyle,borderWidth:e.borderWidth,fontStyle:e.fontStyle,fontWeight:e.fontWeight,textDecoration:e.textDecoration,cursor:e.cursor,color:e.color,opacity:e.opacity,letterSpacing:e.letterSpacing,gutterIconPath:e.gutterIconPath?Xv(e.gutterIconPath):void 0,gutterIconSize:e.gutterIconSize,overviewRulerColor:e.overviewRulerColor,before:e.before?qv.from(e.before):void 0,after:e.after?qv.from(e.after):void 0}}t.from=r})($1||={});var c4;(t=>{function r(e){if(typeof e>"u")return e;switch(e){case 0:return 0;case 1:return 1;case 2:return 2;case 3:return 3}}t.from=r})(c4||={});var J1;(t=>{function r(e){return{isWholeLine:e.isWholeLine,rangeBehavior:e.rangeBehavior?c4.from(e.rangeBehavior):void 0,overviewRulerLane:e.overviewRulerLane,light:e.light?$1.from(e.light):void 0,dark:e.dark?$1.from(e.dark):void 0,backgroundColor:e.backgroundColor,outline:e.outline,outlineColor:e.outlineColor,outlineStyle:e.outlineStyle,outlineWidth:e.outlineWidth,border:e.border,borderColor:e.borderColor,borderRadius:e.borderRadius,borderSpacing:e.borderSpacing,borderStyle:e.borderStyle,borderWidth:e.borderWidth,fontStyle:e.fontStyle,fontWeight:e.fontWeight,textDecoration:e.textDecoration,cursor:e.cursor,color:e.color,opacity:e.opacity,letterSpacing:e.letterSpacing,gutterIconPath:e.gutterIconPath?Xv(e.gutterIconPath):void 0,gutterIconSize:e.gutterIconSize,overviewRulerColor:e.overviewRulerColor,before:e.before?qv.from(e.before):void 0,after:e.after?qv.from(e.after):void 0}}t.from=r})(J1||={});var Pn;(e=>{function r(n){return{text:n.newText,eol:n.newEol&&ru.from(n.newEol),range:j.from(n.range)}}e.from=r;function t(n){let o=new Wn(j.to(n.range),n.text);return o.newEol=typeof n.eol>"u"?void 0:ru.to(n.eol),o}e.to=t})(Pn||={});var mo;(e=>{function r(n,o){let i={edits:[]};if(n instanceof Cr){let s=new kr;for(let a of n._allEntries())a._type===1&&b.isUri(a.to)&&a.from===void 0&&s.add(a.to);for(let a of n._allEntries())if(a._type===1){let l;a.options?.contents&&(ArrayBuffer.isView(a.options.contents)?l={type:"base64",value:Ao(H.wrap(a.options.contents))}:l={type:"dataTransferItem",id:a.options.contents._itemId}),i.edits.push({oldResource:a.from,newResource:a.to,options:{...a.options,contents:l},metadata:a.metadata})}else a._type===2?i.edits.push({resource:a.uri,textEdit:Pn.from(a.edit),versionId:s.has(a.uri)?void 0:o?.getTextDocumentVersion(a.uri),metadata:a.metadata}):a._type===6?i.edits.push({resource:a.uri,textEdit:{range:j.from(a.range),text:a.edit.value,insertAsSnippet:!0,keepWhitespace:a.keepWhitespace},versionId:s.has(a.uri)?void 0:o?.getTextDocumentVersion(a.uri),metadata:a.metadata}):a._type===3?i.edits.push({metadata:a.metadata,resource:a.uri,cellEdit:a.edit,notebookVersionId:o?.getNotebookDocumentVersion(a.uri)}):a._type===5&&i.edits.push({metadata:a.metadata,resource:a.uri,notebookVersionId:o?.getNotebookDocumentVersion(a.uri),cellEdit:{editType:1,index:a.index,count:a.count,cells:a.cells.map(jv.from)}})}return i}e.from=r;function t(n){let o=new Cr,i=new Ke;for(let s of n.edits)if(s.textEdit){let a=s,l=b.revive(a.resource),d=j.to(a.textEdit.range),c=a.textEdit.text,u=a.textEdit.insertAsSnippet,m;u?m=ya.replace(d,new Yn(c)):m=Wn.replace(d,c);let g=i.get(l);g?g.push(m):i.set(l,[m])}else o.renameFile(b.revive(s.oldResource),b.revive(s.newResource),s.options);for(let[s,a]of i)o.set(s,a);return o}e.to=t})(mo||={});var Ur;(n=>{let r=Object.create(null);r[0]=0,r[1]=1,r[2]=2,r[3]=3,r[4]=4,r[5]=5,r[6]=6,r[7]=7,r[8]=8,r[9]=9,r[10]=10,r[11]=11,r[12]=12,r[13]=13,r[14]=14,r[15]=15,r[16]=16,r[17]=17,r[18]=18,r[19]=19,r[20]=20,r[21]=21,r[22]=22,r[23]=23,r[24]=24,r[25]=25;function t(o){return typeof r[o]=="number"?r[o]:6}n.from=t;function e(o){for(let i in r)if(r[i]===o)return Number(i);return 6}n.to=e})(Ur||={});var Na;(e=>{function r(n){if(n===1)return 1}e.from=r;function t(n){if(n===1)return 1}e.to=t})(Na||={});var cd;(e=>{function r(n){return{name:n.name,kind:Ur.from(n.kind),tags:n.tags&&n.tags.map(Na.from),containerName:n.containerName,location:po.from(n.location)}}e.from=r;function t(n){let o=new Or(n.name,Ur.to(n.kind),n.containerName,po.to(n.location));return o.tags=n.tags&&n.tags.map(Na.to),o}e.to=t})(cd||={});var Y1;(e=>{function r(n){let o={name:n.name||"!!MISSING: name!!",detail:n.detail,range:j.from(n.range),selectionRange:j.from(n.selectionRange),kind:Ur.from(n.kind),tags:n.tags?.map(Na.from)??[]};return n.children&&(o.children=n.children.map(r)),o}e.from=r;function t(n){let o=new Nr(n.name,n.detail,Ur.to(n.kind),j.to(n.range),j.to(n.selectionRange));return tl(n.tags)&&(o.tags=n.tags.map(Na.to)),n.children&&(o.children=n.children.map(t)),o}e.to=t})(Y1||={});var Ha;(e=>{function r(n){let o=new Jl(Ur.to(n.kind),n.name,n.detail||"",b.revive(n.uri),j.to(n.range),j.to(n.selectionRange));return o._sessionId=n._sessionId,o._itemId=n._itemId,o}e.to=r;function t(n,o,i){if(o=o??n._sessionId,i=i??n._itemId,o===void 0||i===void 0)throw new Error("invalid item");return{_sessionId:o,_itemId:i,name:n.name,detail:n.detail,kind:Ur.from(n.kind),uri:n.uri,range:j.from(n.range),selectionRange:j.from(n.selectionRange),tags:n.tags?.map(Na.from)}}e.from=t})(Ha||={});var X1;(t=>{function r(e){return new lm(Ha.to(e.from),e.fromRanges.map(n=>j.to(n)))}t.to=r})(X1||={});var Z1;(t=>{function r(e){return new dm(Ha.to(e.to),e.fromRanges.map(n=>j.to(n)))}t.to=r})(Z1||={});var po;(e=>{function r(n){return{range:n.range&&j.from(n.range),uri:n.uri}}e.from=r;function t(n){return new en(b.revive(n.uri),j.to(n.range))}e.to=t})(po||={});var Bm;(e=>{function r(n){let o=n,i=n;return{originSelectionRange:o.originSelectionRange?j.from(o.originSelectionRange):void 0,uri:o.targetUri?o.targetUri:i.uri,range:j.from(o.targetRange?o.targetRange:i.range),targetSelectionRange:o.targetSelectionRange?j.from(o.targetSelectionRange):void 0}}e.from=r;function t(n){return{targetUri:b.revive(n.uri),targetRange:j.to(n.range),targetSelectionRange:n.targetSelectionRange?j.to(n.targetSelectionRange):void 0,originSelectionRange:n.originSelectionRange?j.to(n.originSelectionRange):void 0}}e.to=t})(Bm||={});var $m;(e=>{function r(n){return{range:j.from(n.range),contents:ue.fromMany(n.contents),canIncreaseVerbosity:n.canIncreaseVerbosity,canDecreaseVerbosity:n.canDecreaseVerbosity}}e.from=r;function t(n){let o=n.contents.map(ue.to),i=j.to(n.range),s=n.canIncreaseVerbosity,a=n.canDecreaseVerbosity;return new Ll(o,i,s,a)}e.to=t})($m||={});var eM;(e=>{function r(n){return{range:j.from(n.range),expression:n.expression}}e.from=r;function t(n){return new zl(j.to(n.range),n.expression)}e.to=t})(eM||={});var Zv;(e=>{function r(n){if(n instanceof ql)return{type:"text",range:j.from(n.range),text:n.text};if(n instanceof Kl)return{type:"variable",range:j.from(n.range),variableName:n.variableName,caseSensitiveLookup:n.caseSensitiveLookup};if(n instanceof jl)return{type:"expression",range:j.from(n.range),expression:n.expression};throw new Error("Unknown 'InlineValue' type")}e.from=r;function t(n){switch(n.type){case"text":return{range:j.to(n.range),text:n.text};case"variable":return{range:j.to(n.range),variableName:n.variableName,caseSensitiveLookup:n.caseSensitiveLookup};case"expression":return{range:j.to(n.range),expression:n.expression}}}e.to=t})(Zv||={});var eb;(e=>{function r(n){return{frameId:n.frameId,stoppedLocation:j.from(n.stoppedLocation)}}e.from=r;function t(n){return new im(n.frameId,j.to(n.stoppedLocation))}e.to=t})(eb||={});var ou;(e=>{function r(n){return{range:j.from(n.range),kind:n.kind}}e.from=r;function t(n){return new Ol(j.to(n.range),n.kind)}e.to=t})(ou||={});var tM;(e=>{function r(n){return{uri:n.uri,highlights:n.highlights.map(ou.from)}}e.from=r;function t(n){return new Nl(b.revive(n.uri),n.highlights.map(ou.to))}e.to=t})(tM||={});var u4;(t=>{function r(e){switch(e){case 1:return 1;case 2:return 2;case 0:default:return 0}}t.to=r})(u4||={});var nM;(t=>{function r(e){return{triggerKind:u4.to(e.triggerKind),triggerCharacter:e.triggerCharacter}}t.to=r})(nM||={});var nT;(e=>{function r(n){if(n===1)return 1}e.from=r;function t(n){if(n===1)return 1}e.to=t})(nT||={});var oM;(t=>{function r(e,n,o){return"icon"in e&&"command"in e?{command:n.toInternal(e.command,o),icon:Hi.fromThemeIcon(e.icon)}:{command:n.toInternal(e,o)}}t.from=r})(oM||={});var oT;(o=>{let r=new Map([[1,0],[2,1],[3,2],[4,3],[5,4],[6,5],[7,7],[21,6],[8,8],[9,9],[10,12],[11,13],[20,14],[12,15],[19,16],[13,17],[14,28],[0,18],[15,19],[16,20],[17,21],[18,23],[22,10],[23,11],[24,24],[26,26],[25,25]]);function t(i){return r.get(i)??9}o.from=t;let e=new Map([[0,1],[1,2],[2,3],[3,4],[4,5],[5,6],[7,7],[6,21],[8,8],[9,9],[12,10],[13,11],[14,20],[15,12],[16,19],[17,13],[28,14],[18,0],[19,15],[20,16],[21,17],[23,18],[10,22],[11,23],[24,24],[25,25],[26,26]]);function n(i){return e.get(i)??9}o.to=n})(oT||={});var rM;(t=>{function r(e,n){let o=new Wl(e.label);return o.insertText=e.insertText,o.kind=oT.to(e.kind),o.tags=e.tags?.map(nT.to),o.detail=e.detail,o.documentation=Uo(e.documentation)?ue.to(e.documentation):e.documentation,o.sortText=e.sortText,o.filterText=e.filterText,o.preselect=e.preselect,o.commitCharacters=e.commitCharacters,We.isIRange(e.range)?o.range=j.to(e.range):typeof e.range=="object"&&(o.range={inserting:j.to(e.range.insert),replacing:j.to(e.range.replace)}),o.keepWhitespace=typeof e.insertTextRules>"u"?!1:!!(e.insertTextRules&1),typeof e.insertTextRules<"u"&&e.insertTextRules&4?o.insertText=new Yn(e.insertText):(o.insertText=e.insertText,o.textEdit=o.range instanceof fe?new Wn(o.range,o.insertText):void 0),e.additionalTextEdits&&e.additionalTextEdits.length>0&&(o.additionalTextEdits=e.additionalTextEdits.map(i=>Pn.to(i))),o.command=n&&e.command?n.fromInternal(e.command):void 0,o}t.to=r})(rM||={});var z1;(e=>{function r(n){if(typeof n.label!="string"&&!Array.isArray(n.label))throw new TypeError("Invalid label");return{label:n.label,documentation:ue.fromStrict(n.documentation)}}e.from=r;function t(n){return{label:n.label,documentation:Uo(n.documentation)?ue.to(n.documentation):n.documentation}}e.to=t})(z1||={});var q1;(e=>{function r(n){return{label:n.label,documentation:ue.fromStrict(n.documentation),parameters:Array.isArray(n.parameters)?n.parameters.map(z1.from):[],activeParameter:n.activeParameter}}e.from=r;function t(n){return{label:n.label,documentation:Uo(n.documentation)?ue.to(n.documentation):n.documentation,parameters:Array.isArray(n.parameters)?n.parameters.map(z1.to):[],activeParameter:n.activeParameter}}e.to=t})(q1||={});var zm;(e=>{function r(n){return{activeSignature:n.activeSignature,activeParameter:n.activeParameter,signatures:Array.isArray(n.signatures)?n.signatures.map(q1.from):[]}}e.from=r;function t(n){return{activeSignature:n.activeSignature,activeParameter:n.activeParameter,signatures:Array.isArray(n.signatures)?n.signatures.map(q1.to):[]}}e.to=t})(zm||={});var iM;(t=>{function r(e,n){let o=new Hl(ct.to(n.position),typeof n.label=="string"?n.label:n.label.map(p4.to.bind(void 0,e)),n.kind&&rT.to(n.kind));return o.textEdits=n.textEdits&&n.textEdits.map(Pn.to),o.tooltip=Uo(n.tooltip)?ue.to(n.tooltip):n.tooltip,o.paddingLeft=n.paddingLeft,o.paddingRight=n.paddingRight,o}t.to=r})(iM||={});var p4;(t=>{function r(e,n){let o=new Fl(n.label);return o.tooltip=Uo(n.tooltip)?ue.to(n.tooltip):n.tooltip,MR.is(n.command)&&(o.command=e.fromInternal(n.command)),n.location&&(o.location=po.to(n.location)),o}t.to=r})(p4||={});var rT;(e=>{function r(n){return n}e.from=r;function t(n){return n}e.to=t})(rT||={});var Wa;(e=>{function r(n){return{range:j.from(n.range),url:n.target,tooltip:n.tooltip}}e.from=r;function t(n){let o;if(n.url)try{o=typeof n.url=="string"?b.parse(n.url,!0):b.revive(n.url)}catch{}let i=new Vl(j.to(n.range),o);return i.tooltip=n.tooltip,i}e.to=t})(Wa||={});var tb;(e=>{function r(n){let o=new $l(n.label);return n.textEdit&&(o.textEdit=Pn.to(n.textEdit)),n.additionalTextEdits&&(o.additionalTextEdits=n.additionalTextEdits.map(i=>Pn.to(i))),o}e.to=r;function t(n){return{label:n.label,textEdit:n.textEdit?Pn.from(n.textEdit):void 0,additionalTextEdits:n.additionalTextEdits?n.additionalTextEdits.map(o=>Pn.from(o)):void 0}}e.from=t})(tb||={});var lu;(e=>{function r(n){return new _i(n[0],n[1],n[2],n[3])}e.to=r;function t(n){return[n.red,n.green,n.blue,n.alpha]}e.from=t})(lu||={});var sM;(e=>{function r(n){return{range:j.from(n.range)}}e.from=r;function t(n){return new Ss(j.to(n.range))}e.to=t})(sM||={});var nb;(t=>{function r(e){switch(e){case 2:return 2;case 1:return 1;case 3:case 4:return 3}}t.to=r})(nb||={});var du;(e=>{function r(n){switch(n){case 0:return 0;case 2:return 2;case 3:return 3;case 1:default:return 1}}e.from=r;function t(n){switch(n){case 0:return 0;case 2:return 2;case 3:return 3;case 1:default:return 1}}e.to=t})(du||={});var ru;(e=>{function r(n){if(n===2)return 1;if(n===1)return 0}e.from=r;function t(n){if(n===1)return 2;if(n===0)return 1}e.to=t})(ru||={});var iT;(t=>{function r(e){if(typeof e=="object")return e.viewId;switch(e){case 1:return 3;case 10:return 10;case 15:return 15}throw new Error("Unknown 'ProgressLocation'")}t.from=r})(iT||={});var ob;(e=>{function r(n){let o={start:n.start+1,end:n.end+1};return n.kind&&(o.kind=K1.from(n.kind)),o}e.from=r;function t(n){let o={start:n.start-1,end:n.end-1};return n.kind&&(o.kind=K1.to(n.kind)),o}e.to=t})(ob||={});var K1;(e=>{function r(n){if(n)switch(n){case 1:return pa.Comment;case 2:return pa.Imports;case 3:return pa.Region}}e.from=r;function t(n){if(n)switch(n.value){case pa.Comment.value:return 1;case pa.Imports.value:return 2;case pa.Region.value:return 3}}e.to=t})(K1||={});var rb;(t=>{function r(e){if(e)return{pinned:typeof e.preview=="boolean"?!e.preview:void 0,inactive:e.background,preserveFocus:e.preserveFocus,selection:typeof e.selection=="object"?j.from(e.selection):void 0,override:typeof e.override=="boolean"?WR.id:void 0}}t.from=r})(rb||={});var $o;(o=>{function r(i){return i instanceof Es?i.toJSON():typeof i=="string"?i:t(i)||e(i)?new Es(i.baseUri??i.base,i.pattern).toJSON():i}o.from=r;function t(i){let s=i;return s?b.isUri(s.baseUri)&&typeof s.pattern=="string":!1}function e(i){let s=i;return s?typeof s.base=="string"&&typeof s.pattern=="string":!1}function n(i){return typeof i=="string"?i:new Es(b.revive(i.baseUri),i.pattern)}o.to=n})($o||={});var aM;(t=>{function r(e){if(e){if(Array.isArray(e))return e.map(r);if(typeof e=="string")return e;{let n=e;return{language:n.language,scheme:n.scheme,pattern:$o.from(n.pattern)??void 0,exclusive:n.exclusive,notebookType:n.notebookType}}}else return}t.from=r})(aM||={});var Fr;(e=>{function r(n){return{start:n.start,end:n.end}}e.from=r;function t(n){return new oo(n.start,n.end)}e.to=t})(Fr||={});var Wm;(e=>{function r(n){return{timing:typeof n.runStartTime=="number"&&typeof n.runEndTime=="number"?{startTime:n.runStartTime,endTime:n.runEndTime}:void 0,executionOrder:n.executionOrder,success:n.lastRunSuccess}}e.to=r;function t(n){return{lastRunSuccess:n.success,runStartTime:n.timing?.startTime,runEndTime:n.timing?.endTime,executionOrder:n.executionOrder}}e.from=t})(Wm||={});var Kv;(e=>{function r(n){switch(n){case 1:return 1;case 2:default:return 2}}e.from=r;function t(n){switch(n){case 1:return 1;case 2:default:return 2}}e.to=t})(Kv||={});var ud;(e=>{function r(n){let o={metadata:n.metadata??Object.create(null),cells:[]};for(let i of n.cells)bs.validate(i),o.cells.push(jv.from(i));return o}e.from=r;function t(n){let o=new Lc(n.cells.map(jv.to));return tp(n.metadata)||(o.metadata=n.metadata),o}e.to=t})(ud||={});var jv;(e=>{function r(n){return{cellKind:Kv.from(n.kind),language:n.languageId,mime:n.mime,source:n.value,metadata:n.metadata,internalMetadata:Wm.from(n.executionSummary??{}),outputs:n.outputs?n.outputs.map(Ua.from):[]}}e.from=r;function t(n){return new bs(Kv.to(n.cellKind),n.source,n.language,n.mime,n.outputs?n.outputs.map(Ua.to):void 0,n.metadata,n.internalMetadata?Wm.to(n.internalMetadata):void 0)}e.to=t})(jv||={});var iu;(e=>{function r(n){return{mime:n.mime,valueBytes:H.wrap(n.data)}}e.from=r;function t(n){return new Oc(n.valueBytes.buffer,n.mime)}e.to=t})(iu||={});var Ua;(e=>{function r(n){return{outputId:n.id,items:n.items.map(iu.from),metadata:n.metadata}}e.from=r;function t(n){let o=n.items.map(iu.to);return new ys(o,n.outputId,n.metadata)}e.to=t})(Ua||={});var ib;(n=>{function r(o){return e(o)?{include:$o.from(o.include)??void 0,exclude:$o.from(o.exclude)??void 0}:$o.from(o)??void 0}n.from=r;function t(o){return e(o)?{include:$o.to(o.include),exclude:$o.to(o.exclude)}:$o.to(o)}n.to=t;function e(o){let i=o;return i?!Ot(i.include)&&!Ot(i.exclude):!1}})(ib||={});var lM;(t=>{function r(e,n,o){let i=typeof e.command=="string"?{title:"",command:e.command}:e.command;return{alignment:e.alignment===1?1:2,command:n.toInternal(i,o),text:e.text,tooltip:e.tooltip,accessibilityInformation:e.accessibilityInformation,priority:e.priority}}t.from=r})(lM||={});var dM;(t=>{function r(e,n,o){let i=typeof e.command=="string"?{title:"",command:e.command}:e.command;return{command:n.toInternal(i,o),label:e.label,description:e.description,detail:e.detail,documentation:e.documentation}}t.from=r})(dM||={});var cM;(t=>{function r(e){return{transientOutputs:e?.transientOutputs??!1,transientCellMetadata:e?.transientCellMetadata??{},transientDocumentMetadata:e?.transientDocumentMetadata??{},cellContentMetadata:e?.cellContentMetadata??{}}}t.from=r})(cM||={});var sT;(e=>{function r(n){return{uri:n.uri,provides:n.provides}}e.from=r;function t(n){return new mm(b.revive(n.uri),n.provides)}e.to=t})(sT||={});var qm;(e=>{function r(n){return{message:ue.fromStrict(n.message)||"",type:0,expected:n.expectedOutput,actual:n.actualOutput,contextValue:n.contextValue,location:n.location&&{range:j.from(n.location.range),uri:n.location.uri},stackTrace:n.stackTrace?.map(o=>({label:o.label,position:o.position&&ct.from(o.position),uri:o.uri&&b.revive(o.uri).toJSON()}))}}e.from=r;function t(n){let o=new ks(typeof n.message=="string"?n.message:ue.to(n.message));return o.actualOutput=n.actual,o.expectedOutput=n.expected,o.contextValue=n.contextValue,o.location=n.location?po.to(n.location):void 0,o}e.to=t})(qm||={});var ii;(e=>(e.namespace=Gp,e.denamespace=gS))(ii||={});var uM;(t=>{function r(e){return{controllerId:e.controllerId,profileId:e.profileId,group:Km.from(e.kind)}}t.from=r})(uM||={});var Km;(e=>{let r={3:8,2:4,1:2};function t(n){return r.hasOwnProperty(n)?r[n]:2}e.from=t})(Km||={});var Ns;(e=>{function r(n){let o=Qp(n).controllerId;return{extId:Ze.fromExtHostTestItem(n,o).toString(),label:n.label,uri:b.revive(n.uri),busy:n.busy,tags:n.tags.map(i=>ii.namespace(o,i.id)),range:We.lift(j.from(n.range)),description:n.description||null,sortText:n.sortText||null,error:n.error&&ue.fromStrict(n.error)||null}}e.from=r;function t(n){return{parent:void 0,error:void 0,id:Ze.fromString(n.extId).localId,label:n.label,uri:b.revive(n.uri),tags:(n.tags||[]).map(o=>{let{tagId:i}=ii.denamespace(o);return new Ta(i)}),children:{add:()=>{},delete:()=>{},forEach:()=>{},*[Symbol.iterator](){},get:()=>{},replace:()=>{},size:0},range:j.to(n.range||void 0),canResolveChildren:!1,busy:n.busy,description:n.description||void 0,sortText:n.sortText||void 0}}e.toPlain=t})(Ns||={});(e=>{function r(n){return{id:n.id}}e.from=r;function t(n){return new Ta(n.id)}e.to=t})(ii||={});var pM;(e=>{let r=(n,o)=>{let i=n.value;if(!i)return;let s={...Ns.toPlain(i.item),parent:o,taskStates:i.tasks.map(a=>({state:a.state,duration:a.duration,messages:a.messages.filter(l=>l.type===0).map(qm.to)})),children:[]};if(n.children)for(let a of n.children.values()){let l=r(a,s);l&&s.children.push(l)}return s};function t(n){let o=new hx;for(let a of n.items)o.insert(Ze.fromString(a.item.extId).path,a);let i=[o.nodes],s=[];for(;i.length;)for(let a of i.pop())a.value?s.push(a):a.children&&i.push(a.children.values());return{completedAt:n.completedAt,results:s.map(a=>r(a)).filter(vo)}}e.to=t})(pM||={});var sb;(s=>{function r(a){return{covered:a.covered,total:a.total}}function t(a){return"line"in a?ct.from(a):j.from(a)}function e(a){if(a)return"endLineNumber"in a?j.to(a):ct.to(a)}function n(a){if(a.type===1){let l=[];if(a.branches)for(let d of a.branches)l.push({executed:d.count,location:e(d.location),label:d.label});return new fm(a.count,e(a.location),a.branches?.map(d=>new hm(d.count,e(d.location),d.label)))}else return new vm(a.name,a.count,e(a.location))}s.to=n;function o(a){if(typeof a.executed=="number"&&a.executed<0)throw new Error(`Invalid coverage count ${a.executed}`);return"branches"in a?{count:a.executed,location:t(a.location),type:1,branches:a.branches.length?a.branches.map(l=>({count:l.executed,location:l.location&&t(l.location),label:l.label})):void 0}:{type:0,name:a.name,count:a.executed,location:t(a.location)}}s.fromDetails=o;function i(a,l,d){return $v(d.statementCoverage),$v(d.branchCoverage),$v(d.declarationCoverage),{id:l,uri:d.uri,statement:r(d.statementCoverage),branch:d.branchCoverage&&r(d.branchCoverage),declaration:d.declarationCoverage&&r(d.declarationCoverage),testIds:d instanceof Ea&&d.includesTests.length?d.includesTests.map(c=>Ze.fromExtHostTestItem(c,a).toString()):void 0}}s.fromFile=i})(sb||={});var mM;(t=>{function r(e){switch(e){case 1:return 1;case 2:return 2}}t.to=r})(mM||={});var Va;(e=>{function r(n){let o=new Zl(Ur.to(n.kind),n.name,n.detail||"",b.revive(n.uri),j.to(n.range),j.to(n.selectionRange));return o._sessionId=n._sessionId,o._itemId=n._itemId,o}e.to=r;function t(n,o,i){if(o=o??n._sessionId,i=i??n._itemId,o===void 0||i===void 0)throw new Error("invalid item");return{_sessionId:o,_itemId:i,kind:Ur.from(n.kind),name:n.name,detail:n.detail??"",uri:n.uri,range:j.from(n.range),selectionRange:j.from(n.selectionRange),tags:n.tags?.map(Na.from)}}e.from=t})(Va||={});var ab;(t=>{function r(e){if(e)return{value:e.value,tooltip:e.tooltip}}t.from=r})(ab||={});var nu;(o=>{function r(i,s,a){let l=s.fileData;return l?new wS(new kS(l.name,b.revive(l.uri),l.id,el(()=>a(l.id)))):i===Fo.uriList&&s.uriListData?new Yl(n(s.uriListData)):new Yl(s.asString)}o.to=r;async function t(i,s,a=Ae()){let l=await s.asString();if(i===Fo.uriList)return{id:a,asString:l,fileData:void 0,uriListData:e(l)};let d=s.asFile();return{id:a,asString:l,fileData:d?{name:d.name,uri:d.uri,id:d._itemId??d.id}:void 0}}o.from=t;function e(i){return dx.split(i).map(s=>{if(s.startsWith("#"))return s;try{return b.parse(s)}catch{}return s})}function n(i){return dx.create(i.map(s=>typeof s=="string"?s:b.revive(s)))}})(nu||={});var cu;(n=>{function r(o,i){let s=o.items.map(([a,l])=>[a,nu.to(a,l,i)]);return new Zr(s)}n.toDataTransfer=r;async function t(o){return{items:await Promise.all(Array.from(o,async([s,a])=>[s,await nu.from(s,a)]))}}n.from=t;async function e(o){return{items:await Promise.all(Array.from(o,async([s,a])=>[s,await nu.from(s,a,a.id)]))}}n.fromList=e})(cu||={});var aT;(e=>{function r(n,o){return{kind:"reply",agentId:n.participant??o?.agentId??"",subCommand:n.command??o?.command,message:n.prompt,title:n.label}}e.from=r;function t(n){return{prompt:n.message,label:n.title,participant:n.agentId,command:n.subCommand}}e.to=t})(aT||={});var Gv;(e=>{function r(n){switch(n){case 0:return 3;case 1:return 1;case 2:return 2}}e.to=r;function t(n){switch(n){case 3:return 0;case 1:return 1;case 2:return 2}return 1}e.from=t})(Gv||={});var H6;(e=>{function r(n){let o=n.content.map(a=>{if(a.type==="text")return new tn(a.value,a.audience);if(a.type==="tool_result"){let l=tt(a.value.map(d=>d.type==="text"?new tn(d.value,d.audience):d.type==="data"?new Ln(d.data.buffer,d.mimeType):d.type==="prompt_tsx"?new oi(d.value):void 0));return new Os(a.toolCallId,l,a.isError)}else{if(a.type==="image_url")return new Ln(a.value.data.buffer,a.value.mimeType);if(a.type==="data")return new Ln(a.data.buffer,a.mimeType);if(a.type==="tool_use")return new ni(a.toolCallId,a.name,a.parameters)}}).filter(a=>a!==void 0),i=Gv.to(n.role);return new Nm(i,o,n.name)}e.to=r;function t(n){let o=Gv.from(n.role),i=n.name,s=n.content;typeof s=="string"&&(s=[new tn(s)]);let a=s.map(l=>{if(l instanceof Os)return{type:"tool_result",toolCallId:l.callId,value:tt(l.content.map(d=>d instanceof tn?{type:"text",value:d.value,audience:d.audience}:d instanceof oi?{type:"prompt_tsx",value:d.value}:d instanceof Ln?{type:"data",mimeType:d.mimeType,data:H.wrap(d.data),audience:d.audience}:void 0)),isError:l.isError};if(l instanceof Ln)return m4(l)?{type:"image_url",value:{mimeType:l.mimeType,data:H.wrap(l.data)}}:{type:"data",mimeType:l.mimeType,data:H.wrap(l.data),audience:l.audience};if(l instanceof ni)return{type:"tool_use",toolCallId:l.callId,name:l.name,parameters:l.input};if(l instanceof tn)return{type:"text",value:l.value};if(typeof l!="string")throw new Error("Unexpected chat message content type");return{type:"text",value:l}});return{role:o,name:i,content:a}}e.from=t})(H6||={});var lT;(e=>{function r(n){let o=n.content.map(a=>{if(a.type==="text")return new tn(a.value,a.audience);if(a.type==="tool_result"){let l=a.value.map(d=>d.type==="text"?new tn(d.value,d.audience):d.type==="data"?new Ln(d.data.buffer,d.mimeType):new oi(d.value));return new Os(a.toolCallId,l,a.isError)}else return a.type==="image_url"?new Ln(a.value.data.buffer,a.value.mimeType):a.type==="data"?new Ln(a.data.buffer,a.mimeType):a.type==="thinking"?new Ui(a.value,a.id,a.metadata):new ni(a.toolCallId,a.name,a.parameters)}),i=Gv.to(n.role);return new Um(i,o,n.name)}e.to=r;function t(n){let o=Gv.from(n.role),i=n.name,s=n.content;typeof s=="string"&&(s=[new tn(s)]);let a=s.map(l=>{if(l instanceof Os)return{type:"tool_result",toolCallId:l.callId,value:tt(l.content.map(d=>d instanceof tn?{type:"text",value:d.value,audience:d.audience}:d instanceof oi?{type:"prompt_tsx",value:d.value}:d instanceof Ln?{type:"data",mimeType:d.mimeType,data:H.wrap(d.data),audience:d.audience}:void 0)),isError:l.isError};if(l instanceof Ln)return m4(l)?{type:"image_url",value:{mimeType:l.mimeType,data:H.wrap(l.data)}}:{type:"data",mimeType:l.mimeType,data:H.wrap(l.data),audience:l.audience};if(l instanceof ni)return{type:"tool_use",toolCallId:l.callId,name:l.name,parameters:l.input};if(l instanceof tn)return{type:"text",value:l.value};if(l instanceof Ui)return{type:"thinking",value:l.value,id:l.id,metadata:l.metadata};if(typeof l!="string")throw new Error("Unexpected chat message content type llm 2");return{type:"text",value:l}});return{role:o,name:i,content:a}}e.from=t})(lT||={});function m4(r){switch(typeof r.mimeType=="string"?r.mimeType.toLowerCase():""){case"image/png":case"image/jpeg":case"image/jpg":case"image/gif":case"image/webp":case"image/bmp":return!0;default:return!1}}var Qv;(e=>{function r(n){return{kind:"markdownContent",content:ue.from(n.value)}}e.from=r;function t(n){return new ka(ue.to(n.content))}e.to=t})(Qv||={});var dT;(e=>{function r(n){return{kind:"codeblockUri",uri:n.value,isEdit:n.isEdit,undoStopId:n.undoStopId}}e.from=r;function t(n){return new Aa(b.revive(n.uri),n.isEdit,n.undoStopId)}e.to=t})(dT||={});var cT;(e=>{function r(n){return{kind:"markdownVuln",content:ue.from(n.value),vulnerabilities:n.vulnerabilities}}e.from=r;function t(n){return new _s(ue.to(n.content),n.vulnerabilities)}e.to=t})(cT||={});var uT;(t=>{function r(e){return{kind:"confirmation",title:e.title,message:ue.from(e.message),data:e.data,buttons:e.buttons}}t.from=r})(uT||={});var pT;(o=>{function r(i){switch(i){case 1:return"text";case 2:return"singleSelect";case 3:return"multiSelect";default:return"text"}}function t(i){switch(i){case"text":return 1;case"singleSelect":return 2;case"multiSelect":return 3;default:return 1}}function e(i){return{kind:"questionCarousel",questions:i.questions.map(s=>({id:s.id,type:r(s.type),title:s.title,message:s.message?ue.from(s.message):void 0,options:s.options?.map(a=>({id:a.id,label:a.label,value:String(a.value)})),defaultValue:s.defaultValue,allowFreeformInput:s.allowFreeformInput})),allowSkip:i.allowSkip}}o.from=e;function n(i){let s=i.questions.map(a=>new Em(a.id,t(a.type),a.title,{message:a.message?typeof a.message=="string"?new Zt(a.message):ue.to(a.message):void 0,options:a.options?.map(l=>({id:l.id,label:l.label,value:l.value})),defaultValue:a.defaultValue,allowFreeformInput:a.allowFreeformInput}));return new As(s,i.allowSkip)}o.to=n})(pT||={});var Jv;(e=>{function r(n){let{value:o,baseUri:i}=n;function s(a,l){return a.map(d=>{let c=b.joinPath(l,d.name);return{label:d.name,uri:c,children:d.children&&s(d.children,c)}})}return{kind:"treeData",treeData:{label:Tt(i),uri:i,children:s(o,i)}}}e.from=r;function t(n){let o=ht(n.treeData);function i(l){return l.map(d=>({name:d.label,children:d.children&&i(d.children)}))}let s=o.uri,a=o.children?i(o.children):[];return new _a(a,s)}e.to=t})(Jv||={});var g4;(e=>{function r(n){return{kind:"multiDiffData",multiDiffData:{title:n.title,resources:n.value.map(o=>({originalUri:o.originalUri,modifiedUri:o.modifiedUri,goToFileUri:o.goToFileUri,added:o.added,removed:o.removed}))},readOnly:n.readOnly}}e.from=r;function t(n){let o=n.multiDiffData.resources.map(i=>({originalUri:i.originalUri?b.revive(i.originalUri):void 0,modifiedUri:i.modifiedUri?b.revive(i.modifiedUri):void 0,goToFileUri:i.goToFileUri?b.revive(i.goToFileUri):void 0,added:i.added,removed:i.removed}));return new jc(o,n.multiDiffData.title,n.readOnly)}e.to=t})(g4||={});var Vm;(e=>{function r(n){let o=s=>b.isUri(s),i=s=>"name"in s;return{kind:"inlineReference",name:n.title,inlineReference:o(n.value)?n.value:i(n.value)?cd.from(n.value):ri.from(n.value)}}e.from=r;function t(n){let o=ht(n);return new Ds(b.isUri(o.inlineReference)?o.inlineReference:"location"in o.inlineReference?cd.to(o.inlineReference):ri.to(o.inlineReference),n.name)}e.to=t})(Vm||={});var lb;(e=>{function r(n){return{kind:"progressMessage",content:ue.from(n.value)}}e.from=r;function t(n){return new Qc(n.content.value)}e.to=t})(lb||={});var db;(e=>{function r(n){return{kind:"thinking",value:n.value,id:n.id,metadata:n.metadata}}e.from=r;function t(n){return new Ni(n.value??"",n.id,n.metadata)}e.to=t})(db||={});var mT;(e=>{function r(n){return{kind:"hook",hookType:n.hookType,stopReason:n.stopReason,systemMessage:n.systemMessage,metadata:n.metadata}}e.from=r;function t(n){return new Da(n.hookType,n.stopReason,n.systemMessage,n.metadata)}e.to=t})(mT||={});var cb;(e=>{function r(n){return{kind:"warning",content:ue.from(n.value)}}e.from=r;function t(n){return new Rs(n.content.value)}e.to=t})(cb||={});var f4;(t=>{function r(e){return{kind:"extensions",extensions:e.extensions}}t.from=r})(f4||={});var h4;(t=>{function r(e,n,o){let i;if(e.command)i=n.toInternal(e.command,o);else{if(!e.uri)throw new Error("Pull request part must have a command if URI is provided");i={title:"Open Pull Request",id:"vscode.open",arguments:[e.uri]}}return{kind:"pullRequest",author:e.author,title:e.title,description:e.description,uri:e.uri,linkTag:e.linkTag,command:i}}t.from=r})(h4||={});var v4;(e=>{function r(n){return{kind:"move",uri:n.uri,range:j.from(n.range)}}e.from=r;function t(n){return new La(b.revive(n.uri),j.to(n.range))}e.to=t})(v4||={});var b4;(l=>{function r(d){let c,u;d.toolSpecificData&&t(d.toolSpecificData)?(c=e(d.toolSpecificData,d.isError),u=void 0):u=d.toolSpecificData?n(d.toolSpecificData):void 0;let m=d.presentation==="hidden"?"hidden":d.presentation==="hiddenAfterComplete"?"hiddenAfterComplete":void 0;return d.enablePartialUpdate?{kind:"externalToolInvocationUpdate",toolCallId:d.toolCallId,toolName:d.toolName,isComplete:!!d.isComplete,invocationMessage:d.invocationMessage?ue.from(d.invocationMessage):void 0,pastTenseMessage:d.pastTenseMessage?ue.from(d.pastTenseMessage):void 0,toolSpecificData:u,subagentInvocationId:d.subAgentInvocationId,resultDetails:c}:{kind:"toolInvocationSerialized",toolCallId:d.toolCallId,toolId:d.toolName,invocationMessage:d.invocationMessage?ue.from(d.invocationMessage):d.toolName,originMessage:d.originMessage?ue.from(d.originMessage):void 0,pastTenseMessage:d.pastTenseMessage?ue.from(d.pastTenseMessage):void 0,isConfirmed:d.isConfirmed,isComplete:!0,source:kn.External,toolSpecificData:u,resultDetails:c,presentation:m,subAgentInvocationId:d.subAgentInvocationId}}l.from=r;function t(d){return d!==null&&typeof d=="object"&&"input"in d&&typeof d.input=="string"&&"output"in d&&Array.isArray(d.output)}function e(d,c){return{input:d.input,output:d.output.map(u=>{let m=u.mimeType.startsWith("text/");return{type:"embed",mimeType:u.mimeType,value:m?H.wrap(u.data).toString():Ao(H.wrap(u.data)),isText:m}}),isError:c??!1}}function n(d){return"command"in d&&"language"in d?{kind:"terminal",command:d.command,language:d.language}:"commandLine"in d&&"language"in d?{kind:"terminal",presentationOverrides:d.presentationOverrides&&typeof d.presentationOverrides.commandLine=="string"?{commandLine:d.presentationOverrides.commandLine,language:d.presentationOverrides.language}:void 0,commandLine:d.commandLine,language:d.language,terminalCommandOutput:typeof d.output?.text=="string"?{text:d.output.text}:void 0,terminalCommandState:d.state?{exitCode:d.state.exitCode,duration:d.state.duration}:void 0}:"todoList"in d&&Array.isArray(d.todoList)?{kind:"todoList",todoList:d.todoList.map(c=>({id:String(c.id),title:c.title,status:o(c.status)}))}:"input"in d&&"output"in d&&!Array.isArray(d.output)?{kind:"simpleToolInvocation",input:typeof d.input=="string"?d.input:"",output:typeof d.output=="string"?d.output:""}:d&&"values"in d&&Array.isArray(d.values)?{kind:"resources",values:d.values.map(c=>c instanceof en?ri.from(c):b.revive(c))}:d instanceof Tm?{kind:"subagent",description:d.description,agentName:d.agentName,prompt:d.prompt,result:d.result}:d}function o(d){switch(d){case 1:return"not-started";case 2:return"in-progress";case 3:return"completed";default:return"not-started"}}function i(d){switch(d){case"not-started":return 1;case"in-progress":return 2;case"completed":return 3;default:return 1}}function s(d){let c=new Jc(d.toolId||d.toolName,d.toolCallId,d.errorMessage);return d.invocationMessage&&(c.invocationMessage=d.invocationMessage),d.originMessage&&(c.originMessage=d.originMessage),d.pastTenseMessage&&(c.pastTenseMessage=d.pastTenseMessage),d.isConfirmed!==void 0&&(c.isConfirmed=d.isConfirmed),d.isComplete!==void 0&&(c.isComplete=d.isComplete),d.toolSpecificData&&(c.toolSpecificData=a(d.toolSpecificData)),c.subAgentInvocationId=d.subAgentInvocationId,c.subAgentName=d.subAgentName,c}l.to=s;function a(d){if(d.kind==="terminal")if(d.commandLine){let c={commandLine:d.commandLine,language:d.language};return d.terminalCommandOutput&&(c.output={text:d.terminalCommandOutput.text,truncated:d.terminalCommandOutput.truncated,lineCount:d.terminalCommandOutput.lineCount}),d.terminalCommandState&&(c.state={exitCode:d.terminalCommandState.exitCode,duration:d.terminalCommandState.duration}),c}else return{command:d.command,language:d.language};else{if(d.kind==="terminal2")return{commandLine:d.commandLine,language:d.language};if(d.kind==="todoList")return{todoList:d.todoList.map((c,u)=>{let m=Number(c.id);return{id:Number.isFinite(m)?m:u,title:c.title,status:i(c.status)}})}}return d}})(b4||={});var gT;(t=>{function r(e){return{kind:"progressTask",content:ue.from(e.value)}}t.from=r})(gT||={});var gM;(t=>{function r(e){return{kind:"progressTaskResult",content:typeof e=="string"?ue.from(e):void 0}}t.from=r})(gM||={});var Yv;(e=>{function r(n,o,i){return{kind:"command",command:o.toInternal(n.value,i)??{command:n.value.command,title:n.value.title}}}e.from=r;function t(n,o){return new Ra(o.fromInternal(n.command)??{command:n.command.id,title:n.command.title})}e.to=t})(Yv||={});var fT;(e=>{function r(n){return{kind:"textEdit",uri:n.uri,edits:n.edits.map(o=>Pn.from(o)),done:n.isDone}}e.from=r;function t(n){let o=new Ms(b.revive(n.uri),n.edits.map(i=>Pn.to(i)));return o.isDone=n.done,o}e.to=t})(fT||={});var hT;(t=>{function r(e){return e.newCellMetadata?{editType:3,index:e.range.start,metadata:e.newCellMetadata}:e.newNotebookMetadata?{editType:5,metadata:e.newNotebookMetadata}:{editType:1,index:e.range.start,count:e.range.end-e.range.start,cells:e.newCells.map(jv.from)}}t.from=r})(hT||={});var vT;(t=>{function r(e){return{kind:"notebookEdit",uri:e.uri,edits:e.edits.map(hT.from),done:e.isDone}}t.from=r})(vT||={});var bT;(t=>{function r(e){return{kind:"workspaceEdit",edits:e.edits.map(n=>({oldResource:n.oldResource,newResource:n.newResource}))}}t.from=r})(bT||={});var su;(e=>{function r(n){let o=ut.isThemeIcon(n.iconPath)?n.iconPath:b.isUri(n.iconPath)?{light:b.revive(n.iconPath)}:n.iconPath&&"light"in n.iconPath&&"dark"in n.iconPath&&b.isUri(n.iconPath.light)&&b.isUri(n.iconPath.dark)?{light:b.revive(n.iconPath.light),dark:b.revive(n.iconPath.dark)}:void 0;return typeof n.value=="object"&&"variableName"in n.value?{kind:"reference",reference:{variableName:n.value.variableName,value:b.isUri(n.value.value)||!n.value.value?n.value.value:ri.from(n.value.value)},iconPath:o,options:n.options}:{kind:"reference",reference:b.isUri(n.value)||typeof n.value=="string"?n.value:ri.from(n.value),iconPath:o,options:n.options}}e.from=r;function t(n){let o=ht(n),i=s=>b.isUri(s)?s:ri.to(s);return new ti(typeof o.reference=="string"?o.reference:"variableName"in o.reference?{variableName:o.reference.variableName,value:o.reference.value&&i(o.reference.value)}:i(o.reference))}e.to=t})(su||={});var yT;(t=>{function r(e){return{kind:"codeCitation",value:e.value,license:e.license,snippet:e.snippet}}t.from=r})(yT||={});var jm;(n=>{function r(o,i,s){return o instanceof ka?Qv.from(o):o instanceof Ds?Vm.from(o):o instanceof ti?su.from(o):o instanceof Qc?lb.from(o):o instanceof Ni?db.from(o):o instanceof Da?mT.from(o):o instanceof _a?Jv.from(o):o instanceof jc?g4.from(o):o instanceof Ra?Yv.from(o,i,s):o instanceof Ms?fT.from(o):o instanceof Oa?vT.from(o):o instanceof _s?cT.from(o):o instanceof Aa?dT.from(o):o instanceof Rs?cb.from(o):o instanceof Pa?uT.from(o):o instanceof As?pT.from(o):o instanceof Ma?yT.from(o):o instanceof La?v4.from(o):o instanceof id?f4.from(o):o instanceof sd?h4.from(o,i,s):o instanceof Jc?b4.from(o):o instanceof ad?bT.from(o):{kind:"markdownContent",content:ue.from("")}}n.from=r;function t(o,i){switch(o.kind){case"reference":return su.to(o);case"markdownContent":case"inlineReference":case"progressMessage":case"treeData":case"command":return e(o,i)}}n.to=t;function e(o,i){switch(o.kind){case"markdownContent":return Qv.to(o);case"inlineReference":return Vm.to(o);case"progressMessage":return;case"treeData":return Jv.to(o);case"command":return Yv.to(o,i)}}n.toContent=e})(jm||={});var Gm;(t=>{function r(e,n,o,i,s,a,l,d){let c=[],u=[];for(let h of e.variables.variables)h.kind==="tool"?c.push(h):h.kind==="toolset"?c.push(...h.value):u.push(h);let m=Qr.parseLocalSessionId(e.sessionResource)??e.sessionResource.toString(),g={id:e.requestId,prompt:e.message,command:e.command,attempt:e.attempt??0,enableCommandDetection:e.enableCommandDetection??!0,isParticipantDetected:e.isParticipantDetected??!1,sessionId:m,sessionResource:e.sessionResource,references:u.map(h=>xT.to(h,s,d)).filter(vo),toolReferences:c.map(au.to),location:Qm.to(e.location),acceptedConfirmationData:e.acceptedConfirmationData,rejectedConfirmationData:e.rejectedConfirmationData,location2:n,toolInvocationToken:Object.freeze({sessionResource:e.sessionResource}),tools:a,model:o,modelConfiguration:i,editedFileEvents:e.editedFileEvents,modeInstructions:e.modeInstructions?.content,modeInstructions2:uu.to(e.modeInstructions),permissionLevel:e.permissionLevel,subAgentInvocationId:e.subAgentInvocationId,subAgentName:e.subAgentName,parentRequestId:e.parentRequestId,hasHooksEnabled:e.hasHooksEnabled??!1,hooks:e.hooks?x4.to(e.hooks):void 0};return He(l,"chatParticipantPrivate")||(delete g.id,delete g.attempt,delete g.enableCommandDetection,delete g.isParticipantDetected,delete g.location,delete g.location2,delete g.editedFileEvents,delete g.sessionId,delete g.subAgentInvocationId,delete g.subAgentName,delete g.parentRequestId,delete g.hasHooksEnabled,delete g.hooks),He(l,"chatParticipantAdditions")||(delete g.acceptedConfirmationData,delete g.rejectedConfirmationData,delete g.tools),g}t.to=r})(Gm||={});var Qm;(e=>{function r(n){switch(n){case"notebook":return 3;case"terminal":return 2;case"panel":return 1;case"editor":return 4}}e.to=r;function t(n){switch(n){case 3:return"notebook";case 2:return"terminal";case 1:return"panel";case 4:return"editor"}}e.from=t})(Qm||={});var IT;(t=>{function r(e){return e.id}t.from=r})(IT||={});var xT;(t=>{function r(e,n,o){let i=e.value;if(!i){let a;try{a=JSON.stringify(e)}catch{a=`kind=${e.kind}, id=${e.id}, name=${e.name}`}o.error(`[ChatPromptReference] Ignoring invalid reference in variable: ${a}`);return}if(cl(i))i=b.revive(i);else if(i&&typeof i=="object"&&"uri"in i&&"range"in i&&cl(i.uri))i=ri.to(ht(i));else if(nH(e)){let a=e.references?.[0]?.reference;i=new Om(e.mimeType??"image/png",()=>Promise.resolve(new Uint8Array(Object.values(e.value))),a&&b.isUri(a)?a:void 0)}else if(e.kind==="diagnostic"){let a=e.filterSeverity&&eT.to(e.filterSeverity),l=e.filterUri&&b.revive(e.filterUri).toString();i=new ld(n.map(([d,c])=>e.filterUri&&d.toString()!==l?[d,[]]:[d,c.filter(u=>!(a&&u.severity>a||e.filterRange&&!We.areIntersectingOrTouching(e.filterRange,j.from(u.range))))]).filter(([,d])=>d.length>0))}let s;return(av(e)||oH(e))&&e.toolReferences&&(s=fM.to(e.toolReferences)),{id:e.id,name:e.name,range:e.range&&[e.range.start,e.range.endExclusive],toolReferences:s,value:i,modelDescription:e.modelDescription}}t.to=r})(xT||={});var au;(t=>{function r(e){if(e.value)throw new Error("Invalid tool reference");return{name:e.id,range:e.range&&[e.range.start,e.range.endExclusive]}}t.to=r})(au||={});var fM;(t=>{function r(e){let n=[];for(let o of e)if(o.kind==="tool")n.push(au.to(o));else if(o.kind==="toolset")n.push(...o.value.map(au.to));else throw new Error("Invalid tool reference in prompt variables");return n}t.to=r})(fM||={});var uu;(e=>{function r(n){if(n)return{uri:b.revive(n.uri),name:n.name,content:n.content,toolReferences:fM.to(ht(n.toolReferences)),metadata:n.metadata,isBuiltin:n.isBuiltin}}e.to=r;function t(n){if(n)return{uri:n.uri,name:n.name,content:n.content,toolReferences:n.toolReferences?.map(o=>({kind:"tool",id:o.name,name:o.name,value:void 0,range:o.range?{start:o.range[0],endExclusive:o.range[1]}:void 0}))??[],metadata:n.metadata,isBuiltin:n.isBuiltin}}e.from=t})(uu||={});var hM;(t=>{function r(e,n,o){return{id:e.id,label:e.label,fullName:e.fullName,icon:e.icon?.id,value:e.values[0].value,insertText:e.insertText,detail:e.detail,documentation:e.documentation,command:n.toInternal(e.command,o)}}t.from=r})(hM||={});var Jm;(n=>{function r(o){return{errorDetails:o.errorDetails,metadata:e(o.metadata),nextQuestion:o.nextQuestion,details:o.details}}n.to=r;function t(o){return{errorDetails:o.errorDetails,metadata:o.metadata,nextQuestion:o.nextQuestion,details:o.details}}n.from=t;function e(o){return ra(o,i=>{if(i.$mid===20)return new dd(ra(i.content,e));if(i.$mid===21)return new tn(i.value);if(i.$mid===22)return new Ui(i.value,i.id,i.metadata);if(i.$mid===23)return new oi(i.value);if(i.$mid===24)return new Ln(i.data,i.mimeType,i.audience)})}})(Jm||={});var vM;(t=>{function r(e,n,o){if(n.action.kind==="vote")return;let i=Jm.to(e);if(n.action.kind==="command"){let s=n.action.commandButton.command;return{action:{kind:"command",commandButton:{command:o.fromInternal(s)??{command:s.id,title:s.title}}},result:i}}else return n.action.kind==="followUp"?{action:{kind:"followUp",followup:aT.to(n.action.followup)},result:i}:n.action.kind==="inlineChat"?{action:{kind:"editor",accepted:n.action.action==="accepted"},result:i}:n.action.kind==="chatEditingSessionAction"?{action:{kind:"chatEditingSessionAction",outcome:new Map([["accepted",1],["rejected",2],["saved",3]]).get(n.action.outcome)??2,uri:b.revive(n.action.uri),hasRemainingEdits:n.action.hasRemainingEdits},result:i}:n.action.kind==="chatEditingHunkAction"?{action:{kind:"chatEditingHunkAction",outcome:new Map([["accepted",1],["rejected",2]]).get(n.action.outcome)??2,uri:b.revive(n.action.uri),hasRemainingEdits:n.action.hasRemainingEdits,lineCount:n.action.lineCount,linesAdded:n.action.linesAdded,linesRemoved:n.action.linesRemoved},result:i}:{action:n.action,result:i}}t.to=r})(vM||={});var ST;(t=>{function r(e,n,o){return"terminalCommand"in e?{terminalCommand:e.terminalCommand,shouldExecute:e.shouldExecute}:"uri"in e?{uri:e.uri}:n.toInternal(e,o)}t.from=r})(ST||={});var j1;(t=>{function r(e){return{...e,documentation:ue.fromStrict(e.documentation)}}t.from=r})(j1||={});var bM;(t=>{function r(e,n){return Array.isArray(e)?{items:e.map(o=>j1.from(o))}:{items:e.items.map(o=>j1.from(o)),resourceOptions:e.resourceOptions?y4.from(e.resourceOptions,n):void 0}}t.from=r})(bM||={});var y4;(t=>{function r(e,n){return{...e,pathSeparator:n,cwd:e.cwd,globPattern:$o.from(e.globPattern)??void 0}}t.from=r})(y4||={});var yM;(t=>{function r(e){return{kind:I4.to(e.kind),acceptedLength:e.acceptedLength}}t.to=r})(yM||={});var I4;(t=>{function r(e){switch(e){case 0:return 1;case 1:return 2;case 2:return 3;default:return 0}}t.to=r})(I4||={});var IM;(t=>{function r(e,n){if(e.kind===2){let o=e.supersededBy?n(e.supersededBy):void 0;return{kind:2,supersededBy:o,userTypingDisagreed:e.userTypingDisagreed}}else if(e.kind===0)return{kind:0};return{kind:1}}t.to=r})(IM||={});var xM;(e=>{function r(n){return n===2?2:1}e.from=r;function t(n){return n===2?2:1}e.to=t})(xM||={});var SM;(t=>{function r(e,n){return{id:n,label:e.label,description:e.description,canEdit:e.canEdit,collapsibleState:e.collapsibleState||0,contextValue:e.contextValue}}t.from=r})(SM||={});var CM;(t=>{function r(e){return e.type==="mcp"?new Hm(e.label,e.serverLabel||e.label,e.instructions):e.type==="extension"?new Fm(e.extensionId.value,e.label):void 0}t.to=r})(CM||={});var CT;(e=>{function r(n){let o=new dd(n.content.map(i=>i.kind==="text"?new tn(i.value,i.audience):i.kind==="data"?new Ln(i.value.data.buffer,i.value.mimeType,i.audience):new oi(i.value)));return n.toolMetadata!==void 0&&(o.toolMetadata=n.toolMetadata),n.toolResultError&&(o.hasError=!!n.toolResultError),o}e.to=r;function t(n,o){n.toolResultMessage&&A(o,"chatParticipantPrivate");let i=d=>{d.audience&&A(o,"languageModelToolResultAudience")},s=!1,a;Array.isArray(n.toolResultDetails)?a=n.toolResultDetails?.map(d=>b.isUri(d)?d:ri.from(d)):n.toolResultDetails2&&(a={output:{type:"data",mimeType:n.toolResultDetails2.mime,value:H.wrap(n.toolResultDetails2.value)}},s=!0);let l={content:n.content.map(d=>{if(d instanceof tn)return i(d),{kind:"text",value:d.value,audience:d.audience};if(d instanceof oi)return{kind:"promptTsx",value:d.value};if(d instanceof Ln)return i(d),s=!0,{kind:"data",value:{mimeType:d.mimeType,data:H.wrap(d.data)},audience:d.audience};throw new Error("Unknown LanguageModelToolResult part type")}),toolResultMessage:ue.fromStrict(n.toolResultMessage),toolResultDetails:a,toolMetadata:n.toolMetadata,toolResultError:n.hasError};return s?new Gt(l):l}e.from=t})(CT||={});var Hi;(n=>{function r(o){return o}n.fromThemeIcon=r;function t(o){if(o){if(ut.isThemeIcon(o))return o;if(b.isUri(o))return o;if(typeof o=="string")return b.file(o);if(typeof o=="object"&&o!==null&&"dark"in o){let i=typeof o.dark=="string"?b.file(o.dark):o.dark,s=typeof o.light=="string"?b.file(o.light):o.light;return i?{dark:i,light:s??i}:void 0}else return}else return}n.from=t;function e(o){if(o){if(ut.isThemeIcon(o))return o;if(cl(o))return b.revive(o);{let i=o;return{light:b.revive(i.light),dark:b.revive(i.dark)}}}else return}n.to=e})(Hi||={});var TM;(e=>{function r(n){return{query:n.query,kind:t(n.kind),settings:n.settings}}e.fromSettingsSearchResult=r;function t(n){switch(n){case 1:return 1;case 2:return 2;case 3:return 3;default:throw new Error("Unknown AiSettingsSearchResultKind")}}})(TM||={});var Ym;(n=>{function r(o){return!!o.uri}function t(o){return Rc.toSerialized(r(o)?{type:2,uri:o.uri,headers:Object.entries(o.headers),authentication:o.authentication?{providerId:o.authentication.providerId,scopes:o.authentication.scopes}:void 0}:{type:1,cwd:o.cwd?.fsPath,args:o.args,command:o.command,env:o.env,envFile:void 0,sandbox:void 0})}n.from=t;function e(o){let i=Rc.fromSerialized(o.launch);if(i.type===2)return new Zc(o.label,i.uri,Object.fromEntries(i.headers),o.cacheNonce==="$$NONE"?void 0:o.cacheNonce);{let s=new Xc(o.label,i.command,[...i.args],Object.fromEntries(Object.entries(i.env).map(([a,l])=>[a,l===null?null:String(l)])),o.cacheNonce==="$$NONE"?void 0:o.cacheNonce);return i.cwd&&(s.cwd=b.file(i.cwd)),s}}n.to=e})(Ym||={});var EM;(t=>{function r(e){switch(e){case 0:return 0;case 1:return 1;case 2:return 2;default:throw new Error("Unknown SourceControlInputBoxValidationType")}}t.from=r})(EM||={});var x4;(t=>{function r(e){let n={};for(let[o,i]of Object.entries(e)){if(!i||i.length===0)continue;let s=[];for(let a of i){let l=S4.to(a);l&&s.push(l)}s.length>0&&(n[o]=s)}return n}t.to=r})(x4||={});var S4;(t=>{function r(e){let n=hH(e,lr);if(n)return{command:n,cwd:e.cwd,env:e.env,timeout:e.timeout}}t.to=r})(S4||={});var pd;(e=>{function r(n){if(n!==void 0)switch(n){case 0:return 0;case 1:return 1;case 2:return 2;case 3:return 3;default:return}}function t(n){let o=n.timing,i=o?.created??o?.startTime??0,s=o?.lastRequestStarted??o?.startTime,a=o?.lastRequestEnded??o?.endTime;return{resource:n.resource,label:n.label,description:n.description?ue.from(n.description):void 0,badge:n.badge?ue.from(n.badge):void 0,status:r(n.status),archived:n.archived,tooltip:ue.fromStrict(n.tooltip),timing:{created:i,lastRequestStarted:s,lastRequestEnded:a},changes:n.changes instanceof Array?n.changes:void 0,metadata:n.metadata}}e.from=t})(pd||={});var TT=class r{constructor(t,e){this.line=t;this.character=e}isBefore(t){return!1}isBeforeOrEqual(t){return!1}isAfter(t){return!1}isAfterOrEqual(t){return!1}isEqual(t){return!1}compareTo(t){return 0}translate(t,e){return new r(0,0)}with(t){return new r(0,0)}},Xm=class r{constructor(t,e,n,o){this.isEmpty=!1;this.isSingleLine=!1;this.start=new TT(t,e),this.end=new TT(n,o)}contains(t){return!1}isEqual(t){return!1}intersection(t){}union(t){return new r(0,0,0,0)}with(t){return new r(0,0,0,0)}},zo=class{constructor(t,e,n){this.uri=t;this.ranges=e;this.previewText=n}},Us=class{constructor(t,e,n){this.uri=t;this.text=e;this.lineNumber=n}},pu=class{constructor(t){this.keyword=t}},ET=(n=>(n[n.None=1]="None",n[n.FilesExclude=2]="FilesExclude",n[n.SearchAndFilesExclude=3]="SearchAndFilesExclude",n))(ET||{}),ub=(e=>(e[e.Information=1]="Information",e[e.Warning=2]="Warning",e))(ub||{});var md=2e4,C4="\u27EA ",T4=" characters skipped \u27EB",V6=(C4.length+T4.length+5)*2,B6=R("searchService");function pb(r){return!!r.rangeLocations&&!!r.previewText}var Zm=class{constructor(t,e,n,o){this.rangeLocations=[];this.webviewIndex=o;let i=Array.isArray(e)?e:[e];if(n&&n.matchLines===1&&$6(i)){t=OU(t,n.matchLines);let s="",a=0,l=0,d=Math.floor(n.charsPerLine/5);for(let c of i){let u=Math.max(c.startColumn-d,0),m=c.startColumn+n.charsPerLine;if(u>l+d+V6){let g=C4+(u-l)+T4;s+=g+t.slice(u,m),a+=u-(l+g.length)}else s+=t.slice(l,m);l=m,this.rangeLocations.push({source:c,preview:new wM(0,c.startColumn-a,c.endColumn-a)})}this.previewText=s}else{let s=Array.isArray(e)?e[0].startLineNumber:e.startLineNumber,a=Kd(e,l=>({preview:new eg(l.startLineNumber-s,l.startColumn,l.endLineNumber-s,l.endColumn),source:l}));this.rangeLocations=Array.isArray(a)?a:[a],this.previewText=t}}};function $6(r){let t=r[0].startLineNumber;for(let e of r)if(e.startLineNumber!==t||e.endLineNumber!==t)return!1;return!0}var eg=class{constructor(t,e,n,o){this.startLineNumber=t,this.startColumn=e,this.endLineNumber=n,this.endColumn=o}},wM=class extends eg{constructor(t,e,n){super(t,e,t,n)}};function E4(r,t=!0){let e=r&&r.files&&r.files.exclude,n=t&&r&&r.search&&r.search.exclude;if(!e&&!n)return;if(!e||!n)return e||n||void 0;let o=Object.create(null);return o=Qo(o,at(e)),o=Qo(o,at(n),!0),o}function kM(r,t){let e=r.ignoreGlobCase?{ignoreCase:!0}:void 0;return r.excludePattern&&nr(r.excludePattern,t,e)?!1:r.includePattern||r.usingSearchPaths?r.includePattern&&nr(r.includePattern,t,e)?!0:r.usingSearchPaths?!!r.folderQueries&&r.folderQueries.some(n=>{let o=n.folder.fsPath;if(_r(t,o,r.ignoreGlobCase)){let i=gi(o,t);return!n.includePattern||!!nr(n.includePattern,i,e)}else return!1}):!1:!0}var Fs=class extends Error{constructor(e,n){super(e);this.code=n}};function PM(r){let t={message:r.message,code:r.code};return new Error(JSON.stringify(t))}function w4(r){return!!r.path}var z6={ignoreCase:!0};function mb(r,t,e=!0,n){let o=r.searchPath?r.searchPath:r.relativePath;return e?MU(o,t):nr(t,o,n?z6:void 0)}function gd(r,t){let e={...r||{},...t||{}};return Object.keys(e).filter(n=>{let o=e[n];return typeof o=="boolean"&&o})}var tg=class{constructor(t,e){this._parsedIncludeExpression=null;let n=t.ignoreGlobCase||e.ignoreGlobCase?{ignoreCase:!0}:void 0;this._excludeExpression=e.excludePattern?.map(i=>({...t.excludePattern||{},...i.pattern||{}}))??[],this._excludeExpression.length===0&&(this._excludeExpression=[t.excludePattern||{}]),this._parsedExcludeExpression=this._excludeExpression.map(i=>Co(i,n));let o=t.includePattern;e.includePattern&&(o?o={...o,...e.includePattern}:o=e.includePattern),o&&(this._parsedIncludeExpression=Co(o,n))}_evalParsedExcludeExpression(t,e,n){let o=null;for(let i of this._parsedExcludeExpression){let s=i(t,e,n);if(typeof s=="string"){o=s;break}}return o}matchesExcludesSync(t,e,n){return!!(this._parsedExcludeExpression&&this._evalParsedExcludeExpression(t,e,n))}includedInQuerySync(t,e,n){return!(this._parsedExcludeExpression&&this._evalParsedExcludeExpression(t,e,n)||this._parsedIncludeExpression&&!this._parsedIncludeExpression(t,e,n))}includedInQuery(t,e,n){let o=()=>this._parsedIncludeExpression?!!this._parsedIncludeExpression(t,e,n):!0;return Promise.all(this._parsedExcludeExpression.map(i=>{let s=i(t,e,n);return qr(s)?s.then(a=>a?!1:o()):o()})).then(i=>i.some(s=>!!s))}hasSiblingExcludeClauses(){return this._excludeExpression.reduce((t,e)=>q6(e)||t,!1)}};function q6(r){for(let t in r)if(typeof r[t]!="boolean")return!0;return!1}function k4(r){if(!r)return;let t;return e=>(t||(t=(r()||Promise.resolve([])).then(n=>n?P4(n):{})),t.then(n=>!!n[e]))}function gb(r){if(!r)return;let t;return e=>{if(!t){let n=r();t=n?P4(n):{}}return!!t[e]}}function P4(r){let t={};for(let e of r)t[e]=!0;return t}function wT(r){return r.flatMap(t=>t.patterns.map(e=>t.baseUri?{baseUri:t.baseUri,pattern:e}:e))}var fb={matchLines:100,charsPerLine:1e4};var K6=!1,DM=class{constructor(t,e,n){this.id=t;this.dependencies=e;this.callback=n}};var RM=class r{constructor(){this._isWebWorker=typeof self=="object"&&self.constructor&&self.constructor.name==="DedicatedWorkerGlobalScope";this._isRenderer=typeof document=="object";this._defineCalls=[];this._state=1}static{this.INSTANCE=new r}_initialize(){if(this._state===1){if(globalThis.define){this._state=3;return}}else return;this._state=2,globalThis.define=(t,e,n)=>{typeof t!="string"&&(n=e,e=t,t=null),(typeof e!="object"||!Array.isArray(e))&&(n=e,e=null),this._defineCalls.push(new DM(t,e,n))},globalThis.define.amd=!0,this._isRenderer?this._amdPolicy=globalThis._VSCODE_WEB_PACKAGE_TTP??window.trustedTypes?.createPolicy("amdLoader",{createScriptURL(t){if(t.startsWith(window.location.origin)||t.startsWith(`${V.vscodeFileResource}://${h_}`))return t;throw new Error(`[trusted_script_src] Invalid script url: ${t}`)}}):this._isWebWorker&&(this._amdPolicy=globalThis._VSCODE_WEB_PACKAGE_TTP??globalThis.trustedTypes?.createPolicy("amdLoader",{createScriptURL(t){return t}}))}async load(t){if(this._initialize(),this._state===3)return new Promise(s=>{let a=Ae();globalThis.define(a,[t],function(l){s(l)})});let e=await(this._isWebWorker?this._workerLoadScript(t):this._isRenderer?this._rendererLoadScript(t):this._nodeJSLoadScript(t));if(!e){console.warn(`Did not receive a define call from script ${t}`);return}let n={},o=[],i=[];if(Array.isArray(e.dependencies))for(let s of e.dependencies)s==="exports"?o.push(n):i.push(s);if(i.length>0)throw new Error(`Cannot resolve dependencies for script ${t}. The dependencies are: ${i.join(", ")}`);return typeof e.callback=="function"?e.callback(...o)??n:e.callback}_rendererLoadScript(t){return new Promise((e,n)=>{let o=document.createElement("script");o.setAttribute("async","async"),o.setAttribute("type","text/javascript");let i=()=>{o.removeEventListener("load",s),o.removeEventListener("error",a)},s=l=>{i(),e(this._defineCalls.pop())},a=l=>{i(),n(l)};o.addEventListener("load",s),o.addEventListener("error",a),this._amdPolicy&&(t=this._amdPolicy.createScriptURL(t)),o.setAttribute("src",t),window.document.getElementsByTagName("head")[0].appendChild(o)})}async _workerLoadScript(t){return this._amdPolicy&&(t=this._amdPolicy.createScriptURL(t)),await import(t),this._defineCalls.pop()}async _nodeJSLoadScript(t){try{let e=(await import("fs")).default,n=(await import("vm")).default,o=(await import("module")).default,i=b.parse(t).fsPath,s=e.readFileSync(i).toString(),a=o.wrap(s.replace(/^#!.*/,""));return new n.Script(a).runInThisContext().apply(),this._defineCalls.pop()}catch(e){throw e}}},_M=new Map;async function kT(r,t,e){e===void 0&&(e=!!(globalThis._VSCODE_PRODUCT_JSON??globalThis.vscode?.context?.configuration()?.product)?.commit);let n=t?`${r}/${t}`:r;if(_M.has(n))return _M.get(n);let o;if(/^\w[\w\d+.-]*:\/\//.test(n))o=n;else{let l=`${K6&&e&&!Pr?GU:jU}/${n}`;o=ul.asBrowserUri(l).toString(!0)}let i=RM.INSTANCE.load(o);return _M.set(n,i),i}var vb="utf8",NM="utf8bom",_T="utf16be",DT="utf16le";var PT=[254,255],MM=[255,254],hb=[239,187,191],j6=512,G6=512,Q6=512*8,J6=512*128;var LM=class extends Error{constructor(e,n){super(e);this.decodeStreamErrorKind=n}},OM=class r{constructor(t){this.iconvLiteDecoder=t}static async create(t){let e;if(t!==vb)e=(await kT("@vscode/iconv-lite-umd","lib/iconv-lite-umd.js")).getDecoder(R4(t));else{let n=new TextDecoder;e={write(o){return n.decode(o,{stream:!0})},end(){return n.decode()}}}return new r(e)}write(t){return this.iconvLiteDecoder.write(t)}end(){return this.iconvLiteDecoder.end()}};function _4(r,t){let e=t.minBytesRequiredForDetection??(t.guessEncoding?Q6:G6);return new Promise((n,o)=>{let i=nc(u=>u.join("")),s=[],a=0,l,d=new Ce,c=async()=>{try{let u=await rq({buffer:H.concat(s),bytesRead:a},t.guessEncoding,t.candidateGuessEncodings);if(u.seemsBinary&&t.acceptTextOnly)throw new LM("Stream is binary but only text is accepted for decoding",1);u.encoding=await t.overwriteEncoding(u.encoding),l=await OM.create(u.encoding);let m=l.write(H.concat(s).buffer);i.write(m),s.length=0,a=0,n({stream:i,detected:u})}catch(u){d.cancel(),i.destroy(),o(u)}};PI(r,{onData:async u=>{l?i.write(l.write(u.buffer)):(s.push(u),a+=u.byteLength,a>=e&&(r.pause(),await c(),setTimeout(()=>r.resume())))},onError:u=>i.error(u),onEnd:async()=>{l||await c(),i.end(l?.end())}},d.token)})}async function D4(r,t,e){let o=(await kT("@vscode/iconv-lite-umd","lib/iconv-lite-umd.js")).getEncoder(R4(t),e),i=!1,s=!1;return{read(){if(s)return null;let a=r.read();if(typeof a!="string"){if(s=!0,!i&&e?.addBOM)switch(t){case vb:case NM:return H.wrap(Uint8Array.from(hb));case _T:return H.wrap(Uint8Array.from(PT));case DT:return H.wrap(Uint8Array.from(MM))}let l=o.end();return l&&l.length>0?(i=!0,H.wrap(l)):null}return i=!0,H.wrap(o.write(a))}}}function R4(r){return r===NM||r===null?vb:r}function Y6(r,t){if(!r||t<PT.length)return null;let e=r.readUInt8(0),n=r.readUInt8(1);if(e===PT[0]&&n===PT[1])return _T;if(e===MM[0]&&n===MM[1])return DT;if(t<hb.length)return null;let o=r.readUInt8(2);return e===hb[0]&&n===hb[1]&&o===hb[2]?NM:null}var X6=["ascii","utf-16","utf-32"];async function Z6(r,t){let e=await kT("jschardet","dist/jschardet.min.js"),n=r.slice(0,J6),o=oq(n.buffer);t&&(t=tt(t.map(a=>nq(a))),t.length===0&&(t=void 0));let i;try{i=e.detect(o,t?{detectEncodings:t}:void 0)}catch{return null}if(!i?.encoding)return null;let s=i.encoding.toLowerCase();return 0<=X6.indexOf(s)?null:tq(i.encoding)}var eq={ibm866:"cp866",big5:"cp950"};function A4(r){return r.replace(/[^a-zA-Z0-9]/g,"").toLowerCase()}function tq(r){let t=A4(r);return eq[t]||t}function nq(r){let t=A4(r),e=iq[t];return e?e.guessableName:void 0}function oq(r){let t="";for(let e=0;e<r.length;e++)t+=String.fromCharCode(r[e]);return t}function M4(r){switch(r){case"shiftjis":return"shift-jis";case"utf16le":return"utf-16le";case"utf16be":return"utf-16be";case"big5hkscs":return"big5-hkscs";case"eucjp":return"euc-jp";case"euckr":return"euc-kr";case"koi8r":return"koi8-r";case"koi8u":return"koi8-u";case"macroman":return"x-mac-roman";case"utf8bom":return"utf8";default:{let t=r.match(/windows(\d+)/);return t?"windows-"+t[1]:r}}}function rq({buffer:r,bytesRead:t},e,n){let o=Y6(r,t),i=!1;if(o!==_T&&o!==DT&&r){let s=!0,a=!0,l=!1;for(let d=0;d<t&&d<j6;d++){let c=d%2===1,u=r.readUInt8(d)===0;if(u&&(l=!0),s&&(c&&!u||!c&&u)&&(s=!1),a&&(c&&u||!c&&!u)&&(a=!1),u&&!s&&!a)break}l&&(s?o=DT:a?o=_T:i=!0)}return e&&!i&&!o&&r?Z6(r.slice(0,t),n).then(s=>({seemsBinary:!1,encoding:s})):{seemsBinary:i,encoding:o}}var AM={utf8:{labelLong:"UTF-8",labelShort:"UTF-8",order:1,alias:"utf8bom",guessableName:"UTF-8"},utf8bom:{labelLong:"UTF-8 with BOM",labelShort:"UTF-8 with BOM",encodeOnly:!0,order:2,alias:"utf8"},utf16le:{labelLong:"UTF-16 LE",labelShort:"UTF-16 LE",order:3,guessableName:"UTF-16LE"},utf16be:{labelLong:"UTF-16 BE",labelShort:"UTF-16 BE",order:4,guessableName:"UTF-16BE"},windows1252:{labelLong:"Western (Windows 1252)",labelShort:"Windows 1252",order:5,guessableName:"windows-1252"},iso88591:{labelLong:"Western (ISO 8859-1)",labelShort:"ISO 8859-1",order:6},iso88593:{labelLong:"Western (ISO 8859-3)",labelShort:"ISO 8859-3",order:7},iso885915:{labelLong:"Western (ISO 8859-15)",labelShort:"ISO 8859-15",order:8},macroman:{labelLong:"Western (Mac Roman)",labelShort:"Mac Roman",order:9},cp437:{labelLong:"DOS (CP 437)",labelShort:"CP437",order:10},windows1256:{labelLong:"Arabic (Windows 1256)",labelShort:"Windows 1256",order:11},iso88596:{labelLong:"Arabic (ISO 8859-6)",labelShort:"ISO 8859-6",order:12},windows1257:{labelLong:"Baltic (Windows 1257)",labelShort:"Windows 1257",order:13},iso88594:{labelLong:"Baltic (ISO 8859-4)",labelShort:"ISO 8859-4",order:14},iso885914:{labelLong:"Celtic (ISO 8859-14)",labelShort:"ISO 8859-14",order:15},windows1250:{labelLong:"Central European (Windows 1250)",labelShort:"Windows 1250",order:16,guessableName:"windows-1250"},iso88592:{labelLong:"Central European (ISO 8859-2)",labelShort:"ISO 8859-2",order:17,guessableName:"ISO-8859-2"},cp852:{labelLong:"Central European (CP 852)",labelShort:"CP 852",order:18},windows1251:{labelLong:"Cyrillic (Windows 1251)",labelShort:"Windows 1251",order:19,guessableName:"windows-1251"},cp866:{labelLong:"Cyrillic (CP 866)",labelShort:"CP 866",order:20,guessableName:"IBM866"},cp1125:{labelLong:"Cyrillic (CP 1125)",labelShort:"CP 1125",order:21,guessableName:"IBM1125"},iso88595:{labelLong:"Cyrillic (ISO 8859-5)",labelShort:"ISO 8859-5",order:22,guessableName:"ISO-8859-5"},koi8r:{labelLong:"Cyrillic (KOI8-R)",labelShort:"KOI8-R",order:23,guessableName:"KOI8-R"},koi8u:{labelLong:"Cyrillic (KOI8-U)",labelShort:"KOI8-U",order:24},iso885913:{labelLong:"Estonian (ISO 8859-13)",labelShort:"ISO 8859-13",order:25},windows1253:{labelLong:"Greek (Windows 1253)",labelShort:"Windows 1253",order:26,guessableName:"windows-1253"},iso88597:{labelLong:"Greek (ISO 8859-7)",labelShort:"ISO 8859-7",order:27,guessableName:"ISO-8859-7"},windows1255:{labelLong:"Hebrew (Windows 1255)",labelShort:"Windows 1255",order:28,guessableName:"windows-1255"},iso88598:{labelLong:"Hebrew (ISO 8859-8)",labelShort:"ISO 8859-8",order:29,guessableName:"ISO-8859-8"},iso885910:{labelLong:"Nordic (ISO 8859-10)",labelShort:"ISO 8859-10",order:30},iso885916:{labelLong:"Romanian (ISO 8859-16)",labelShort:"ISO 8859-16",order:31},windows1254:{labelLong:"Turkish (Windows 1254)",labelShort:"Windows 1254",order:32},iso88599:{labelLong:"Turkish (ISO 8859-9)",labelShort:"ISO 8859-9",order:33},windows1258:{labelLong:"Vietnamese (Windows 1258)",labelShort:"Windows 1258",order:34},gbk:{labelLong:"Simplified Chinese (GBK)",labelShort:"GBK",order:35},gb18030:{labelLong:"Simplified Chinese (GB18030)",labelShort:"GB18030",order:36},cp950:{labelLong:"Traditional Chinese (Big5)",labelShort:"Big5",order:37,guessableName:"Big5"},big5hkscs:{labelLong:"Traditional Chinese (Big5-HKSCS)",labelShort:"Big5-HKSCS",order:38},shiftjis:{labelLong:"Japanese (Shift JIS)",labelShort:"Shift JIS",order:39,guessableName:"SHIFT_JIS"},eucjp:{labelLong:"Japanese (EUC-JP)",labelShort:"EUC-JP",order:40,guessableName:"EUC-JP"},euckr:{labelLong:"Korean (EUC-KR)",labelShort:"EUC-KR",order:41,guessableName:"EUC-KR"},windows874:{labelLong:"Thai (Windows 874)",labelShort:"Windows 874",order:42},iso885911:{labelLong:"Latin/Thai (ISO 8859-11)",labelShort:"ISO 8859-11",order:43},koi8ru:{labelLong:"Cyrillic (KOI8-RU)",labelShort:"KOI8-RU",order:44},koi8t:{labelLong:"Tajik (KOI8-T)",labelShort:"KOI8-T",order:45},gb2312:{labelLong:"Simplified Chinese (GB 2312)",labelShort:"GB 2312",order:46,guessableName:"GB2312"},cp865:{labelLong:"Nordic DOS (CP 865)",labelShort:"CP 865",order:47},cp850:{labelLong:"Western European DOS (CP 850)",labelShort:"CP 850",order:48}},iq=(()=>{let r={};for(let t in AM)AM[t].guessableName&&(r[t]=AM[t]);return r})();var JPe=R("textFileService");function L4(r){let t=!1;return{read(){return t?null:(t=!0,r)}}}function yb(r,t,e){return new ss(n=>AT(n,e)).isEqual(r,t)}function sq(r,t,e){return yb(r.uri,t.uri,e)?0:fi(r.uri.toString(),t.uri.toString())}function aq(r,t,e){return r.index!==t.index?r.index<t.index?-1:1:yb(r.uri,t.uri,e)?fi(r.name,t.name):fi(r.uri.toString(),t.uri.toString())}function N4(r,t,e,n){let o=r.slice(0).sort((s,a)=>e(s,a,n)),i=t.slice(0).sort((s,a)=>e(s,a,n));return FN(o,i,(s,a)=>e(s,a,n))}function AT(r,t){let e=t.getCapabilities(r.scheme);return!(e&&e&1024)}var bb=class r extends ax{constructor(e,n,o,i,s,a,l){super(e,o.map(d=>new hc(d)),i,s,l);this._name=n;this._isUntitled=a;this._workspaceFolders=[];this._structure=er.forUris(l,()=>!0),o.forEach(d=>{this._workspaceFolders.push(d),this._structure.set(d.uri,d)})}static toExtHostWorkspace(e,n,o,i){if(!e)return{workspace:null,added:[],removed:[]};let{id:s,name:a,folders:l,configuration:d,transient:c,isUntitled:u}=e,m=[],g=n;n?l.forEach((S,T)=>{let P=b.revive(S.uri),L=r._findFolder(o||n,P,i);L?(L.name=S.name,L.index=S.index,m.push(L)):m.push({uri:P,name:S.name,index:T})}):m.push(...l.map(({uri:S,name:T,index:P})=>({uri:b.revive(S),name:T,index:P}))),m.sort((S,T)=>S.index<T.index?-1:1);let h=new r(s,a,m,!!c,d?b.revive(d):null,!!u,S=>AT(S,i)),{added:f,removed:I}=N4(g?g.workspaceFolders:[],h.workspaceFolders,sq,i);return{workspace:h,added:f,removed:I}}static _findFolder(e,n,o){for(let i=0;i<e.folders.length;i++){let s=e.workspaceFolders[i];if(yb(s.uri,n,o))return s}}get name(){return this._name}get isUntitled(){return this._isUntitled}get workspaceFolders(){return this._workspaceFolders.slice(0)}getWorkspaceFolder(e,n){return n&&this._structure.get(e)&&(e=Go(e)),this._structure.findSubstr(e)}resolveWorkspaceFolder(e){return this._structure.get(e)}},ng=class{constructor(t,e,n,o,i){this._onDidChangeWorkspace=new E;this.onDidChangeWorkspace=this._onDidChangeWorkspace.event;this._onDidGrantWorkspaceTrust=new E;this.onDidGrantWorkspaceTrust=this._onDidGrantWorkspaceTrust.event;this._onDidChangeWorkspaceTrustedFolders=new E;this.onDidChangeWorkspaceTrustedFolders=this._onDidChangeWorkspaceTrustedFolders.event;this._activeSearchCallbacks=[];this._trusted=!1;this._editSessionIdentityProviders=new Map;this._providerHandlePool=0;this._onWillCreateEditSessionIdentityEvent=new ns;this._canonicalUriProviders=new Map;this._logService=o,this._extHostFileSystemInfo=n,this._uriTransformerService=i,this._requestIdProvider=new ox,this._barrier=new In,this._proxy=t.getProxy(F.MainThreadWorkspace),this._messageService=t.getProxy(F.MainThreadMessageService);let s=e.workspace;this._confirmedWorkspace=s?new bb(s.id,s.name,[],!!s.transient,s.configuration?b.revive(s.configuration):null,!!s.isUntitled,a=>AT(a,n)):void 0}$initializeWorkspace(t,e){this._trusted=e,this.$acceptWorkspaceData(t),this._barrier.open()}waitForInitializeCall(){return this._barrier.wait()}get workspace(){return this._actualWorkspace}get name(){return this._actualWorkspace?this._actualWorkspace.name:void 0}get workspaceFile(){if(this._actualWorkspace&&this._actualWorkspace.configuration)return this._actualWorkspace.isUntitled?b.from({scheme:V.untitled,path:Tt(Go(this._actualWorkspace.configuration))}):this._actualWorkspace.configuration}get _actualWorkspace(){return this._unconfirmedWorkspace||this._confirmedWorkspace}getWorkspaceFolders(){if(this._actualWorkspace)return this._actualWorkspace.workspaceFolders.slice(0)}async getWorkspaceFolders2(){if(await this._barrier.wait(),!!this._actualWorkspace)return this._actualWorkspace.workspaceFolders.slice(0)}updateWorkspaceFolders(t,e,n,...o){let i=[];if(Array.isArray(o)&&o.forEach(c=>{b.isUri(c.uri)&&!i.some(u=>yb(u.uri,c.uri,this._extHostFileSystemInfo))&&i.push({uri:c.uri,name:c.name||vh(c.uri)})}),this._unconfirmedWorkspace||[e,n].some(c=>typeof c!="number"||c<0)||n===0&&i.length===0)return!1;let s=this._actualWorkspace?this._actualWorkspace.workspaceFolders:[];if(e+n>s.length)return!1;let a=s.slice(0);a.splice(e,n,...i.map(c=>({uri:c.uri,name:c.name||vh(c.uri),index:void 0})));for(let c=0;c<a.length;c++){let u=a[c];if(a.some((m,g)=>g!==c&&yb(u.uri,m.uri,this._extHostFileSystemInfo)))return!1}a.forEach((c,u)=>c.index=u);let{added:l,removed:d}=N4(s,a,aq,this._extHostFileSystemInfo);if(l.length===0&&d.length===0)return!1;if(this._proxy){let c=t.displayName||t.name;this._proxy.$updateWorkspaceFolders(c,e,n,i).then(void 0,u=>{this._unconfirmedWorkspace=void 0;let m={source:{identifier:t.identifier,label:t.displayName||t.name}};this._messageService.$showMessage(c2.Error,p(3504,null,c,u.toString()),m,[])})}return this.trySetWorkspaceFolders(a),!0}getWorkspaceFolder(t,e){if(this._actualWorkspace)return this._actualWorkspace.getWorkspaceFolder(t,e)}async getWorkspaceFolder2(t,e){if(await this._barrier.wait(),!!this._actualWorkspace)return this._actualWorkspace.getWorkspaceFolder(t,e)}async resolveWorkspaceFolder(t){if(await this._barrier.wait(),!!this._actualWorkspace)return this._actualWorkspace.resolveWorkspaceFolder(t)}getPath(){if(!this._actualWorkspace)return;let{folders:t}=this._actualWorkspace;if(t.length!==0)return t[0].uri.fsPath}getRelativePath(t,e){let n,o="";if(typeof t=="string"?(n=b.file(t),o=t):typeof t<"u"&&(n=t,o=t.fsPath),!n)return o;let i=this.getWorkspaceFolder(n,!0);if(!i)return o;typeof e>"u"&&this._actualWorkspace&&(e=this._actualWorkspace.folders.length>1);let s=bh(i.uri,n);return e&&i.name&&(s=`${i.name}/${s}`),s}trySetWorkspaceFolders(t){this._actualWorkspace&&(this._unconfirmedWorkspace=bb.toExtHostWorkspace({id:this._actualWorkspace.id,name:this._actualWorkspace.name,configuration:this._actualWorkspace.configuration,folders:t,isUntitled:this._actualWorkspace.isUntitled},this._actualWorkspace,void 0,this._extHostFileSystemInfo).workspace||void 0)}$acceptWorkspaceData(t){let{workspace:e,added:n,removed:o}=bb.toExtHostWorkspace(t,this._confirmedWorkspace,this._unconfirmedWorkspace,this._extHostFileSystemInfo);this._confirmedWorkspace=e||void 0,this._unconfirmedWorkspace=void 0,this._onDidChangeWorkspace.fire(Object.freeze({added:n,removed:o}))}findFiles(t,e,n,o,i=ve.None){this._logService.trace(`extHostWorkspace#findFiles: fileSearch, extension: ${o.value}, entryPoint: findFiles`);let s="",a=!0;return e===null?a=!1:e!==void 0&&(typeof e=="string"?s=e:s=e.pattern),this._findFilesImpl({type:"include",value:t},{exclude:[s],maxResults:n,useExcludeSettings:a?2:1,useIgnoreFiles:{local:!1}},i)}findFiles2(t,e={},n,o=ve.None){return this._logService.trace(`extHostWorkspace#findFiles2New: fileSearch, extension: ${n.value}, entryPoint: findFiles2New`),this._findFilesImpl({type:"filePatterns",value:t},e,o)}async _findFilesImpl(t,e,n){if(n.isCancellationRequested)return Promise.resolve([]);let o=t.type==="include"?[t.value]:t.value??[];if(!Array.isArray(o))throw console.error("Invalid file pattern provided",o),new Error(`Invalid file pattern provided ${JSON.stringify(o)}`);let i=o.map(s=>{let a=O4(e.exclude),l={ignoreSymlinks:typeof e.followSymlinks=="boolean"?!e.followSymlinks:void 0,disregardIgnoreFiles:typeof e.useIgnoreFiles?.local=="boolean"?!e.useIgnoreFiles.local:void 0,disregardGlobalIgnoreFiles:typeof e.useIgnoreFiles?.global=="boolean"?!e.useIgnoreFiles.global:void 0,disregardParentIgnoreFiles:typeof e.useIgnoreFiles?.parent=="boolean"?!e.useIgnoreFiles.parent:void 0,disregardExcludeSettings:e.useExcludeSettings!==void 0&&e.useExcludeSettings===1,disregardSearchExcludeSettings:e.useExcludeSettings!==void 0&&e.useExcludeSettings!==3,maxResults:e.maxResults,excludePattern:a.length>0?a:void 0,ignoreGlobCase:e.caseInsensitive,_reason:"startFileSearch",shouldGlobSearch:t.type==="include"?void 0:!0},d=RT($o.from(s)),c=d?.folder;return t.type==="include"?l.includePattern=d?.pattern:l.filePattern=d?.pattern,{folder:c,options:l}});return this._findFilesBase(i,n)}async _findFilesBase(t,e){let o=(await Promise.all(t?.map(a=>this._proxy.$startFileSearch(a.folder??null,a.options,e).then(l=>Array.isArray(l)?l.map(d=>b.revive(d)):[]))??[])).flat(),i=new ss(a=>AT(a,this._extHostFileSystemInfo)),s=new Map;for(let a of o){let l=i.getComparisonKey(a);s.has(l)||s.set(l,a)}return Array.from(s.values())}findTextInFiles2(t,e,n,o=ve.None){this._logService.trace(`extHostWorkspace#findTextInFiles2: textSearch, extension: ${n.value}, entryPoint: findTextInFiles2`);let i=m=>{if(!e)return{folder:void 0,options:{}};let g=m?RT($o.from(m)):void 0,h=e.exclude?O4(e.exclude):void 0;return{options:{ignoreSymlinks:typeof e.followSymlinks=="boolean"?!e.followSymlinks:void 0,disregardIgnoreFiles:typeof e.useIgnoreFiles?.local=="boolean"?!e.useIgnoreFiles?.local:void 0,disregardGlobalIgnoreFiles:typeof e.useIgnoreFiles?.global=="boolean"?!e.useIgnoreFiles?.global:void 0,disregardParentIgnoreFiles:typeof e.useIgnoreFiles?.parent=="boolean"?!e.useIgnoreFiles?.parent:void 0,disregardExcludeSettings:e.useExcludeSettings!==void 0&&e.useExcludeSettings===1,disregardSearchExcludeSettings:e.useExcludeSettings!==void 0&&e.useExcludeSettings!==3,fileEncoding:e.encoding,maxResults:e.maxResults,ignoreGlobCase:e.caseInsensitive,previewOptions:e.previewOptions?{matchLines:e.previewOptions?.numMatchLines??100,charsPerLine:e.previewOptions?.charsPerLine??1e4}:void 0,surroundingContext:e.surroundingContext,includePattern:g?.pattern,excludePattern:h},folder:g?.folder}},a=(e?.include?.map(m=>i(m))??[i(void 0)]).filter(m=>!!m),l=new $,d=l.add(new E),c=this.findTextInFilesBase(t,a,(m,g)=>d.fire({result:m,uri:g}),o);return{results:new mp(async m=>{l.add(d.event(g=>{let h=g.result,f=g.uri;pb(h)?m.emitOne(new zo(f,h.rangeLocations.map(I=>({previewRange:new fe(I.preview.startLineNumber,I.preview.startColumn,I.preview.endLineNumber,I.preview.endColumn),sourceRange:new fe(I.source.startLineNumber,I.source.startColumn,I.source.endLineNumber,I.source.endColumn)})),h.previewText)):m.emitOne(new Us(f,h.text,h.lineNumber))})),await c}),complete:c.then(m=>(l.dispose(),{limitHit:m?.limitHit??!1}))}}async findTextInFilesBase(t,e,n,o=ve.None){let i=this._requestIdProvider.getNext(),s=!1;if(o.onCancellationRequested(a=>{s=!0}),this._activeSearchCallbacks[i]=a=>{if(s)return;let l=b.revive(a.resource);a.results.forEach(d=>{let c=ht(d);n(c,l)})},o.isCancellationRequested)return{};try{let a=await Promise.all(e?.map(l=>this._proxy.$startTextSearch(t,l.folder??null,l.options,i,o)||{})??[]);return delete this._activeSearchCallbacks[i],a.reduce((l,d)=>({limitHit:l?.limitHit||(d?.limitHit??!1),message:[l?.message??[],d?.message??[]].flat()}),{})??{limitHit:!1}}catch(a){throw delete this._activeSearchCallbacks[i],a}}async findTextInFiles(t,e,n,o,i=ve.None){this._logService.trace(`extHostWorkspace#findTextInFiles: textSearch, extension: ${o.value}, entryPoint: findTextInFiles`);let s=typeof e.previewOptions>"u"?{matchLines:100,charsPerLine:1e4}:e.previewOptions,a=RT($o.from(e.include)),l=typeof e.exclude=="string"?e.exclude:e.exclude?e.exclude.pattern:void 0,d={ignoreSymlinks:typeof e.followSymlinks=="boolean"?!e.followSymlinks:void 0,disregardIgnoreFiles:typeof e.useIgnoreFiles=="boolean"?!e.useIgnoreFiles:void 0,disregardGlobalIgnoreFiles:typeof e.useGlobalIgnoreFiles=="boolean"?!e.useGlobalIgnoreFiles:void 0,disregardParentIgnoreFiles:typeof e.useParentIgnoreFiles=="boolean"?!e.useParentIgnoreFiles:void 0,disregardExcludeSettings:typeof e.useDefaultExcludes=="boolean"?!e.useDefaultExcludes:!0,disregardSearchExcludeSettings:typeof e.useSearchExclude=="boolean"?!e.useSearchExclude:!0,fileEncoding:e.encoding,maxResults:e.maxResults,previewOptions:s,surroundingContext:e.afterContext,includePattern:a?.pattern,excludePattern:l?[{pattern:l}]:void 0},c=(u,m)=>{pb(u)?n({uri:m,preview:{text:u.previewText,matches:Kd(u.rangeLocations,g=>new fe(g.preview.startLineNumber,g.preview.startColumn,g.preview.endLineNumber,g.preview.endColumn))},ranges:Kd(u.rangeLocations,g=>new fe(g.source.startLineNumber,g.source.startColumn,g.source.endLineNumber,g.source.endColumn))}):n({uri:m,text:u.text,lineNumber:u.lineNumber})};return this.findTextInFilesBase(t,[{options:d,folder:a?.folder}],c,i)}$handleTextSearchResult(t,e){this._activeSearchCallbacks[e]?.(t)}async save(t){let e=await this._proxy.$save(t,{saveAs:!1});return b.revive(e)}async saveAs(t){let e=await this._proxy.$save(t,{saveAs:!0});return b.revive(e)}saveAll(t){return this._proxy.$saveAll(t)}resolveProxy(t){return this._proxy.$resolveProxy(t)}lookupAuthorization(t){return this._proxy.$lookupAuthorization(t)}lookupKerberosAuthorization(t){return this._proxy.$lookupKerberosAuthorization(t)}loadCertificates(){return this._proxy.$loadCertificates()}get trusted(){return this._trusted}requestResourceTrust(t){return this._proxy.$requestResourceTrust(t)}requestWorkspaceTrust(t){return this._proxy.$requestWorkspaceTrust(t)}$onDidGrantWorkspaceTrust(){this._trusted||(this._trusted=!0,this._onDidGrantWorkspaceTrust.fire())}$onDidChangeWorkspaceTrustedFolders(){this._onDidChangeWorkspaceTrustedFolders.fire()}isResourceTrusted(t){return this._proxy.$isResourceTrusted(t)}registerEditSessionIdentityProvider(t,e){if(this._editSessionIdentityProviders.has(t))throw new Error(`A provider has already been registered for scheme ${t}`);this._editSessionIdentityProviders.set(t,e);let n=this._uriTransformerService.transformOutgoingScheme(t),o=this._providerHandlePool++;return this._proxy.$registerEditSessionIdentityProvider(o,n),K(()=>{this._editSessionIdentityProviders.delete(t),this._proxy.$unregisterEditSessionIdentityProvider(o)})}async $getEditSessionIdentifier(t,e){this._logService.info("Getting edit session identifier for workspaceFolder",t);let n=await this.resolveWorkspaceFolder(b.revive(t));if(!n){this._logService.warn("Unable to resolve workspace folder");return}this._logService.info("Invoking #provideEditSessionIdentity for workspaceFolder",n);let o=this._editSessionIdentityProviders.get(n.uri.scheme);if(this._logService.info(`Provider for scheme ${n.uri.scheme} is defined: `,!!o),!o)return;let i=await o.provideEditSessionIdentity(n,e);if(this._logService.info("Provider returned edit session identifier: ",i),!!i)return i}async $provideEditSessionIdentityMatch(t,e,n,o){this._logService.info("Getting edit session identifier for workspaceFolder",t);let i=await this.resolveWorkspaceFolder(b.revive(t));if(!i){this._logService.warn("Unable to resolve workspace folder");return}this._logService.info("Invoking #provideEditSessionIdentity for workspaceFolder",i);let s=this._editSessionIdentityProviders.get(i.uri.scheme);if(this._logService.info(`Provider for scheme ${i.uri.scheme} is defined: `,!!s),!s)return;let a=await s.provideEditSessionIdentityMatch?.(e,n,o);if(this._logService.info("Provider returned edit session identifier match result: ",a),!!a)return a}getOnWillCreateEditSessionIdentityEvent(t){return(e,n,o)=>{let i=function(a){e.call(n,a)};return i.extension=t,this._onWillCreateEditSessionIdentityEvent.event(i,void 0,o)}}async $onWillCreateEditSessionIdentity(t,e,n){let o=await this.resolveWorkspaceFolder(b.revive(t));if(o===void 0)throw new Error("Unable to resolve workspace folder");await this._onWillCreateEditSessionIdentityEvent.fireAsync({workspaceFolder:o},e,async(i,s)=>{let a=Date.now();await Promise.resolve(i),Date.now()-a>n&&this._logService.warn("SLOW edit session create-participant",s.extension.identifier)}),e.isCancellationRequested}registerCanonicalUriProvider(t,e){if(this._canonicalUriProviders.has(t))throw new Error(`A provider has already been registered for scheme ${t}`);this._canonicalUriProviders.set(t,e);let n=this._uriTransformerService.transformOutgoingScheme(t),o=this._providerHandlePool++;return this._proxy.$registerCanonicalUriProvider(o,n),K(()=>{this._canonicalUriProviders.delete(t),this._proxy.$unregisterCanonicalUriProvider(o)})}async provideCanonicalUri(t,e,n){let o=this._canonicalUriProviders.get(t.scheme);if(!o)return;let i=await o.provideCanonicalUri?.(b.revive(t),e,n);if(i)return i}async $provideCanonicalUri(t,e,n){return this.provideCanonicalUri(b.revive(t),{targetScheme:e},n)}async decode(t,e){let[n,o]=this.toEncodeDecodeParameters(e),i=await this._proxy.$resolveDecoding(n,o),s=(await _4(dF(H.wrap(t)),{...i,acceptTextOnly:!0,overwriteEncoding:a=>a===null||a===i.preferredEncoding?Promise.resolve(i.preferredEncoding):this._proxy.$validateDetectedEncoding(n,a,o)})).stream;return kI(s,a=>a.join(""))}async encode(t,e){let[n,o]=this.toEncodeDecodeParameters(e),{encoding:i,addBOM:s}=await this._proxy.$resolveEncoding(n,o);if(i===vb&&!s)return H.fromString(t).buffer;let a=await D4(L4(t),i,{addBOM:s});return lF(a).buffer}toEncodeDecodeParameters(t){let e=cl(t?.uri)?t.uri:void 0,n=typeof t?.encoding=="string"?t.encoding:void 0;return[e,n?{encoding:n}:void 0]}};ng=_([C(0,se),C(1,Ye),C(2,Gr),C(3,oe),C(4,ds)],ng);var On=R("IExtHostWorkspace");function RT(r){let t,e;if(r)return typeof r=="string"?t=r:(t=r.pattern,e=b.revive(r.baseUri)),{pattern:t,folder:e}}function O4(r){return(r?.map(t=>{if(typeof t=="string")return t===""?void 0:{pattern:t,uri:void 0};{let e=RT(t);return e?{pattern:e.pattern,uri:e.folder}:void 0}})??[]).filter(t=>!!t)}var U4;(t=>t.DEFAULT={allowTrailingComma:!0})(U4||={});function lq(r,t=!1){let e=0,n=r.length,o="",i=0,s=16,a=0;function l(f){let I=0,S=0;for(;I<f;){let T=r.charCodeAt(e);if(T>=48&&T<=57)S=S*16+T-48;else if(T>=65&&T<=70)S=S*16+T-65+10;else if(T>=97&&T<=102)S=S*16+T-97+10;else break;e++,I++}return I<f&&(S=-1),S}function d(f){e=f,o="",i=0,s=16,a=0}function c(){let f=e;if(r.charCodeAt(e)===48)e++;else for(e++;e<r.length&&og(r.charCodeAt(e));)e++;if(e<r.length&&r.charCodeAt(e)===46)if(e++,e<r.length&&og(r.charCodeAt(e)))for(e++;e<r.length&&og(r.charCodeAt(e));)e++;else return a=3,r.substring(f,e);let I=e;if(e<r.length&&(r.charCodeAt(e)===69||r.charCodeAt(e)===101))if(e++,(e<r.length&&r.charCodeAt(e)===43||r.charCodeAt(e)===45)&&e++,e<r.length&&og(r.charCodeAt(e))){for(e++;e<r.length&&og(r.charCodeAt(e));)e++;I=e}else a=3;return r.substring(f,I)}function u(){let f="",I=e;for(;;){if(e>=n){f+=r.substring(I,e),a=2;break}let S=r.charCodeAt(e);if(S===34){f+=r.substring(I,e),e++;break}if(S===92){if(f+=r.substring(I,e),e++,e>=n){a=2;break}switch(r.charCodeAt(e++)){case 34:f+='"';break;case 92:f+="\\";break;case 47:f+="/";break;case 98:f+="\b";break;case 102:f+="\f";break;case 110:f+=`
`;break;case 114:f+="\r";break;case 116:f+="	";break;case 117:{let P=l(4);P>=0?f+=String.fromCharCode(P):a=4;break}default:a=5}I=e;continue}if(S>=0&&S<=31)if(MT(S)){f+=r.substring(I,e),a=2;break}else a=6;e++}return f}function m(){if(o="",a=0,i=e,e>=n)return i=n,s=17;let f=r.charCodeAt(e);if(UM(f)){do e++,o+=String.fromCharCode(f),f=r.charCodeAt(e);while(UM(f));return s=15}if(MT(f))return e++,o+=String.fromCharCode(f),f===13&&r.charCodeAt(e)===10&&(e++,o+=`
`),s=14;switch(f){case 123:return e++,s=1;case 125:return e++,s=2;case 91:return e++,s=3;case 93:return e++,s=4;case 58:return e++,s=6;case 44:return e++,s=5;case 34:return e++,o=u(),s=10;case 47:{let I=e-1;if(r.charCodeAt(e+1)===47){for(e+=2;e<n&&!MT(r.charCodeAt(e));)e++;return o=r.substring(I,e),s=12}if(r.charCodeAt(e+1)===42){e+=2;let S=n-1,T=!1;for(;e<S;){if(r.charCodeAt(e)===42&&r.charCodeAt(e+1)===47){e+=2,T=!0;break}e++}return T||(e++,a=1),o=r.substring(I,e),s=13}return o+=String.fromCharCode(f),e++,s=16}case 45:if(o+=String.fromCharCode(f),e++,e===n||!og(r.charCodeAt(e)))return s=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return o+=c(),s=11;default:for(;e<n&&g(f);)e++,f=r.charCodeAt(e);if(i!==e){switch(o=r.substring(i,e),o){case"true":return s=8;case"false":return s=9;case"null":return s=7}return s=16}return o+=String.fromCharCode(f),e++,s=16}}function g(f){if(UM(f)||MT(f))return!1;switch(f){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}function h(){let f;do f=m();while(f>=12&&f<=15);return f}return{setPosition:d,getPosition:()=>e,scan:t?h:m,getToken:()=>s,getTokenValue:()=>o,getTokenOffset:()=>i,getTokenLength:()=>e-i,getTokenError:()=>a}}function UM(r){return r===32||r===9||r===11||r===12||r===160||r===5760||r>=8192&&r<=8203||r===8239||r===8287||r===12288||r===65279}function MT(r){return r===10||r===13||r===8232||r===8233}function og(r){return r>=48&&r<=57}function F4(r,t,e=U4.DEFAULT){let n=lq(r,!1);function o(J){return J?()=>J(n.getTokenOffset(),n.getTokenLength()):()=>!0}function i(J){return J?Y=>J(Y,n.getTokenOffset(),n.getTokenLength()):()=>!0}let s=o(t.onObjectBegin),a=i(t.onObjectProperty),l=o(t.onObjectEnd),d=o(t.onArrayBegin),c=o(t.onArrayEnd),u=i(t.onLiteralValue),m=i(t.onSeparator),g=o(t.onComment),h=i(t.onError),f=e&&e.disallowComments,I=e&&e.allowTrailingComma;function S(){for(;;){let J=n.scan();switch(n.getTokenError()){case 4:T(14);break;case 5:T(15);break;case 3:T(13);break;case 1:f||T(11);break;case 2:T(12);break;case 6:T(16);break}switch(J){case 12:case 13:f?T(10):g();break;case 16:T(1);break;case 15:case 14:break;default:return J}}}function T(J,Y=[],re=[]){if(h(J),Y.length+re.length>0){let Pe=n.getToken();for(;Pe!==17;){if(Y.indexOf(Pe)!==-1){S();break}else if(re.indexOf(Pe)!==-1)break;Pe=S()}}}function P(J){let Y=n.getTokenValue();return J?u(Y):a(Y),S(),!0}function L(){switch(n.getToken()){case 11:{let J=0;try{J=JSON.parse(n.getTokenValue()),typeof J!="number"&&(T(2),J=0)}catch{T(2)}u(J);break}case 7:u(null);break;case 8:u(!0);break;case 9:u(!1);break;default:return!1}return S(),!0}function q(){return n.getToken()!==10?(T(3,[],[2,5]),!1):(P(!1),n.getToken()===6?(m(":"),S(),G()||T(4,[],[2,5])):T(5,[],[2,5]),!0)}function N(){s(),S();let J=!1;for(;n.getToken()!==2&&n.getToken()!==17;){if(n.getToken()===5){if(J||T(4,[],[]),m(","),S(),n.getToken()===2&&I)break}else J&&T(6,[],[]);q()||T(4,[],[2,5]),J=!0}return l(),n.getToken()!==2?T(7,[2],[]):S(),!0}function B(){d(),S();let J=!1;for(;n.getToken()!==4&&n.getToken()!==17;){if(n.getToken()===5){if(J||T(4,[],[]),m(","),S(),n.getToken()===4&&I)break}else J&&T(6,[],[]);G()||T(4,[],[4,5]),J=!0}return c(),n.getToken()!==4?T(8,[4],[]):S(),!0}function G(){switch(n.getToken()){case 3:return B();case 1:return N();case 10:return P(!0);default:return L()}}return S(),n.getToken()===17?e.allowEmptyContent?!0:(T(4,[],[]),!1):G()?(n.getToken()!==17&&T(9,[],[]),!0):(T(4,[],[]),!1)}function Ib(r){return Object.isFrozen(r)?r:Ah(r)}var hd=class r{constructor(t,e,n,o,i){this._contents=t;this._keys=e;this._overrides=n;this._raw=o;this.logService=i;this.overrideConfigurations=new Map}static createEmptyModel(t){return new r({},[],[],void 0,t)}get rawConfiguration(){if(!this._rawConfiguration)if(this._raw){let t=(Array.isArray(this._raw)?this._raw:[this._raw]).map(e=>{if(e instanceof r)return e;let n=new FM("",this.logService);return n.parseRaw(e),n.configurationModel});this._rawConfiguration=t.reduce((e,n)=>n===e?n:e.merge(n),t[0])}else this._rawConfiguration=this;return this._rawConfiguration}get contents(){return this._contents}get overrides(){return this._overrides}get keys(){return this._keys}get raw(){if(this._raw&&!(Array.isArray(this._raw)&&this._raw.every(t=>t instanceof r)))return this._raw}isEmpty(){return this._keys.length===0&&Object.keys(this._contents).length===0&&this._overrides.length===0}getValue(t){return t?yv(this.contents,t):this.contents}inspect(t,e){let n=this;return{get value(){return Ib(n.rawConfiguration.getValue(t))},get override(){return e?Ib(n.rawConfiguration.getOverrideValue(t,e)):void 0},get merged(){return Ib(e?n.rawConfiguration.override(e).getValue(t):n.rawConfiguration.getValue(t))},get overrides(){let o=[];for(let{contents:i,identifiers:s,keys:a}of n.rawConfiguration.overrides){let l=new r(i,a,[],void 0,n.logService).getValue(t);l!==void 0&&o.push({identifiers:s,value:l})}return o.length?Ib(o):void 0}}}getOverrideValue(t,e){let n=this.getContentsForOverrideIdentifer(e);return n?t?yv(n,t):n:void 0}getKeysForOverrideIdentifier(t){let e=[];for(let n of this.overrides)n.identifiers.includes(t)&&e.push(...n.keys);return Br(e)}getAllOverrideIdentifiers(){let t=[];for(let e of this.overrides)t.push(...e.identifiers);return Br(t)}override(t){let e=this.overrideConfigurations.get(t);return e||(e=this.createOverrideConfigurationModel(t),this.overrideConfigurations.set(t,e)),e}merge(...t){let e=at(this.contents),n=at(this.overrides),o=[...this.keys],i=this._raw?Array.isArray(this._raw)?[...this._raw]:[this._raw]:[this];for(let s of t)if(i.push(...s._raw?Array.isArray(s._raw)?s._raw:[s._raw]:[s]),!s.isEmpty()){this.mergeContents(e,s.contents);for(let a of s.overrides){let[l]=n.filter(d=>rn(d.identifiers,a.identifiers));l?(this.mergeContents(l.contents,a.contents),l.keys.push(...a.keys),l.keys=Br(l.keys)):n.push(at(a))}for(let a of s.keys)o.indexOf(a)===-1&&o.push(a)}return new r(e,o,n,!i.length||i.every(s=>s instanceof r)?void 0:i,this.logService)}createOverrideConfigurationModel(t){let e=this.getContentsForOverrideIdentifer(t);if(!e||typeof e!="object"||!Object.keys(e).length)return this;let n={};for(let o of Br([...Object.keys(this.contents),...Object.keys(e)])){let i=this.contents[o],s=e[o];s&&(typeof i=="object"&&typeof s=="object"?(i=at(i),this.mergeContents(i,s)):i=s),n[o]=i}return new r(n,this.keys,this.overrides,void 0,this.logService)}mergeContents(t,e){for(let n of Object.keys(e)){if(n in t&&it(t[n])&&it(e[n])){this.mergeContents(t[n],e[n]);continue}t[n]=at(e[n])}}getContentsForOverrideIdentifer(t){let e=null,n=null,o=i=>{i&&(n?this.mergeContents(n,i):n=at(i))};for(let i of this.overrides)i.identifiers.length===1&&i.identifiers[0]===t?e=i.contents:i.identifiers.includes(t)&&o(i.contents);return o(e),n}toJSON(){return{contents:this.contents,overrides:this.overrides,keys:this.keys}}addValue(t,e){this.updateValue(t,e,!0)}setValue(t,e){this.updateValue(t,e,!1)}removeValue(t){let e=this.keys.indexOf(t);e!==-1&&(this.keys.splice(e,1),VH(this.contents,t),Xr.test(t)&&this.overrides.splice(this.overrides.findIndex(n=>rn(n.identifiers,Hp(t))),1))}updateValue(t,e,n){if(oA(this.contents,t,e,o=>this.logService.error(o)),n=n||this.keys.indexOf(t)===-1,n&&this.keys.push(t),Xr.test(t)){let o=this.contents[t],i=Hp(t),s={identifiers:i,keys:Object.keys(o),contents:Rx(o,l=>this.logService.error(l))},a=this.overrides.findIndex(l=>rn(l.identifiers,i));a!==-1?this.overrides[a]=s:this.overrides.push(s)}}},FM=class{constructor(t,e){this._name=t;this.logService=e;this._raw=null;this._configurationModel=null;this._restrictedConfigurations=[];this._parseErrors=[]}get configurationModel(){return this._configurationModel||hd.createEmptyModel(this.logService)}get restrictedConfigurations(){return this._restrictedConfigurations}get errors(){return this._parseErrors}parse(t,e){if(!Ot(t)){let n=this.doParseContent(t);this.parseRaw(n,e)}}reparse(t){this._raw&&this.parseRaw(this._raw,t)}parseRaw(t,e){this._raw=t;let{contents:n,keys:o,overrides:i,restricted:s,hasExcludedProperties:a}=this.doParseRaw(t,e);this._configurationModel=new hd(n,o,i,a?[t]:void 0,this.logService),this._restrictedConfigurations=s||[]}doParseContent(t){let e={},n=null,o=[],i=[],s=[];function a(d){Array.isArray(o)?o.push(d):n!==null&&(o[n]=d)}let l={onObjectBegin:()=>{let d={};a(d),i.push(o),o=d,n=null},onObjectProperty:d=>{n=d},onObjectEnd:()=>{o=i.pop()},onArrayBegin:()=>{let d=[];a(d),i.push(o),o=d,n=null},onArrayEnd:()=>{o=i.pop()},onLiteralValue:a,onError:(d,c,u)=>{s.push({error:d,offset:c,length:u})}};if(t)try{F4(t,l),e=o[0]||{}}catch(d){this.logService.error(`Error while parsing settings file ${this._name}: ${d}`),this._parseErrors=[d]}return e}doParseRaw(t,e){let n=vt.as(xr.Configuration),o=n.getConfigurationProperties(),i=n.getExcludedConfigurationProperties(),s=this.filter(t,o,i,!0,e);t=s.raw;let a=Rx(t,c=>this.logService.error(`Conflict in settings file ${this._name}: ${c}`)),l=Object.keys(t),d=this.toOverrides(t,c=>this.logService.error(`Conflict in settings file ${this._name}: ${c}`));return{contents:a,keys:l,overrides:d,restricted:s.restricted,hasExcludedProperties:s.hasExcludedProperties}}filter(t,e,n,o,i){let s=!1;if(!i?.scopes&&!i?.skipRestricted&&!i?.skipUnregistered&&!i?.exclude?.length)return{raw:t,restricted:[],hasExcludedProperties:s};let a={},l=[];for(let d in t)if(Xr.test(d)&&o){let c=this.filter(t[d],e,n,!1,i);a[d]=c.raw,s=s||c.hasExcludedProperties,l.push(...c.restricted)}else{let c=e[d];c?.restricted&&l.push(d),this.shouldInclude(d,c,n,i)?a[d]=t[d]:s=!0}return{raw:a,restricted:l,hasExcludedProperties:s}}shouldInclude(t,e,n,o){if(o.exclude?.includes(t))return!1;if(o.include?.includes(t))return!0;if(o.skipRestricted&&e?.restricted||o.skipUnregistered&&!e)return!1;let i=e??n[t],s=i?typeof i.scope<"u"?i.scope:4:void 0;return s===void 0||o.scopes===void 0?!0:o.scopes.includes(s)}toOverrides(t,e){let n=[];for(let o of Object.keys(t))if(Xr.test(o)){let i={},s=t[o];for(let a in s)i[a]=s[a];n.push({identifiers:Hp(o),keys:Object.keys(i),contents:Rx(i,e)})}return n}};var HM=class{constructor(t,e,n,o,i,s,a,l,d,c,u,m,g){this.key=t;this.overrides=e;this._value=n;this.overrideIdentifiers=o;this.defaultConfiguration=i;this.policyConfiguration=s;this.applicationConfiguration=a;this.userConfiguration=l;this.localUserConfiguration=d;this.remoteUserConfiguration=c;this.workspaceConfiguration=u;this.folderConfigurationModel=m;this.memoryConfigurationModel=g}get value(){return Ib(this._value)}toInspectValue(t){return t?.value!==void 0||t?.override!==void 0||t?.overrides!==void 0?t:void 0}get defaultInspectValue(){return this._defaultInspectValue||(this._defaultInspectValue=this.defaultConfiguration.inspect(this.key,this.overrides.overrideIdentifier)),this._defaultInspectValue}get defaultValue(){return this.defaultInspectValue.merged}get default(){return this.toInspectValue(this.defaultInspectValue)}get policyInspectValue(){return this._policyInspectValue===void 0&&(this._policyInspectValue=this.policyConfiguration?this.policyConfiguration.inspect(this.key):null),this._policyInspectValue}get policyValue(){return this.policyInspectValue?.merged}get policy(){return this.policyInspectValue?.value!==void 0?{value:this.policyInspectValue.value}:void 0}get applicationInspectValue(){return this._applicationInspectValue===void 0&&(this._applicationInspectValue=this.applicationConfiguration?this.applicationConfiguration.inspect(this.key):null),this._applicationInspectValue}get applicationValue(){return this.applicationInspectValue?.merged}get application(){return this.toInspectValue(this.applicationInspectValue)}get userInspectValue(){return this._userInspectValue||(this._userInspectValue=this.userConfiguration.inspect(this.key,this.overrides.overrideIdentifier)),this._userInspectValue}get userValue(){return this.userInspectValue.merged}get user(){return this.toInspectValue(this.userInspectValue)}get userLocalInspectValue(){return this._userLocalInspectValue||(this._userLocalInspectValue=this.localUserConfiguration.inspect(this.key,this.overrides.overrideIdentifier)),this._userLocalInspectValue}get userLocalValue(){return this.userLocalInspectValue.merged}get userLocal(){return this.toInspectValue(this.userLocalInspectValue)}get userRemoteInspectValue(){return this._userRemoteInspectValue||(this._userRemoteInspectValue=this.remoteUserConfiguration.inspect(this.key,this.overrides.overrideIdentifier)),this._userRemoteInspectValue}get userRemoteValue(){return this.userRemoteInspectValue.merged}get userRemote(){return this.toInspectValue(this.userRemoteInspectValue)}get workspaceInspectValue(){return this._workspaceInspectValue===void 0&&(this._workspaceInspectValue=this.workspaceConfiguration?this.workspaceConfiguration.inspect(this.key,this.overrides.overrideIdentifier):null),this._workspaceInspectValue}get workspaceValue(){return this.workspaceInspectValue?.merged}get workspace(){return this.toInspectValue(this.workspaceInspectValue)}get workspaceFolderInspectValue(){return this._workspaceFolderInspectValue===void 0&&(this._workspaceFolderInspectValue=this.folderConfigurationModel?this.folderConfigurationModel.inspect(this.key,this.overrides.overrideIdentifier):null),this._workspaceFolderInspectValue}get workspaceFolderValue(){return this.workspaceFolderInspectValue?.merged}get workspaceFolder(){return this.toInspectValue(this.workspaceFolderInspectValue)}get memoryInspectValue(){return this._memoryInspectValue===void 0&&(this._memoryInspectValue=this.memoryConfigurationModel.inspect(this.key,this.overrides.overrideIdentifier)),this._memoryInspectValue}get memoryValue(){return this.memoryInspectValue.merged}get memory(){return this.toInspectValue(this.memoryInspectValue)}},rg=class r{constructor(t,e,n,o,i,s,a,l,d,c){this._defaultConfiguration=t;this._policyConfiguration=e;this._applicationConfiguration=n;this._localUserConfiguration=o;this._remoteUserConfiguration=i;this._workspaceConfiguration=s;this._folderConfigurations=a;this._memoryConfiguration=l;this._memoryConfigurationByResource=d;this.logService=c;this._workspaceConsolidatedConfiguration=null;this._foldersConsolidatedConfigurations=new Ke;this._userConfiguration=null}getValue(t,e,n){return this.getConsolidatedConfigurationModel(t,e,n).getValue(t)}updateValue(t,e,n={}){let o;n.resource?(o=this._memoryConfigurationByResource.get(n.resource),o||(o=hd.createEmptyModel(this.logService),this._memoryConfigurationByResource.set(n.resource,o))):o=this._memoryConfiguration,e===void 0?o.removeValue(t):o.setValue(t,e),n.resource||(this._workspaceConsolidatedConfiguration=null)}inspect(t,e,n){let o=this.getConsolidatedConfigurationModel(t,e,n),i=this.getFolderConfigurationModelForResource(e.resource,n),s=e.resource?this._memoryConfigurationByResource.get(e.resource)||this._memoryConfiguration:this._memoryConfiguration,a=new Set;for(let l of o.overrides)for(let d of l.identifiers)o.getOverrideValue(t,d)!==void 0&&a.add(d);return new HM(t,e,o.getValue(t),a.size?[...a]:void 0,this._defaultConfiguration,this._policyConfiguration.isEmpty()?void 0:this._policyConfiguration,this.applicationConfiguration.isEmpty()?void 0:this.applicationConfiguration,this.userConfiguration,this.localUserConfiguration,this.remoteUserConfiguration,n?this._workspaceConfiguration:void 0,i||void 0,s)}keys(t){let e=this.getFolderConfigurationModelForResource(void 0,t);return{default:this._defaultConfiguration.keys.slice(0),policy:this._policyConfiguration.keys.slice(0),user:this.userConfiguration.keys.slice(0),workspace:this._workspaceConfiguration.keys.slice(0),workspaceFolder:e?e.keys.slice(0):[]}}updateDefaultConfiguration(t){this._defaultConfiguration=t,this._workspaceConsolidatedConfiguration=null,this._foldersConsolidatedConfigurations.clear()}updatePolicyConfiguration(t){this._policyConfiguration=t}updateApplicationConfiguration(t){this._applicationConfiguration=t,this._workspaceConsolidatedConfiguration=null,this._foldersConsolidatedConfigurations.clear()}updateLocalUserConfiguration(t){this._localUserConfiguration=t,this._userConfiguration=null,this._workspaceConsolidatedConfiguration=null,this._foldersConsolidatedConfigurations.clear()}updateRemoteUserConfiguration(t){this._remoteUserConfiguration=t,this._userConfiguration=null,this._workspaceConsolidatedConfiguration=null,this._foldersConsolidatedConfigurations.clear()}updateWorkspaceConfiguration(t){this._workspaceConfiguration=t,this._workspaceConsolidatedConfiguration=null,this._foldersConsolidatedConfigurations.clear()}updateFolderConfiguration(t,e){this._folderConfigurations.set(t,e),this._foldersConsolidatedConfigurations.delete(t)}deleteFolderConfiguration(t){this.folderConfigurations.delete(t),this._foldersConsolidatedConfigurations.delete(t)}compareAndUpdateDefaultConfiguration(t,e){let n=[];if(!e){let{added:o,updated:i,removed:s}=fd(this._defaultConfiguration,t);e=[...o,...i,...s]}for(let o of e)for(let i of Hp(o)){let s=this._defaultConfiguration.getKeysForOverrideIdentifier(i),a=t.getKeysForOverrideIdentifier(i),l=[...a.filter(d=>s.indexOf(d)===-1),...s.filter(d=>a.indexOf(d)===-1),...s.filter(d=>!qt(this._defaultConfiguration.override(i).getValue(d),t.override(i).getValue(d)))];n.push([i,l])}return this.updateDefaultConfiguration(t),{keys:e,overrides:n}}compareAndUpdatePolicyConfiguration(t){let{added:e,updated:n,removed:o}=fd(this._policyConfiguration,t),i=[...e,...n,...o];return i.length&&this.updatePolicyConfiguration(t),{keys:i,overrides:[]}}compareAndUpdateApplicationConfiguration(t){let{added:e,updated:n,removed:o,overrides:i}=fd(this.applicationConfiguration,t),s=[...e,...n,...o];return s.length&&this.updateApplicationConfiguration(t),{keys:s,overrides:i}}compareAndUpdateLocalUserConfiguration(t){let{added:e,updated:n,removed:o,overrides:i}=fd(this.localUserConfiguration,t),s=[...e,...n,...o];return s.length&&this.updateLocalUserConfiguration(t),{keys:s,overrides:i}}compareAndUpdateRemoteUserConfiguration(t){let{added:e,updated:n,removed:o,overrides:i}=fd(this.remoteUserConfiguration,t),s=[...e,...n,...o];return s.length&&this.updateRemoteUserConfiguration(t),{keys:s,overrides:i}}compareAndUpdateWorkspaceConfiguration(t){let{added:e,updated:n,removed:o,overrides:i}=fd(this.workspaceConfiguration,t),s=[...e,...n,...o];return s.length&&this.updateWorkspaceConfiguration(t),{keys:s,overrides:i}}compareAndUpdateFolderConfiguration(t,e){let n=this.folderConfigurations.get(t),{added:o,updated:i,removed:s,overrides:a}=fd(n,e),l=[...o,...i,...s];return(l.length||!n)&&this.updateFolderConfiguration(t,e),{keys:l,overrides:a}}compareAndDeleteFolderConfiguration(t){let e=this.folderConfigurations.get(t);if(!e)throw new Error("Unknown folder");this.deleteFolderConfiguration(t);let{added:n,updated:o,removed:i,overrides:s}=fd(e,void 0);return{keys:[...n,...o,...i],overrides:s}}get defaults(){return this._defaultConfiguration}get applicationConfiguration(){return this._applicationConfiguration}get userConfiguration(){if(!this._userConfiguration)if(this._remoteUserConfiguration.isEmpty())this._userConfiguration=this._localUserConfiguration;else{let t=this._localUserConfiguration.merge(this._remoteUserConfiguration);this._userConfiguration=new hd(t.contents,t.keys,t.overrides,void 0,this.logService)}return this._userConfiguration}get localUserConfiguration(){return this._localUserConfiguration}get remoteUserConfiguration(){return this._remoteUserConfiguration}get workspaceConfiguration(){return this._workspaceConfiguration}get folderConfigurations(){return this._folderConfigurations}getConsolidatedConfigurationModel(t,e,n){let o=this.getConsolidatedConfigurationModelForResource(e,n);if(e.overrideIdentifier&&(o=o.override(e.overrideIdentifier)),!this._policyConfiguration.isEmpty()&&this._policyConfiguration.getValue(t)!==void 0){o=o.merge();for(let i of this._policyConfiguration.keys)o.setValue(i,this._policyConfiguration.getValue(i))}return o}getConsolidatedConfigurationModelForResource({resource:t},e){let n=this.getWorkspaceConsolidatedConfiguration();if(e&&t){let o=e.getFolder(t);o&&(n=this.getFolderConsolidatedConfiguration(o.uri)||n);let i=this._memoryConfigurationByResource.get(t);i&&(n=n.merge(i))}return n}getWorkspaceConsolidatedConfiguration(){return this._workspaceConsolidatedConfiguration||(this._workspaceConsolidatedConfiguration=this._defaultConfiguration.merge(this.applicationConfiguration,this.userConfiguration,this._workspaceConfiguration,this._memoryConfiguration)),this._workspaceConsolidatedConfiguration}getFolderConsolidatedConfiguration(t){let e=this._foldersConsolidatedConfigurations.get(t);if(!e){let n=this.getWorkspaceConsolidatedConfiguration(),o=this._folderConfigurations.get(t);o?(e=n.merge(o),this._foldersConsolidatedConfigurations.set(t,e)):e=n}return e}getFolderConfigurationModelForResource(t,e){if(e&&t){let n=e.getFolder(t);if(n)return this._folderConfigurations.get(n.uri)}}toData(){return{defaults:{contents:this._defaultConfiguration.contents,overrides:this._defaultConfiguration.overrides,keys:this._defaultConfiguration.keys},policy:{contents:this._policyConfiguration.contents,overrides:this._policyConfiguration.overrides,keys:this._policyConfiguration.keys},application:{contents:this.applicationConfiguration.contents,overrides:this.applicationConfiguration.overrides,keys:this.applicationConfiguration.keys,raw:Array.isArray(this.applicationConfiguration.raw)?void 0:this.applicationConfiguration.raw},userLocal:{contents:this.localUserConfiguration.contents,overrides:this.localUserConfiguration.overrides,keys:this.localUserConfiguration.keys,raw:Array.isArray(this.localUserConfiguration.raw)?void 0:this.localUserConfiguration.raw},userRemote:{contents:this.remoteUserConfiguration.contents,overrides:this.remoteUserConfiguration.overrides,keys:this.remoteUserConfiguration.keys,raw:Array.isArray(this.remoteUserConfiguration.raw)?void 0:this.remoteUserConfiguration.raw},workspace:{contents:this._workspaceConfiguration.contents,overrides:this._workspaceConfiguration.overrides,keys:this._workspaceConfiguration.keys},folders:[...this._folderConfigurations.keys()].reduce((t,e)=>{let{contents:n,overrides:o,keys:i}=this._folderConfigurations.get(e);return t.push([e,{contents:n,overrides:o,keys:i}]),t},[])}}allKeys(){let t=new Set;return this._defaultConfiguration.keys.forEach(e=>t.add(e)),this.userConfiguration.keys.forEach(e=>t.add(e)),this._workspaceConfiguration.keys.forEach(e=>t.add(e)),this._folderConfigurations.forEach(e=>e.keys.forEach(n=>t.add(n))),[...t.values()]}allOverrideIdentifiers(){let t=new Set;return this._defaultConfiguration.getAllOverrideIdentifiers().forEach(e=>t.add(e)),this.userConfiguration.getAllOverrideIdentifiers().forEach(e=>t.add(e)),this._workspaceConfiguration.getAllOverrideIdentifiers().forEach(e=>t.add(e)),this._folderConfigurations.forEach(e=>e.getAllOverrideIdentifiers().forEach(n=>t.add(n))),[...t.values()]}getAllKeysForOverrideIdentifier(t){let e=new Set;return this._defaultConfiguration.getKeysForOverrideIdentifier(t).forEach(n=>e.add(n)),this.userConfiguration.getKeysForOverrideIdentifier(t).forEach(n=>e.add(n)),this._workspaceConfiguration.getKeysForOverrideIdentifier(t).forEach(n=>e.add(n)),this._folderConfigurations.forEach(n=>n.getKeysForOverrideIdentifier(t).forEach(o=>e.add(o))),[...e.values()]}static parse(t,e){let n=this.parseConfigurationModel(t.defaults,e),o=this.parseConfigurationModel(t.policy,e),i=this.parseConfigurationModel(t.application,e),s=this.parseConfigurationModel(t.userLocal,e),a=this.parseConfigurationModel(t.userRemote,e),l=this.parseConfigurationModel(t.workspace,e),d=t.folders.reduce((c,u)=>(c.set(b.revive(u[0]),this.parseConfigurationModel(u[1],e)),c),new Ke);return new r(n,o,i,s,a,l,d,hd.createEmptyModel(e),new Ke,e)}static parseConfigurationModel(t,e){return new hd(t.contents,t.keys,t.overrides,t.raw,e)}};var LT=class{constructor(t,e,n,o,i){this.change=t;this.previous=e;this.currentConfiguraiton=n;this.currentWorkspace=o;this.logService=i;this._marker=`
`;this._markerCode1=this._marker.charCodeAt(0);this._markerCode2=46;this.affectedKeys=new Set;this._previousConfiguration=void 0;for(let s of t.keys)this.affectedKeys.add(s);for(let[,s]of t.overrides)for(let a of s)this.affectedKeys.add(a);this._affectsConfigStr=this._marker;for(let s of this.affectedKeys)this._affectsConfigStr+=s+this._marker}get previousConfiguration(){return!this._previousConfiguration&&this.previous&&(this._previousConfiguration=rg.parse(this.previous.data,this.logService)),this._previousConfiguration}affectsConfiguration(t,e){let n=this._marker+t,o=this._affectsConfigStr.indexOf(n);if(o<0)return!1;let i=o+n.length;if(i>=this._affectsConfigStr.length)return!1;let s=this._affectsConfigStr.charCodeAt(i);if(s!==this._markerCode1&&s!==this._markerCode2)return!1;if(e){let a=this.previousConfiguration?this.previousConfiguration.getValue(t,e,this.previous?.workspace):void 0,l=this.currentConfiguraiton.getValue(t,e,this.currentWorkspace);return!qt(a,l)}return!0}};function fd(r,t){let{added:e,removed:n,updated:o}=H4(t?.rawConfiguration,r?.rawConfiguration),i=[],s=r?.getAllOverrideIdentifiers()||[],a=t?.getAllOverrideIdentifiers()||[];if(t){let l=a.filter(d=>!s.includes(d));for(let d of l)i.push([d,t.getKeysForOverrideIdentifier(d)])}if(r){let l=s.filter(d=>!a.includes(d));for(let d of l)i.push([d,r.getKeysForOverrideIdentifier(d)])}if(t&&r){for(let l of s)if(a.includes(l)){let d=H4({contents:r.getOverrideValue(void 0,l)||{},keys:r.getKeysForOverrideIdentifier(l)},{contents:t.getOverrideValue(void 0,l)||{},keys:t.getKeysForOverrideIdentifier(l)});i.push([l,[...d.added,...d.removed,...d.updated]])}}return{added:e,removed:n,updated:o,overrides:i}}function H4(r,t){let e=r?t?r.keys.filter(i=>t.keys.indexOf(i)===-1):[...r.keys]:[],n=t?r?t.keys.filter(i=>r.keys.indexOf(i)===-1):[...t.keys]:[],o=[];if(r&&t){for(let i of t.keys)if(r.keys.indexOf(i)!==-1){let s=yv(t.contents,i),a=yv(r.contents,i);qt(s,a)||o.push(i)}}return{added:e,removed:n,updated:o}}function OT(r,t){if(t){let e=t.split("."),n=r;for(let o=0;n&&o<e.length;o++)n=n[e[o]];return n}}function uq(r){return r instanceof b}function pq(r){return it(r)&&r.uri instanceof b&&!!r.languageId&&typeof r.languageId=="string"}function mq(r){return it(r)&&!r.uri&&!!r.languageId&&typeof r.languageId=="string"}function gq(r){return it(r)&&r.uri instanceof b&&(!r.name||typeof r.name=="string")&&(!r.index||typeof r.index=="number")}function W4(r){if(uq(r))return{resource:r};if(pq(r))return{resource:r.uri,overrideIdentifier:r.languageId};if(mq(r))return{overrideIdentifier:r.languageId};if(gq(r))return{resource:r.uri};if(r===null)return{resource:null}}var ig=class{constructor(t,e,n){this._proxy=t.getProxy(F.MainThreadConfiguration),this._extHostWorkspace=e,this._logService=n,this._barrier=new In,this._actual=null}getConfigProvider(){return this._barrier.wait().then(t=>this._actual)}$initializeConfiguration(t){this._actual=new WM(this._proxy,this._extHostWorkspace,t,this._logService),this._barrier.open()}$acceptConfigurationChanged(t,e){this.getConfigProvider().then(n=>n.$acceptConfigurationChanged(t,e))}};ig=_([C(0,se),C(1,On),C(2,oe)],ig);var WM=class{constructor(t,e,n,o){this._onDidChangeConfiguration=new E;this._proxy=t,this._logService=o,this._extHostWorkspace=e,this._configuration=rg.parse(n,o),this._configurationScopes=this._toMap(n.configurationScopes)}get onDidChangeConfiguration(){return this._onDidChangeConfiguration&&this._onDidChangeConfiguration.event}$acceptConfigurationChanged(t,e){let n={data:this._configuration.toData(),workspace:this._extHostWorkspace.workspace};this._configuration=rg.parse(t,this._logService),this._configurationScopes=this._toMap(t.configurationScopes),this._onDidChangeConfiguration.fire(this._toConfigurationChangeEvent(e,n))}getConfiguration(t,e,n){let o=W4(e)||{},i=this._toReadonlyValue(this._configuration.getValue(t,o,this._extHostWorkspace.workspace));t&&this._validateConfigurationAccess(t,o,n?.identifier);function s(l){if(l==null)return null;if(typeof l=="boolean")return l?2:5;switch(l){case 1:return 2;case 2:return 5;case 3:return 6}}let a={has(l){return typeof OT(i,l)<"u"},get:(l,d)=>{this._validateConfigurationAccess(t?`${t}.${l}`:l,o,n?.identifier);let c=OT(i,l);if(typeof c>"u")c=d;else{let u,m=(g,h)=>{if(it(g)){let f,I=()=>{u=u||at(i),f=f||OT(u,h)};return new Proxy(g,{get:(S,T)=>{if(typeof T=="string"&&T.toLowerCase()==="tojson")return I(),()=>f;if(u)return f=f||OT(u,h),f[T];let P=S[T];return typeof T=="string"?m(P,`${h}.${T}`):P},set:(S,T,P)=>(I(),f&&(f[T]=P),!0),deleteProperty:(S,T)=>(I(),f&&delete f[T],!0),defineProperty:(S,T,P)=>(I(),f&&Object.defineProperty(f,T,P),!0)})}return Array.isArray(g)?at(g):g};c=m(c,l)}return c},update:(l,d,c,u)=>{l=t?`${t}.${l}`:l;let m=s(c);return d!==void 0?this._proxy.$updateConfigurationOption(m,l,d,o,u):this._proxy.$removeConfigurationOption(m,l,o,u)},inspect:l=>{l=t?`${t}.${l}`:l;let d=this._configuration.inspect(l,o,this._extHostWorkspace.workspace);if(d)return{key:l,defaultValue:at(d.policy?.value??d.default?.value),globalLocalValue:at(d.userLocal?.value),globalRemoteValue:at(d.userRemote?.value),globalValue:at(d.user?.value??d.application?.value),workspaceValue:at(d.workspace?.value),workspaceFolderValue:at(d.workspaceFolder?.value),defaultLanguageValue:at(d.default?.override),globalLocalLanguageValue:at(d.userLocal?.override),globalRemoteLanguageValue:at(d.userRemote?.override),globalLanguageValue:at(d.user?.override??d.application?.override),workspaceLanguageValue:at(d.workspace?.override),workspaceFolderLanguageValue:at(d.workspaceFolder?.override),languageIds:at(d.overrideIdentifiers)}}};return typeof i=="object"&&Qo(a,i,!1),Object.freeze(a)}_toReadonlyValue(t){let e=n=>it(n)?new Proxy(n,{get:(o,i)=>e(o[i]),set:(o,i,s)=>{throw new Error(`TypeError: Cannot assign to read only property '${String(i)}' of object`)},deleteProperty:(o,i)=>{throw new Error(`TypeError: Cannot delete read only property '${String(i)}' of object`)},defineProperty:(o,i)=>{throw new Error(`TypeError: Cannot define property '${String(i)}' for a readonly object`)},setPrototypeOf:o=>{throw new Error("TypeError: Cannot set prototype for a readonly object")},isExtensible:()=>!1,preventExtensions:()=>!0}):n;return e(t)}_validateConfigurationAccess(t,e,n){let o=Xr.test(t)?5:this._configurationScopes.get(t),i=n?`[${n.value}] `:"";if(5===o){typeof e?.resource>"u"&&this._logService.warn(`${i}Accessing a resource scoped configuration without providing a resource is not expected. To get the effective value for '${t}', provide the URI of a resource or 'null' for any resource.`);return}if(4===o){e?.resource&&this._logService.warn(`${i}Accessing a window scoped configuration for a resource is not expected. To associate '${t}' to a resource, define its scope to 'resource' in configuration contributions in 'package.json'.`);return}}_toConfigurationChangeEvent(t,e){let n=new LT(t,e,this._configuration,this._extHostWorkspace.workspace,this._logService);return Object.freeze({affectsConfiguration:(o,i)=>n.affectsConfiguration(o,W4(i))})}_toMap(t){return t.reduce((e,n)=>(e.set(n[0],n[1]),e),new Map)}},Sn=R("IExtHostConfiguration");var BM=class{constructor(t,e){this.versionId=t;this.removedDueToLooping=e}},Ba=class r extends O{constructor(e,n){super();this._activationEventsReader=e;this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._versionId=0;this._extensionDescriptions=n,this._initialize()}static isHostExtension(e,n,o){if(n.getExtensionDescription(e))return!1;let i=o.getExtensionDescription(e);return i?!!((i.main||i.browser)&&i.api==="none"):!1}_initialize(){this._extensionDescriptions.sort(fq),this._extensionsMap=new uo,this._extensionsArr=[],this._activationMap=new Map;for(let e of this._extensionDescriptions){if(this._extensionsMap.has(e.identifier)){console.error("Extension `"+e.identifier.value+"` is already registered");continue}this._extensionsMap.set(e.identifier,e),this._extensionsArr.push(e);let n=this._activationEventsReader.readActivationEvents(e);for(let o of n)this._activationMap.has(o)||this._activationMap.set(o,[]),this._activationMap.get(o).push(e)}}set(e){return this._extensionDescriptions=e,this._initialize(),this._versionId++,this._onDidChange.fire(void 0),{versionId:this._versionId}}deltaExtensions(e,n){this._extensionDescriptions=V4(this._extensionDescriptions,n),this._extensionDescriptions=this._extensionDescriptions.concat(e);let o=r._findLoopingExtensions(this._extensionDescriptions);return this._extensionDescriptions=V4(this._extensionDescriptions,o.map(i=>i.identifier)),this._initialize(),this._versionId++,this._onDidChange.fire(void 0),new BM(this._versionId,o)}static _findLoopingExtensions(e){let n=new class{constructor(){this._arcs=new Map;this._nodesSet=new Set;this._nodesArr=[]}addNode(l){this._nodesSet.has(l)||(this._nodesSet.add(l),this._nodesArr.push(l))}addArc(l,d){this.addNode(l),this.addNode(d),this._arcs.has(l)?this._arcs.get(l).push(d):this._arcs.set(l,[d])}getArcs(l){return this._arcs.has(l)?this._arcs.get(l):[]}hasOnlyGoodArcs(l,d){let c=n.getArcs(l);for(let u=0;u<c.length;u++)if(!d.has(c[u]))return!1;return!0}getNodes(){return this._nodesArr}},o=new uo;for(let l of e)if(o.set(l.identifier,l),l.extensionDependencies)for(let d of l.extensionDependencies)n.addArc(Ee.toKey(l.identifier),Ee.toKey(d));let i=new Set;n.getNodes().filter(l=>n.getArcs(l).length===0).forEach(l=>i.add(l));let s=n.getNodes().filter(l=>!i.has(l)),a;do{a=!1;for(let l=0;l<s.length;l++){let d=s[l];n.hasOnlyGoodArcs(d,i)&&(s.splice(l,1),l--,i.add(d),a=!0)}}while(a);return s.map(l=>o.get(l))}containsActivationEvent(e){return this._activationMap.has(e)}containsExtension(e){return this._extensionsMap.has(e)}getExtensionDescriptionsForActivationEvent(e){let n=this._activationMap.get(e);return n?n.slice(0):[]}getAllExtensionDescriptions(){return this._extensionsArr.slice(0)}getSnapshot(){return new $M(this._versionId,this.getAllExtensionDescriptions())}getExtensionDescription(e){let n=this._extensionsMap.get(e);return n||void 0}getExtensionDescriptionByUUID(e){for(let n of this._extensionsArr)if(n.uuid===e)return n}getExtensionDescriptionByIdOrUUID(e,n){return this.getExtensionDescription(e)??(n?this.getExtensionDescriptionByUUID(n):void 0)}},$M=class{constructor(t,e){this.versionId=t;this.extensions=e}};function fq(r,t){let e=r.isBuiltin?0:r.isUnderDevelopment?2:1,n=t.isBuiltin?0:t.isUnderDevelopment?2:1;if(e!==n)return e-n;let o=Ge.basename(r.extensionLocation.path),i=Ge.basename(t.extensionLocation.path);return o<i?-1:o>i?1:0}function V4(r,t){let e=new No(t);return r.filter(n=>!e.has(n.identifier))}var mu=class r{static{this.NONE=new r(!1,-1,-1,-1)}constructor(t,e,n,o){this.startup=t,this.codeLoadingTime=e,this.activateCallTime=n,this.activateResolvedTime=o}},ag=class{constructor(t){this._startup=t,this._codeLoadingStart=-1,this._codeLoadingStop=-1,this._activateCallStart=-1,this._activateCallStop=-1,this._activateResolveStart=-1,this._activateResolveStop=-1}_delta(t,e){return t===-1||e===-1?-1:e-t}build(){return new mu(this._startup,this._delta(this._codeLoadingStart,this._codeLoadingStop),this._delta(this._activateCallStart,this._activateCallStop),this._delta(this._activateResolveStart,this._activateResolveStop))}codeLoadingStart(){this._codeLoadingStart=Date.now()}codeLoadingStop(){this._codeLoadingStop=Date.now()}activateCallStart(){this._activateCallStart=Date.now()}activateCallStop(){this._activateCallStop=Date.now()}activateResolveStart(){this._activateResolveStart=Date.now()}activateResolveStop(){this._activateResolveStop=Date.now()}},gu=class{constructor(t,e,n,o,i,s){this.activationFailed=t,this.activationFailedError=e,this.activationTimes=n,this.module=o,this.exports=i,this.disposable=s}},NT=class extends gu{constructor(t){super(!1,null,t,{activate:void 0,deactivate:void 0},void 0,O.None)}},UT=class extends gu{constructor(){super(!1,null,mu.NONE,{activate:void 0,deactivate:void 0},void 0,O.None)}},lg=class extends gu{constructor(t){super(!0,t,mu.NONE,{activate:void 0,deactivate:void 0},void 0,O.None)}},sg=class{constructor(t,e,n,o){this._logService=o;this._registry=t,this._globalRegistry=e,this._host=n,this._operations=new uo,this._alreadyActivatedEvents=Object.create(null)}dispose(){for(let[t,e]of this._operations)e.dispose()}async waitForActivatingExtensions(){let t=[];for(let[e,n]of this._operations)t.push(n.wait());await Promise.all(t)}isActivated(t){let e=this._operations.get(t);return!!(e&&e.value)}getActivatedExtension(t){let e=this._operations.get(t);if(!e||!e.value)throw new Error(`Extension '${t.value}' is not known or not activated`);return e.value}async activateByEvent(t,e){if(this._alreadyActivatedEvents[t])return;let n=this._registry.getExtensionDescriptionsForActivationEvent(t);await this._activateExtensions(n.map(o=>({id:o.identifier,reason:{startup:e,extensionId:o.identifier,activationEvent:t}}))),this._alreadyActivatedEvents[t]=!0}activateById(t,e){let n=this._registry.getExtensionDescription(t);if(!n)throw new Error(`Extension '${t.value}' is not known`);return this._activateExtensions([{id:n.identifier,reason:e}])}async _activateExtensions(t){let e=t.filter(n=>!this.isActivated(n.id)).map(n=>this._handleActivationRequest(n));await Promise.all(e.map(n=>n.wait()))}_handleActivationRequest(t){if(this._operations.has(t.id))return this._operations.get(t.id);if(this._isHostExtension(t.id))return this._createAndSaveOperation(t,null,[],null);let e=this._registry.getExtensionDescription(t.id);if(!e){let i=new Error(`Cannot activate unknown extension '${t.id.value}'`),s=this._createAndSaveOperation(t,null,[],new lg(i));return this._host.onExtensionActivationError(t.id,i,new Tv(t.id.value)),s}let n=[],o=typeof e.extensionDependencies>"u"?[]:e.extensionDependencies;for(let i of o){if(this._isResolvedExtension(i))continue;let s=this._operations.get(i);if(s){n.push(s);continue}if(this._isHostExtension(i)){n.push(this._handleActivationRequest({id:this._globalRegistry.getExtensionDescription(i).identifier,reason:t.reason}));continue}let a=this._registry.getExtensionDescription(i);if(a){if(!a.main&&!a.browser)continue;n.push(this._handleActivationRequest({id:a.identifier,reason:t.reason}));continue}let l=e.displayName||e.identifier.value,d=new Error(`Cannot activate the '${l}' extension because it depends on unknown extension '${i}'`),c=this._createAndSaveOperation(t,e.displayName,[],new lg(d));return this._host.onExtensionActivationError(e.identifier,d,new Tv(i)),c}return this._createAndSaveOperation(t,e.displayName,n,null)}_createAndSaveOperation(t,e,n,o){let i=new xb(t.id,e,t.reason,n,o,this._host,this._logService);return this._operations.set(t.id,i),i}_isHostExtension(t){return Ba.isHostExtension(t,this._registry,this._globalRegistry)}_isResolvedExtension(t){let e=this._globalRegistry.getExtensionDescription(t);return e?!e.main&&!e.browser:!1}};sg=_([C(3,oe)],sg);var xb=class{constructor(t,e,n,o,i,s,a){this._id=t;this._displayName=e;this._reason=n;this._deps=o;this._value=i;this._host=s;this._logService=a;this._barrier=new In;this._isDisposed=!1;this._initialize()}get value(){return this._value}get friendlyName(){return this._displayName||this._id.value}dispose(){this._isDisposed=!0}wait(){return this._barrier.wait()}async _initialize(){await this._waitForDepsThenActivate(),this._barrier.open()}async _waitForDepsThenActivate(){if(!this._value){for(;this._deps.length>0;){for(let t=0;t<this._deps.length;t++){let e=this._deps[t];if(e.value&&!e.value.activationFailed){this._deps.splice(t,1),t--;continue}if(e.value&&e.value.activationFailed){let n=new Error(`Cannot activate the '${this.friendlyName}' extension because its dependency '${e.friendlyName}' failed to activate`);n.detail=e.value.activationFailedError,this._value=new lg(n),this._host.onExtensionActivationError(this._id,n,null);return}}this._deps.length>0&&await Promise.race(this._deps.map(t=>t.wait()))}await this._activate()}}async _activate(){try{this._value=await this._host.actualActivateExtension(this._id,this._reason)}catch(t){let e=new Error;if(t&&t.name&&(e.name=t.name),t&&t.message?e.message=`Activating extension '${this._id.value}' failed: ${t.message}.`:e.message=`Activating extension '${this._id.value}' failed: ${t}.`,t&&t.stack&&(e.stack=t.stack),this._value=new lg(e),this._isDisposed&&Qt(t))return;this._host.onExtensionActivationError(this._id,e,null),this._logService.error(`Activating extension ${this._id.value} failed due to an error:`),this._logService.error(t)}}};xb=_([C(6,oe)],xb);var dg=class{constructor(t,e){this._logService=e;this._onDidChangeStorage=new E;this.onDidChangeStorage=this._onDidChangeStorage.event;this._proxy=t.getProxy(F.MainThreadStorage)}registerExtensionStorageKeysToSync(t,e){this._proxy.$registerExtensionStorageKeysToSync(t,e)}async initializeExtensionStorage(t,e,n){let o=await this._proxy.$initializeExtensionStorage(t,e),i;return o&&(i=this.safeParseValue(t,e,o)),i||n}setValue(t,e,n){return this._proxy.$setValue(t,e,n)}$acceptValue(t,e,n){let o=this.safeParseValue(t,e,n);o&&this._onDidChangeStorage.fire({shared:t,key:e,value:o})}safeParseValue(t,e,n){try{return JSON.parse(n)}catch(o){this._logService.error(`[extHostStorage] unexpected error parsing storage contents (extensionId: ${e}, global: ${t}): ${o}`)}}},cg=R("IExtHostStorage");var Sb=class{constructor(t,e,n){this._deferredPromises=new Map;this._id=t,this._shared=e,this._storage=n,this._init=this._storage.initializeExtensionStorage(this._shared,this._id,Object.create(null)).then(o=>(this._value=o,this)),this._storageListener=this._storage.onDidChangeStorage(o=>{o.shared===this._shared&&o.key===this._id&&(this._value=o.value)}),this._scheduler=new jn(()=>{let o=this._deferredPromises;this._deferredPromises=new Map,(async()=>{try{await this._storage.setValue(this._shared,this._id,this._value);for(let i of o.values())i.complete()}catch(i){for(let s of o.values())s.error(i)}})()},0)}keys(){return Object.entries(this._value??{}).filter(([,t])=>t!==void 0).map(([t])=>t)}get whenReady(){return this._init}get(t,e){let n=this._value[t];return typeof n>"u"&&(n=e),n}update(t,e){e!==null&&typeof e=="object"?this._value[t]=JSON.parse(JSON.stringify(e)):this._value[t]=e;let n=this._deferredPromises.get(t);if(n!==void 0)return n.p;let o=new Jt;return this._deferredPromises.set(t,o),this._scheduler.isScheduled()||this._scheduler.schedule(),o.p}dispose(){this._storageListener.dispose()}},FT=class extends Sb{setKeysForSync(t){this._storage.registerExtensionStorageKeysToSync({id:this._id,version:this._extension.version},t)}constructor(t,e){super(t.identifier.value,!0,e),this._extension=t}};var or=class{constructor(t,e){this._fileSystemProvider=new Map;this._writeQueue=new dp;this._proxy=t.getProxy(F.MainThreadFileSystem);let n=this;this.value=Object.freeze({async stat(o){try{let i,s=n._fileSystemProvider.get(o.scheme);return s?(await n._proxy.$ensureActivation(o.scheme),i=await s.impl.stat(o)):i=await n._proxy.$stat(o),{type:i.type,ctime:i.ctime,mtime:i.mtime,size:i.size,permissions:i.permissions===1?1:void 0}}catch(i){or._handleError(i)}},async readDirectory(o){try{let i=n._fileSystemProvider.get(o.scheme);return i?(await n._proxy.$ensureActivation(o.scheme),(await i.impl.readDirectory(o)).slice()):await n._proxy.$readdir(o)}catch(i){return or._handleError(i)}},async createDirectory(o){try{let i=n._fileSystemProvider.get(o.scheme);return i&&!i.isReadonly?(await n._proxy.$ensureActivation(o.scheme),await n.mkdirp(i.impl,i.extUri,o)):await n._proxy.$mkdir(o)}catch(i){return or._handleError(i)}},async readFile(o){try{let i=n._fileSystemProvider.get(o.scheme);return i?(await n._proxy.$ensureActivation(o.scheme),(await i.impl.readFile(o)).slice()):(await n._proxy.$readFile(o)).buffer}catch(i){return or._handleError(i)}},async writeFile(o,i){try{let s=n._fileSystemProvider.get(o.scheme);return s&&!s.isReadonly?(await n._proxy.$ensureActivation(o.scheme),await n.mkdirp(s.impl,s.extUri,s.extUri.dirname(o)),await n._writeQueue.queueFor(o,()=>Promise.resolve(s.impl.writeFile(o,i,{create:!0,overwrite:!0})))):await n._proxy.$writeFile(o,H.wrap(i))}catch(s){return or._handleError(s)}},async delete(o,i){try{let s=n._fileSystemProvider.get(o.scheme);return s&&!s.isReadonly&&!i?.useTrash?(await n._proxy.$ensureActivation(o.scheme),await s.impl.delete(o,{recursive:!1,...i})):await n._proxy.$delete(o,{recursive:!1,useTrash:!1,atomic:!1,...i})}catch(s){return or._handleError(s)}},async rename(o,i,s){try{return await n._proxy.$rename(o,i,{overwrite:!1,...s})}catch(a){return or._handleError(a)}},async copy(o,i,s){try{return await n._proxy.$copy(o,i,{overwrite:!1,...s})}catch(a){return or._handleError(a)}},isWritableFileSystem(o){let i=e.getCapabilities(o);if(typeof i=="number")return!(i&2048)}})}async mkdirp(t,e,n){let o=[];for(;!e.isEqual(n,e.dirname(n));)try{if(((await t.stat(n)).type&2)===0)throw bt.FileExists(`Unable to create folder '${n.scheme===V.file?n.fsPath:n.toString(!0)}' that already exists but is not a directory`);break}catch(i){if(Ep(i)!=="EntryNotFound")throw i;o.push(e.basename(n)),n=e.dirname(n)}for(let i=o.length-1;i>=0;i--){n=e.joinPath(n,o[i]);try{await t.createDirectory(n)}catch(s){if(Ep(s)!=="EntryExists")throw s}}}static _handleError(t){if(t instanceof bt)throw t;if(t instanceof Sl)switch(t.code){case"EntryExists":throw bt.FileExists(t.message);case"EntryNotFound":throw bt.FileNotFound(t.message);case"EntryNotADirectory":throw bt.FileNotADirectory(t.message);case"EntryIsADirectory":throw bt.FileIsADirectory(t.message);case"NoPermissions":throw bt.NoPermissions(t.message);case"Unavailable":throw bt.Unavailable(t.message);default:throw new bt(t.message,t.name)}if(!(t instanceof Error))throw new bt(String(t));if(t.name==="ENOPRO"||t.message.includes("ENOPRO"))throw bt.Unavailable(t.message);switch(t.name){case"EntryExists":throw bt.FileExists(t.message);case"EntryNotFound":throw bt.FileNotFound(t.message);case"EntryNotADirectory":throw bt.FileNotADirectory(t.message);case"EntryIsADirectory":throw bt.FileIsADirectory(t.message);case"NoPermissions":throw bt.NoPermissions(t.message);case"Unavailable":throw bt.Unavailable(t.message);default:throw new bt(t.message,t.name)}}addFileSystemProvider(t,e,n){return this._fileSystemProvider.set(t,{impl:e,extUri:n?.isCaseSensitive?ft:v_,isReadonly:!!n?.isReadonly}),K(()=>this._fileSystemProvider.delete(t))}getFileSystemProviderExtUri(t){return this._fileSystemProvider.get(t)?.extUri??ft}};or=_([C(0,se),C(1,Gr)],or);var Hs=R("IExtHostConsumerFileSystem");var pg=R("IExtensionStoragePaths"),ug=class{constructor(t,e,n){this._logService=e;this._extHostFileSystem=n;this._workspace=t.workspace??void 0,this._environment=t.environment,this.whenReady=this._getOrCreateWorkspaceStoragePath().then(o=>this._value=o)}async _getWorkspaceStorageURI(t){return b.joinPath(this._environment.workspaceStorageHome,t)}async _getOrCreateWorkspaceStoragePath(){if(!this._workspace)return Promise.resolve(void 0);let t=this._workspace.id,e=await this._getWorkspaceStorageURI(t);try{return await this._extHostFileSystem.value.stat(e),this._logService.trace("[ExtHostStorage] storage dir already exists",e),e}catch{}try{return this._logService.trace("[ExtHostStorage] creating dir and metadata-file",e),await this._extHostFileSystem.value.createDirectory(e),await this._extHostFileSystem.value.writeFile(b.joinPath(e,"meta.json"),new TextEncoder().encode(JSON.stringify({id:this._workspace.id,configuration:b.revive(this._workspace.configuration)?.toString(),name:this._workspace.name},void 0,2))),e}catch(n){this._logService.error("[ExtHostStorage]",n);return}}workspaceValue(t){if(this._value)return b.joinPath(this._value,t.identifier.value)}globalValue(t){return b.joinPath(this._environment.globalStorageHome,t.identifier.value.toLowerCase())}onWillDeactivateAll(){}};ug=_([C(0,Ye),C(1,oe),C(2,Hs)],ug);var B4=R("tunnelService"),WRe=R("sharedTunnelsService");function $4(r){return!!r.forwardPort}function hq(r){if(r.scheme!=="http"&&r.scheme!=="https")return;let t=/^(localhost|127\.0\.0\.1|0\.0\.0\.0):(\d+)$/.exec(r.authority);if(t)return{address:t[1],port:+t[2]}}var gg=["localhost","127.0.0.1","0:0:0:0:0:0:0:1","::1"];function Ws(r){return gg.indexOf(r)>=0}var Cb=["0.0.0.0","0:0:0:0:0:0:0:0","::"];function si(r){return Cb.indexOf(r)>=0}function z4(r,t,e,n){if(e===1)return!1;if(e===2&&si(t)){let o=/(\d+)\.(\d+)\.(\d+)/g.exec(n);if(o?.length===4&&parseInt(o[1])>=18)return!1}return r<1024}var HT=class{constructor(t,e,n){this.remoteAddress=t;this.localAddress=e;this._dispose=n;this._onDispose=new E;this.onDidDispose=this._onDispose.event}dispose(){return this._onDispose.fire(),this._onDispose.dispose(),this._dispose()}},mg=class extends O{constructor(e,n){super();this.logService=e;this.configurationService=n;this._onTunnelOpened=this._register(new E);this.onTunnelOpened=this._onTunnelOpened.event;this._onTunnelClosed=this._register(new E);this.onTunnelClosed=this._onTunnelClosed.event;this._onAddedTunnelProvider=this._register(new E);this.onAddedTunnelProvider=this._onAddedTunnelProvider.event;this._tunnels=new Map;this._canElevate=!1;this._canChangeProtocol=!0;this._privacyOptions=[];this._factoryInProgress=new Set}get hasTunnelProvider(){return!!this._tunnelProvider}get defaultTunnelHost(){let e=this.configurationService.getValue("remote.localPortHost");return!e||e==="localhost"?"127.0.0.1":"0.0.0.0"}setTunnelProvider(e){return this._tunnelProvider=e,e?(this._onAddedTunnelProvider.fire(),{dispose:()=>{this._tunnelProvider=void 0,this._canElevate=!1,this._privacyOptions=[]}}):(this._canElevate=!1,this._privacyOptions=[],this._onAddedTunnelProvider.fire(),{dispose:()=>{}})}setTunnelFeatures(e){this._canElevate=e.elevation,this._privacyOptions=e.privacyOptions,this._canChangeProtocol=e.protocol}get canChangeProtocol(){return this._canChangeProtocol}get canElevate(){return this._canElevate}get canChangePrivacy(){return this._privacyOptions.length>0}get privacyOptions(){return this._privacyOptions}get tunnels(){return this.getTunnels()}async getTunnels(){let e=[],n=Array.from(this._tunnels.values());for(let o of n){let i=Array.from(o.values());for(let s of i){let a=await s.value;a&&typeof a!="string"&&e.push(a)}}return e}async dispose(){super.dispose();for(let e of this._tunnels.values()){for(let{value:n}of e.values())await n.then(o=>typeof o!="string"?o?.dispose():void 0);e.clear()}this._tunnels.clear()}setEnvironmentTunnel(e,n,o,i,s){this.addTunnelToMap(e,n,Promise.resolve({tunnelRemoteHost:e,tunnelRemotePort:n,localAddress:o,privacy:i,protocol:s,dispose:()=>Promise.resolve()}))}async getExistingTunnel(e,n){(si(e)||Ws(e))&&(e=gg[0]);let o=this.getTunnelFromMap(e,n);if(o)return++o.refcount,o.value}openTunnel(e,n,o,i,s,a=!1,l,d){this.logService.trace(`ForwardedPorts: (TunnelService) openTunnel request for ${n}:${o} on local port ${s}.`);let c=this._tunnelProvider??e;if(!c)return;if(n||(n="localhost"),i||(i=this.defaultTunnelHost),this._tunnelProvider&&this._factoryInProgress.has(o)){this.logService.debug("ForwardedPorts: (TunnelService) Another call to create a tunnel with the same address has occurred before the last one completed. This call will be ignored.");return}let u=this.retainOrCreateTunnel(c,n,o,i,s,a,l,d);return u?u.then(m=>{if(m){if(typeof m=="string")return this.logService.trace("ForwardedPorts: (TunnelService) The tunnel provider returned an error when creating the tunnel."),this.removeEmptyOrErrorTunnelFromMap(n,o),m}else{this.logService.trace("ForwardedPorts: (TunnelService) New tunnel is undefined."),this.removeEmptyOrErrorTunnelFromMap(n,o);return}this.logService.trace("ForwardedPorts: (TunnelService) New tunnel established.");let g=this.makeTunnel(m);return(m.tunnelRemoteHost!==n||m.tunnelRemotePort!==o)&&this.logService.warn("ForwardedPorts: (TunnelService) Created tunnel does not match requirements of requested tunnel. Host or port mismatch."),l&&m.privacy!==l&&this.logService.warn("ForwardedPorts: (TunnelService) Created tunnel does not match requirements of requested tunnel. Privacy mismatch."),this._onTunnelOpened.fire(g),g}):(this.logService.trace("ForwardedPorts: (TunnelService) Tunnel was not created."),u)}makeTunnel(e){return{tunnelRemotePort:e.tunnelRemotePort,tunnelRemoteHost:e.tunnelRemoteHost,tunnelLocalPort:e.tunnelLocalPort,localAddress:e.localAddress,privacy:e.privacy,protocol:e.protocol,dispose:async()=>{this.logService.trace(`ForwardedPorts: (TunnelService) dispose request for ${e.tunnelRemoteHost}:${e.tunnelRemotePort} `);let n=this._tunnels.get(e.tunnelRemoteHost);if(n){let o=n.get(e.tunnelRemotePort);o&&(o.refcount--,await this.tryDisposeTunnel(e.tunnelRemoteHost,e.tunnelRemotePort,o))}}}}async tryDisposeTunnel(e,n,o){if(o.refcount<=0){this.logService.trace(`ForwardedPorts: (TunnelService) Tunnel is being disposed ${e}:${n}.`);let i=o.value.then(async s=>{s&&typeof s!="string"&&(await s.dispose(!0),this._onTunnelClosed.fire({host:s.tunnelRemoteHost,port:s.tunnelRemotePort}))});return this._tunnels.has(e)&&this._tunnels.get(e).delete(n),i}}async closeTunnel(e,n){this.logService.trace(`ForwardedPorts: (TunnelService) close request for ${e}:${n} `);let o=this._tunnels.get(e);if(o&&o.has(n)){let i=o.get(n);i.refcount=0,await this.tryDisposeTunnel(e,n,i)}}addTunnelToMap(e,n,o){this._tunnels.has(e)||this._tunnels.set(e,new Map),this._tunnels.get(e).set(n,{refcount:1,value:o})}async removeEmptyOrErrorTunnelFromMap(e,n){let o=this._tunnels.get(e);if(o){let i=o.get(n),s=i?await i.value:void 0;(!s||typeof s=="string")&&o.delete(n),o.size===0&&this._tunnels.delete(e)}}getTunnelFromMap(e,n){let o=[e];Ws(e)?(o.push(...gg),o.push(...Cb)):si(e)&&o.push(...Cb);let i=o.map(s=>this._tunnels.get(s));for(let s of i){let a=s?.get(n);if(a)return a}}canTunnel(e){return!!hq(e)}createWithProvider(e,n,o,i,s,a,l){this.logService.trace(`ForwardedPorts: (TunnelService) Creating tunnel with provider ${n}:${o} on local port ${i}.`);let d=o;this._factoryInProgress.add(d);let c=i===void 0?o:i,u={elevationRequired:s?this.isPortPrivileged(c):!1},m={remoteAddress:{host:n,port:o},localAddressPort:i,privacy:a,public:a?a!=="private":void 0,protocol:l},g=e.forwardPort(m,u);return g?(this.addTunnelToMap(n,o,g),g.finally(()=>{this.logService.trace("ForwardedPorts: (TunnelService) Tunnel created by provider."),this._factoryInProgress.delete(d)})):this._factoryInProgress.delete(d),g}};mg=_([C(0,oe),C(1,Kt)],mg);var zM=class extends HT{},K4;(e=>{function r(n){return{remoteAddress:n.remoteAddress,localAddress:n.localAddress,public:!!n.public,privacy:n.privacy??(n.public?"public":"private"),protocol:n.protocol}}e.fromApiTunnel=r;function t(n){return{remoteAddress:{host:n.tunnelRemoteHost,port:n.tunnelRemotePort},localAddress:n.localAddress,public:n.privacy!=="constantPrivate"&&n.privacy!=="constantPrivate",privacy:n.privacy,protocol:n.protocol}}e.fromServiceTunnel=t})(K4||={});var bd=R("IExtHostTunnelService"),vd=class extends O{constructor(e,n,o){super();this.logService=o;this._showCandidatePort=()=>Promise.resolve(!0);this._extensionTunnels=new Map;this._onDidChangeTunnels=this._register(new E);this.onDidChangeTunnels=this._onDidChangeTunnels.event;this._providerHandleCounter=0;this._portAttributesProviders=new Map;this._proxy=e.getProxy(F.MainThreadTunnelService)}async openTunnel(e,n){this.logService.trace(`ForwardedPorts: (ExtHostTunnelService) ${e.identifier.value} called openTunnel API for ${n.remoteAddress.host}:${n.remoteAddress.port}.`);let o=await this._proxy.$openTunnel(n,e.displayName);if(o){let i=new zM(o.remoteAddress,o.localAddress,()=>this._proxy.$closeTunnel(o.remoteAddress));return this._register(i),i}}async getTunnels(){return this._proxy.$getTunnels()}nextPortAttributesProviderHandle(){return this._providerHandleCounter++}registerPortsAttributesProvider(e,n){e.portRange===void 0&&e.commandPattern===void 0&&this.logService.error("PortAttributesProvider must specify either a portRange or a commandPattern");let o=this.nextPortAttributesProviderHandle();return this._portAttributesProviders.set(o,{selector:e,provider:n}),this._proxy.$registerPortsAttributesProvider(e,o),new be(()=>{this._portAttributesProviders.delete(o),this._proxy.$unregisterPortsAttributesProvider(o)})}async $providePortAttributes(e,n,o,i,s){let a=[];for(let d of e){let c=this._portAttributesProviders.get(d);if(!c)return[];a.push(...await Promise.all(n.map(async u=>{let m;try{m=await c.provider.providePortAttributes({port:u,pid:o,commandLine:i},s)}catch{m=await c.provider.providePortAttributes(u,o,i,s)}return{providedAttributes:m,port:u}})))}let l=a.filter(d=>!!d.providedAttributes);return l.length>0?l.map(d=>({autoForwardAction:d.providedAttributes.autoForwardAction,port:d.port})):[]}async $registerCandidateFinder(e){}registerTunnelProvider(e,n){if(this._forwardPortProvider)throw new Error("A tunnel provider has already been registered. Only the first tunnel provider to be registered will be used.");this._forwardPortProvider=async(i,s)=>await e.provideTunnel(i,s,ve.None)??void 0;let o=n.tunnelFeatures?{elevation:!!n.tunnelFeatures?.elevation,privacyOptions:n.tunnelFeatures?.privacyOptions,protocol:n.tunnelFeatures.protocol===void 0?!0:n.tunnelFeatures.protocol}:void 0;return this._proxy.$setTunnelProvider(o,!0),Promise.resolve(K(()=>{this._forwardPortProvider=void 0,this._proxy.$setTunnelProvider(void 0,!1)}))}hasTunnelProvider(){return this._proxy.$hasTunnelProvider()}async setTunnelFactory(e,n){if(e){e.candidatePortSource!==void 0&&this._proxy.$setCandidatePortSource(e.candidatePortSource),e.showCandidatePort&&(this._showCandidatePort=e.showCandidatePort,this._proxy.$setCandidateFilter());let o=e.tunnelFactory??(n?this.makeManagedTunnelFactory(n):void 0);if(o){this._forwardPortProvider=o;let i=e.tunnelFeatures?.privacyOptions??[];e.tunnelFeatures?.public&&i.length===0&&(i=[{id:"private",label:p(3502,null),themeIcon:"lock"},{id:"public",label:p(3503,null),themeIcon:"eye"}]);let s=e.tunnelFeatures?{elevation:!!e.tunnelFeatures?.elevation,public:!!e.tunnelFeatures?.public,privacyOptions:i,protocol:!0}:void 0;this._proxy.$setTunnelProvider(s,!!e.tunnelFactory)}}else this._forwardPortProvider=void 0;return K(()=>{this._forwardPortProvider=void 0})}makeManagedTunnelFactory(e){}async $closeTunnel(e,n){if(this._extensionTunnels.has(e.host)){let o=this._extensionTunnels.get(e.host);o.has(e.port)&&(n&&o.get(e.port).disposeListener.dispose(),await o.get(e.port).tunnel.dispose(),o.delete(e.port))}}async $onDidTunnelsChange(){this._onDidChangeTunnels.fire()}async $forwardPort(e,n){if(this._forwardPortProvider)try{this.logService.trace("ForwardedPorts: (ExtHostTunnelService) Getting tunnel from provider.");let o=this._forwardPortProvider(e,n);if(this.logService.trace("ForwardedPorts: (ExtHostTunnelService) Got tunnel promise from provider."),o!==void 0){let i=await o;if(this.logService.trace("ForwardedPorts: (ExtHostTunnelService) Successfully awaited tunnel from provider."),i===void 0){this.logService.error("ForwardedPorts: (ExtHostTunnelService) Resolved tunnel is undefined");return}this._extensionTunnels.has(e.remoteAddress.host)||this._extensionTunnels.set(e.remoteAddress.host,new Map);let s=this._register(i.onDidDispose(()=>(this.logService.trace("ForwardedPorts: (ExtHostTunnelService) Extension fired tunnel's onDidDispose."),this._proxy.$closeTunnel(i.remoteAddress))));return this._extensionTunnels.get(e.remoteAddress.host).set(e.remoteAddress.port,{tunnel:i,disposeListener:s}),K4.fromApiTunnel(i)}else this.logService.trace("ForwardedPorts: (ExtHostTunnelService) Tunnel is undefined")}catch(o){if(this.logService.trace("ForwardedPorts: (ExtHostTunnelService) tunnel provider error"),o instanceof Error)return o.message}}async $applyCandidateFilter(e){let n=await Promise.all(e.map(i=>this._showCandidatePort(i.host,i.port,i.detail??""))),o=e.filter((i,s)=>n[s]);return this.logService.trace(`ForwardedPorts: (ExtHostTunnelService) filtered from ${e.map(i=>i.port).join(", ")} to ${o.map(i=>i.port).join(", ")}`),o}};vd=_([C(0,se),C(1,Ye),C(2,oe)],vd);function j4(r){return[...r.entries()]}function G4(r){return r?[...r.entries()]:[]}var mAe=R("ptyService");var vq={Backend:"workbench.contributions.terminal.processBackend"},qM=class{constructor(){this._backends=new Map}get backends(){return this._backends}registerTerminalBackend(t){let e=this._sanitizeRemoteAuthority(t.remoteAuthority);if(this._backends.has(e))throw new Error(`A terminal backend with remote authority '${e}' was already registered.`);this._backends.set(e,t)}getTerminalBackend(t){return this._backends.get(this._sanitizeRemoteAuthority(t))}_sanitizeRemoteAuthority(t){return t?.toLowerCase()??""}};vt.add(vq.Backend,new qM);var gAe=R("localPtyService"),fAe=R("terminalLogService");var WT=class{constructor(t){this._callback=t;this._terminalBufferMap=new Map}dispose(){for(let t of this._terminalBufferMap.values())t.dispose()}startBuffering(t,e,n=5){let o=e(i=>{let s=De(i)?i:i.data,a=this._terminalBufferMap.get(t);if(a){a.data.push(s);return}let l=setTimeout(()=>this.flushBuffer(t),n);a={data:[s],timeoutId:l,dispose:()=>{clearTimeout(l),this.flushBuffer(t),o.dispose()}},this._terminalBufferMap.set(t,a)});return o}stopBuffering(t){this._terminalBufferMap.get(t)?.dispose()}flushBuffer(t){let e=this._terminalBufferMap.get(t);e&&(this._terminalBufferMap.delete(t),this._callback(t,e.data.join("")))}};var fu=(r,t,e,n)=>{let o=t;return{enumerable:!0,configurable:!1,get(){return o},set(i){if(!e(o,i)){let s=o;o=i,r.listener?.(n(i,s))}}}},fg=(r,t)=>r===t,yd={range:(r,t)=>r===t?!0:!r||!t?!1:r.isEqual(t),label:fg,description:fg,sortText:fg,busy:fg,error:fg,canResolveChildren:fg,tags:(r,t)=>!(r.length!==t.length||r.some(e=>!t.find(n=>e.id===n.id)))},hg=r=>t=>({op:4,update:r(t)}),bq=(r,t)=>({range:(()=>{let e,n=hg(o=>({range:We.lift(j.from(o))}));return{enumerable:!0,configurable:!1,get(){return e},set(o){r.listener?.({op:6}),yd.range(e,o)||(e=o,r.listener?.(n(o)))}}})(),label:fu(r,t,yd.label,hg(e=>({label:e}))),description:fu(r,void 0,yd.description,hg(e=>({description:e}))),sortText:fu(r,void 0,yd.sortText,hg(e=>({sortText:e}))),canResolveChildren:fu(r,!1,yd.canResolveChildren,e=>({op:2,state:e})),busy:fu(r,!1,yd.busy,hg(e=>({busy:e}))),error:fu(r,void 0,yd.error,hg(e=>({error:ue.fromStrict(e)||null}))),tags:fu(r,[],yd.tags,(e,n)=>({op:1,new:e.map(ii.from),old:n.map(ii.from)}))}),yq=r=>{let t=Ze.fromString(r.extId),e=new $a(t.controllerId,t.localId,r.label,b.revive(r.uri)||void 0);return e.range=j.to(r.range||void 0),e.description=r.description||void 0,e.sortText=r.sortText||void 0,e.tags=r.tags.map(n=>ii.to({id:gS(n).tagId})),e},KM=r=>{let t;for(let e of r.tests){let n=yq(e.item);Qp(n).parent=t,t=n}return t},$a=class r{constructor(t,e,n,o){if(e.includes("\0"))throw new Error(`Test IDs may not include the ${JSON.stringify(e)} symbol`);let i=e4(this,t);Object.defineProperties(this,{id:{value:e,enumerable:!0,writable:!1},uri:{value:o,enumerable:!0,writable:!1},parent:{enumerable:!1,get(){return i.parent instanceof vg?void 0:i.parent}},children:{value:XW(i,Qp,r),enumerable:!0,writable:!1},...bq(i,n)})}},vg=class extends $a{constructor(e,n){super(e,e,n,void 0);this._isRoot=!0}},VT=class extends vS{constructor(t,e,n){super({controllerId:t,getDocumentVersion:o=>o&&n.getDocument(o)?.version,getApiFor:Qp,getChildren:o=>o.children,root:new vg(t,e),toITestItem:Ns.from})}};var BT=(e=>(e[e.Desktop=1]="Desktop",e[e.Web=2]="Web",e))(BT||{});function jM(r){let t=H.alloc(1);switch(r){case 0:t.writeUInt8(1,0);break;case 1:t.writeUInt8(2,0);break;case 2:t.writeUInt8(3,0);break}return t}function Q4(r,t){if(r.byteLength!==1)return!1;switch(r.readUInt8(0)){case 1:return t===0;case 2:return t===1;case 3:return t===2;default:return!1}}var bg=class extends O{constructor(e,n,o){super();this.initData=n;this._onDidChangeTelemetryEnabled=this._register(new E);this.onDidChangeTelemetryEnabled=this._onDidChangeTelemetryEnabled.event;this._onDidChangeTelemetryConfiguration=this._register(new E);this.onDidChangeTelemetryConfiguration=this._onDidChangeTelemetryConfiguration.event;this._productConfig={usage:!0,error:!0};this._level=0;this._inLoggingOnlyMode=!1;this._telemetryLoggers=new Map;this._inLoggingOnlyMode=this.initData.environment.isExtensionTelemetryLoggingOnly;let i=n.remote.isRemote?"remoteExtHostTelemetry":e?"workerExtHostTelemetry":"extHostTelemetry";this._outputLogger=this._register(o.createLogger(i,{name:p(3500,null,this._inLoggingOnlyMode?" (Not Sent)":""),hidden:!0,group:aW}))}getTelemetryConfiguration(){return this._level===3}getTelemetryDetails(){return{isCrashEnabled:this._level>=1,isErrorsEnabled:this._productConfig.error?this._level>=2:!1,isUsageEnabled:this._productConfig.usage?this._level>=3:!1}}instantiateLogger(e,n,o){let i=this.getTelemetryDetails(),s=new Tb(n,o,e,this._outputLogger,this._inLoggingOnlyMode,this.getBuiltInCommonProperties(e),{isUsageEnabled:i.isUsageEnabled,isErrorsEnabled:i.isErrorsEnabled}),a=this._telemetryLoggers.get(e.identifier.value)??[];return this._telemetryLoggers.set(e.identifier.value,[...a,s]),s.apiTelemetryLogger}$initializeTelemetryLevel(e,n,o){this._level=e,this._productConfig=o??{usage:!0,error:!0}}getBuiltInCommonProperties(e){let n=Object.create(null);switch(n["common.extname"]=`${e.publisher}.${e.name}`,n["common.extversion"]=e.version,n["common.vscodemachineid"]=this.initData.telemetryInfo.machineId,n["common.vscodesessionid"]=this.initData.telemetryInfo.sessionId,n["common.vscodecommithash"]=this.initData.commit,n["common.sqmid"]=this.initData.telemetryInfo.sqmId,n["common.devDeviceId"]=this.initData.telemetryInfo.devDeviceId??this.initData.telemetryInfo.machineId,n["common.vscodeversion"]=this.initData.version,n["common.vscodereleasedate"]=this.initData.date,n["common.isnewappinstall"]=GM(this.initData.telemetryInfo.firstSessionDate),n["common.product"]=this.initData.environment.appHost,this.initData.uiKind){case 2:n["common.uikind"]="web";break;case 1:n["common.uikind"]="desktop";break;default:n["common.uikind"]="unknown"}return n["common.remotename"]=lW(this.initData.remote.authority,this.initData),n}$onDidChangeTelemetryLevel(e){this._oldTelemetryEnablement=this.getTelemetryConfiguration(),this._level=e;let n=this.getTelemetryDetails();this._telemetryLoggers.forEach((o,i)=>{let s=o.filter(a=>!a.isDisposed);s.length===0?this._telemetryLoggers.delete(i):this._telemetryLoggers.set(i,s)}),this._telemetryLoggers.forEach(o=>{for(let i of o)i.updateTelemetryEnablements(n.isUsageEnabled,n.isErrorsEnabled)}),this._oldTelemetryEnablement!==this.getTelemetryConfiguration()&&this._onDidChangeTelemetryEnabled.fire(this.getTelemetryConfiguration()),this._onDidChangeTelemetryConfiguration.fire(this.getTelemetryDetails())}onExtensionError(e,n){let i=this._telemetryLoggers.get(e.value)?.filter(a=>!a.isDisposed);if(!i)return this._telemetryLoggers.delete(e.value),!1;let s=!1;for(let a of i)a.ignoreUnhandledExtHostErrors||(a.logError(n),s=!0);return s}};bg=_([C(1,Ye),C(2,Xo)],bg);var Tb=class{constructor(t,e,n,o,i,s,a){this._extension=n;this._logger=o;this._inLoggingOnlyMode=i;this._commonProperties=s;this._onDidChangeEnableStates=new E;this.ignoreUnhandledExtHostErrors=e?.ignoreUnhandledErrors??!1,this._ignoreBuiltinCommonProperties=e?.ignoreBuiltInCommonProperties??!1,this._additionalCommonProperties=e?.additionalCommonProperties,this._sender=t,this._telemetryEnablements={isUsageEnabled:a.isUsageEnabled,isErrorsEnabled:a.isErrorsEnabled}}static validateSender(t){if(typeof t!="object")throw new TypeError("TelemetrySender argument is invalid");if(typeof t.sendEventData!="function")throw new TypeError("TelemetrySender.sendEventData must be a function");if(typeof t.sendErrorData!="function")throw new TypeError("TelemetrySender.sendErrorData must be a function");if(typeof t.flush<"u"&&typeof t.flush!="function")throw new TypeError("TelemetrySender.flush must be a function or undefined")}updateTelemetryEnablements(t,e){this._apiObject&&(this._telemetryEnablements={isUsageEnabled:t,isErrorsEnabled:e},this._onDidChangeEnableStates.fire(this._apiObject))}mixInCommonPropsAndCleanData(t){let e=t.properties?t.properties??{}:t;return e=mA(e,[]),this._additionalCommonProperties&&(e=Qo(e,this._additionalCommonProperties)),this._ignoreBuiltinCommonProperties||(e=Qo(e,this._commonProperties)),t.properties?t.properties=e:t=e,t}logEvent(t,e){this._sender&&(this._extension.publisher==="vscode"?t=this._extension.name+"/"+t:t=this._extension.identifier.value+"/"+t,e=this.mixInCommonPropsAndCleanData(e||{}),this._inLoggingOnlyMode||this._sender?.sendEventData(t,e),this._logger.trace(t,e))}logUsage(t,e){this._telemetryEnablements.isUsageEnabled&&this.logEvent(t,e)}logError(t,e){if(!(!this._telemetryEnablements.isErrorsEnabled||!this._sender))if(typeof t=="string")this.logEvent(t,e);else{let n={name:t.name,message:t.message,stack:t.stack,cause:t.cause},o=mA(n,[]),i=new Error(typeof o.message=="string"?o.message:void 0,{cause:o.cause});i.stack=typeof o.stack=="string"?o.stack:void 0,i.name=typeof o.name=="string"?o.name:"unknown",e=this.mixInCommonPropsAndCleanData(e||{}),this._inLoggingOnlyMode||this._sender.sendErrorData(i,e),this._logger.trace("exception",e)}}get apiTelemetryLogger(){if(!this._apiObject){let t=this,e={logUsage:t.logUsage.bind(t),get isUsageEnabled(){return t._telemetryEnablements.isUsageEnabled},get isErrorsEnabled(){return t._telemetryEnablements.isErrorsEnabled},logError:t.logError.bind(t),dispose:t.dispose.bind(t),onDidChangeEnableStates:t._onDidChangeEnableStates.event.bind(t)};this._apiObject=Object.freeze(e)}return this._apiObject}get isDisposed(){return!this._sender}dispose(){if(this._sender?.flush){let t=this._sender;this._sender=void 0,Promise.resolve(t.flush()).then(t=void 0),this._apiObject=void 0}else this._sender=void 0;this._onDidChangeEnableStates.dispose()}};function GM(r){let t=Date.now()-new Date(r).getTime();return isNaN(t)?!1:t<1e3*60*60*24}var Id=R("IExtHostTelemetry");var yg=class{constructor(t,e,n){this._commands=new Map;this._apiCommands=new Map;this.#e=t.getProxy(F.MainThreadCommands),this._logService=e,this.#n=n,this.#t=t.getProxy(F.MainThreadTelemetry),this.converter=new QM(this,o=>{let i=this._apiCommands.get(o);return i?.result===ke.Void?i:void 0},e),this._argumentProcessors=[{processArgument(o){return ht(o)}},{processArgument(o){return ra(o,function(i){if(We.isIRange(i))return j.to(i);if(An.isIPosition(i))return ct.to(i);if(We.isIRange(i.range)&&b.isUri(i.uri))return po.to(i);if(i instanceof H)return i.buffer.buffer;if(!Array.isArray(i))return i})}}]}#e;#t;#n;registerArgumentProcessor(t){this._argumentProcessors.push(t)}registerApiCommand(t){let e=this.registerCommand(!1,t.id,async(...n)=>{let o=t.args.map((s,a)=>{if(!s.validate(n[a]))throw new Error(`Invalid argument '${s.name}' when running '${t.id}', received: ${typeof n[a]=="object"?JSON.stringify(n[a],null,"	"):n[a]} `);return s.convert(n[a])}),i=await this.executeCommand(t.internalId,...o);return t.result.convert(i,n,this.converter)},void 0,{description:t.description,args:t.args,returns:t.result.description});return this._apiCommands.set(t.id,t),new be(()=>{e.dispose(),this._apiCommands.delete(t.id)})}registerCommand(t,e,n,o,i,s){if(this._logService.trace("ExtHostCommands#registerCommand",e),!e.trim().length)throw new Error("invalid id");if(this._commands.has(e))throw new Error(`command '${e}' already exists`);return this._commands.set(e,{callback:n,thisArg:o,metadata:i,extension:s}),t&&this.#e.$registerCommand(e),new be(()=>{this._commands.delete(e)&&t&&this.#e.$unregisterCommand(e)})}executeCommand(t,...e){return this._logService.trace("ExtHostCommands#executeCommand",t),this._doExecuteCommand(t,e,!0)}async _doExecuteCommand(t,e,n){if(this._commands.has(t))return this.#e.$fireCommandActivationEvent(t),this._executeContributedCommand(t,e,!1);{let o=!1,i=ra(e,function(s){if(s instanceof we)return ct.from(s);if(s instanceof fe)return j.from(s);if(s instanceof en)return po.from(s);if(oo.isNotebookRange(s))return Fr.from(s);if(s instanceof ArrayBuffer)return o=!0,H.wrap(new Uint8Array(s));if(s instanceof Uint8Array)return o=!0,H.wrap(s);if(s instanceof H)return o=!0,s;if(!Array.isArray(s))return s});try{let s=await this.#e.$executeCommand(t,o?new Gt(i):i,n);return ht(s)}catch(s){if(s instanceof Error&&s.message==="$executeCommand:retry")return this._doExecuteCommand(t,e,!1);throw s}}}async _executeContributedCommand(t,e,n){let o=this._commands.get(t);if(!o)throw new Error("Unknown command");let{callback:i,thisArg:s,metadata:a}=o;if(a?.args)for(let d=0;d<a.args.length;d++)try{UP(e[d],a.args[d].constraint)}catch{throw new Error(`Running the contributed command: '${t}' failed. Illegal argument '${a.args[d].name}' - ${a.args[d].description}`)}let l=an.create();try{return await i.apply(s,e)}catch(d){if(t===this.converter.delegatingCommandId){let c=this.converter.getActualCommand(...e);c&&(t=c.command)}if(Qt(d)||this._logService.error(d,t,o.extension?.identifier),!n)throw d;if(o.extension?.identifier){let c=this.#n.onExtensionError(o.extension.identifier,d);this._logService.trace("forwarded error to extension?",c,o.extension?.identifier)}throw new class extends Error{constructor(){super(Io(d));this.id=t;this.source=o.extension?.displayName??o.extension?.name}}}finally{this._reportTelemetry(o,t,l.elapsed())}}_reportTelemetry(t,e,n){t.extension&&(e.startsWith("code.copilot.logStructured")||this.#t.$publicLog2("Extension:ActionExecuted",{extensionId:t.extension.identifier.value,id:new Rl(e),duration:n}))}$executeContributedCommand(t,...e){this._logService.trace("ExtHostCommands#$executeContributedCommand",t);let n=this._commands.get(t);return n?(e=e.map(o=>this._argumentProcessors.reduce((i,s)=>s.processArgument(i,n.extension),o)),this._executeContributedCommand(t,e,!0)):Promise.reject(new Error(`Contributed command '${t}' does not exist.`))}getCommands(t=!1){return this._logService.trace("ExtHostCommands#getCommands",t),this.#e.$getCommands().then(e=>(t&&(e=e.filter(n=>n[0]!=="_")),e))}$getContributedCommandMetadata(){let t=Object.create(null);for(let[e,n]of this._commands){let{metadata:o}=n;o&&(t[e]=o)}return Promise.resolve(t)}};yg=_([C(0,se),C(1,oe),C(2,Id)],yg);var Nn=R("IExtHostCommands"),QM=class{constructor(t,e,n){this._commands=t;this._lookupApiCommand=e;this._logService=n;this.delegatingCommandId=`__vsc${Ae()}`;this._cache=new Map;this._cachIdPool=0;this._commands.registerCommand(!0,this.delegatingCommandId,this._executeConvertedCommand,this)}toInternal(t,e){if(!t)return;let n={$ident:void 0,id:t.command,title:t.title,tooltip:t.tooltip};if(!t.command)return n;let o=this._lookupApiCommand(t.command);if(o)n.id=o.internalId,n.arguments=o.args.map((i,s)=>i.convert(t.arguments&&t.arguments[s]));else if(tl(t.arguments)){let i=`${t.command} /${++this._cachIdPool}`;this._cache.set(i,t),e.add(K(()=>{this._cache.delete(i),this._logService.trace("CommandsConverter#DISPOSE",i)})),n.$ident=i,n.id=this.delegatingCommandId,n.arguments=[i],this._logService.trace("CommandsConverter#CREATE",t.command,i)}return n}fromInternal(t){return typeof t.$ident=="string"?this._cache.get(t.$ident):{command:t.id,title:t.title,arguments:t.arguments}}getActualCommand(...t){return this._cache.get(t[0])}_executeConvertedCommand(...t){let e=this.getActualCommand(...t);return this._logService.trace("CommandsConverter#EXECUTE",t[0],e?e.command:"MISSING"),e?this._commands.executeCommand(e.command,...e.arguments||[]):Promise.reject(`Actual command not found, wanted to execute ${t[0]}`)}},Z=class r{constructor(t,e,n,o){this.name=t;this.description=e;this.validate=n;this.convert=o}static{this.Uri=new r("uri","Uri of a text document",t=>b.isUri(t),t=>t)}static{this.Position=new r("position","A position in a text document",t=>we.isPosition(t),ct.from)}static{this.Range=new r("range","A range in a text document",t=>fe.isRange(t),j.from)}static{this.Selection=new r("selection","A selection in a text document",t=>Jn.isSelection(t),Eo.from)}static{this.Number=new r("number","",t=>typeof t=="number",t=>t)}static{this.String=new r("string","",t=>typeof t=="string",t=>t)}static Arr(t){return new r(`${t.name}_array`,`Array of ${t.name}, ${t.description}`,e=>Array.isArray(e)&&e.every(n=>t.validate(n)),e=>e.map(n=>t.convert(n)))}static{this.CallHierarchyItem=new r("item","A call hierarchy item",t=>t instanceof Jl,Ha.from)}static{this.TypeHierarchyItem=new r("item","A type hierarchy item",t=>t instanceof Zl,Va.from)}static{this.TestItem=new r("testItem","A VS Code TestItem",t=>t instanceof $a,Ns.from)}static{this.TestProfile=new r("testProfile","A VS Code test profile",t=>t instanceof gm,uM.from)}optional(){return new r(this.name,`(optional) ${this.description}`,t=>t==null||this.validate(t),t=>t===void 0?void 0:t===null?null:this.convert(t))}with(t,e){return new r(t??this.name,e??this.description,this.validate,this.convert)}},ke=class r{constructor(t,e){this.description=t;this.convert=e}static{this.Void=new r("no result",t=>t)}},Re=class{constructor(t,e,n,o,i){this.id=t;this.internalId=e;this.description=n;this.args=o;this.result=i}};var wo=R("IExtHostTerminalService"),vu=class extends O{constructor(e,n,o,i){super();this._proxy=e;this._id=n;this._creationOptions=o;this._name=i;this._disposed=!1;this._state={isInteractedWith:!1,shell:void 0};this.isOpen=!1;this._onWillDispose=this._register(new E);this.onWillDispose=this._onWillDispose.event;this._creationOptions=Object.freeze(this._creationOptions),this._pidPromise=new Promise(a=>this._pidPromiseComplete=a);let s=this;this.value={get name(){return s._name||""},get processId(){return s._pidPromise},get creationOptions(){return s._creationOptions},get exitStatus(){return s._exitStatus},get state(){return s._state},get selection(){return s._selection},get shellIntegration(){return s.shellIntegration},sendText(a,l=!0){s._checkDisposed(),s._proxy.$sendText(s._id,a,l)},show(a){s._checkDisposed(),s._proxy.$show(s._id,a)},hide(){s._checkDisposed(),s._proxy.$hide(s._id)},dispose(){s._disposed||(s._disposed=!0,s._proxy.$dispose(s._id))},get dimensions(){if(!(s._cols===void 0||s._rows===void 0))return{columns:s._cols,rows:s._rows}}}}dispose(){this._onWillDispose.fire(),super.dispose()}async create(e,n){if(typeof this._id!="string")throw new Error("Terminal has already been created");await this._proxy.$createTerminal(this._id,{name:e.name,shellPath:e.shellPath??void 0,shellArgs:e.shellArgs??void 0,cwd:e.cwd??n?.cwd??void 0,env:e.env??void 0,icon:Y4(e.iconPath)??void 0,color:kp.isThemeColor(e.color)?e.color.id:void 0,initialText:e.message??void 0,strictEnv:e.strictEnv??void 0,hideFromUser:e.hideFromUser??void 0,forceShellIntegration:n?.forceShellIntegration??void 0,isFeatureTerminal:n?.isFeatureTerminal??void 0,isExtensionOwnedTerminal:!0,useShellEnvironment:n?.useShellEnvironment??void 0,location:n?.location||this._serializeParentTerminal(e.location,n?.resolvedExtHostIdentifier),isTransient:e.isTransient??void 0,shellIntegrationNonce:e.shellIntegrationNonce??void 0,titleTemplate:e.titleTemplate??void 0})}async createExtensionTerminal(e,n,o,i,s,a,l){if(typeof this._id!="string")throw new Error("Terminal has already been created");if(await this._proxy.$createTerminal(this._id,{name:this._name,isExtensionCustomPtyTerminal:!0,icon:i,color:kp.isThemeColor(s)?s.id:void 0,location:n?.location||this._serializeParentTerminal(e,o),isTransient:!0,shellIntegrationNonce:a??void 0,titleTemplate:l??void 0}),typeof this._id=="string")throw new Error("Terminal creation failed");return this._id}_serializeParentTerminal(e,n){return typeof e=="object"?so(e,{parentTerminal:!0})&&e.parentTerminal&&n?{parentTerminal:n}:so(e,{viewColumn:!0})?{viewColumn:Vt.from(e.viewColumn),preserveFocus:e.preserveFocus}:void 0:e}_checkDisposed(){if(this._disposed)throw new Error("Terminal has already been disposed")}set name(e){this._name=e}setExitStatus(e,n){this._exitStatus=Object.freeze({code:e,reason:n})}setDimensions(e,n){return e===this._cols&&n===this._rows||e===0||n===0?!1:(this._cols=e,this._rows=n,!0)}setInteractedWith(){return this._state.isInteractedWith?!1:(this._state={...this._state,isInteractedWith:!0},!0)}setShellType(e){return this._state.shell!==e?(this._state={...this._state,shell:e},!0):!1}setSelection(e){this._selection=e}_setProcessId(e){this._pidPromiseComplete?(this._pidPromiseComplete(e),this._pidPromiseComplete=void 0):this._pidPromise.then(n=>{n!==e&&(this._pidPromise=Promise.resolve(e))})}},Eb=class{constructor(t){this._pty=t;this.id=0;this.shouldPersist=!1;this._onProcessData=new E;this.onProcessData=this._onProcessData.event;this._onProcessReady=new E;this._onDidChangeProperty=new E;this.onDidChangeProperty=this._onDidChangeProperty.event;this._onProcessExit=new E;this.onProcessExit=this._onProcessExit.event}get onProcessReady(){return this._onProcessReady.event}refreshProperty(t){throw new Error(`refreshProperty is not suppported in extension owned terminals. property: ${t}`)}updateProperty(t,e){throw new Error(`updateProperty is not suppported in extension owned terminals. property: ${t}, value: ${e}`)}async start(){}shutdown(){this._pty.close()}input(t){this._pty.handleInput?.(t)}sendSignal(t){}resize(t,e){this._pty.setDimensions?.({columns:t,rows:e})}clearBuffer(){}async processBinary(t){}acknowledgeDataEvent(t){}async setUnicodeVersion(t){}getInitialCwd(){return Promise.resolve("")}getCwd(){return Promise.resolve("")}startSendingEvents(t){this._pty.onDidWrite(e=>this._onProcessData.fire(e)),this._pty.onDidClose?.((e=void 0)=>{this._onProcessExit.fire(e===void 0?void 0:e)}),this._pty.onDidOverrideDimensions?.(e=>{e&&this._onDidChangeProperty.fire({type:"overrideDimensions",value:{cols:e.columns,rows:e.rows}})}),this._pty.onDidChangeName?.(e=>{this._onDidChangeProperty.fire({type:"title",value:e})}),this._pty.open(t||void 0),t&&this._pty.setDimensions?.(t),this._onProcessReady.fire({pid:-1,cwd:"",windowsPty:void 0})}},Iq=1,hu=class extends O{constructor(e,n,o){super();this._extHostCommands=n;this._terminals=[];this._terminalProcesses=new Map;this._terminalProcessDisposables={};this._extensionTerminalAwaitingStart={};this._getTerminalPromises={};this._environmentVariableCollections=new Map;this._lastQuickFixCommands=this._register(new sn);this._linkProviders=new Set;this._completionProviders=new Map;this._profileProviders=new Map;this._quickFixProviders=new Map;this._terminalLinkCache=new Map;this._terminalLinkCancellationSource=new Map;this._onDidCloseTerminal=new E;this.onDidCloseTerminal=this._onDidCloseTerminal.event;this._onDidOpenTerminal=new E;this.onDidOpenTerminal=this._onDidOpenTerminal.event;this._onDidChangeActiveTerminal=new E;this.onDidChangeActiveTerminal=this._onDidChangeActiveTerminal.event;this._onDidChangeTerminalDimensions=new E;this.onDidChangeTerminalDimensions=this._onDidChangeTerminalDimensions.event;this._onDidChangeTerminalState=new E;this.onDidChangeTerminalState=this._onDidChangeTerminalState.event;this._onDidChangeShell=new E;this.onDidChangeShell=this._onDidChangeShell.event;this._onDidWriteTerminalData=new E({onWillAddFirstListener:()=>this._proxy.$startSendingDataEvents(),onDidRemoveLastListener:()=>this._proxy.$stopSendingDataEvents()});this.onDidWriteTerminalData=this._onDidWriteTerminalData.event;this._onDidExecuteCommand=new E({onWillAddFirstListener:()=>this._proxy.$startSendingCommandEvents(),onDidRemoveLastListener:()=>this._proxy.$stopSendingCommandEvents()});this.onDidExecuteTerminalCommand=this._onDidExecuteCommand.event;this._proxy=o.getProxy(F.MainThreadTerminalService),this._bufferer=new WT(this._proxy.$sendProcessData),this._proxy.$registerProcessSupport(e),this._extHostCommands.registerArgumentProcessor({processArgument:i=>{let s=a=>this.getTerminalById(a.instanceId)?.value;switch(i?.$mid){case 15:return s(i);default:{if(Array.isArray(i))for(let a=0;a<i.length&&i[a].$mid===15;a++)i[a]=s(i[a]);return i}}}}),this._register({dispose:()=>{for(let[i,s]of this._terminalProcesses)s.shutdown(!0)}})}get activeTerminal(){return this._activeTerminal?.value}get terminals(){return this._terminals.map(e=>e.value)}getDefaultShell(e){return(e?this._defaultAutomationProfile:this._defaultProfile)?.path||""}getDefaultShellArgs(e){return(e?this._defaultAutomationProfile:this._defaultProfile)?.args||[]}createExtensionTerminal(e,n){let o=new vu(this._proxy,Ae(),e,e.name),i=new Eb(e.pty);return o.createExtensionTerminal(e.location,n,this._serializeParentTerminal(e,n).resolvedExtHostIdentifier,Y4(e.iconPath),xq(e.color),e.shellIntegrationNonce,e.titleTemplate).then(s=>{let a=this._setupExtHostProcessListeners(s,i);this._terminalProcessDisposables[s]=a}),this._terminals.push(o),o.value}_serializeParentTerminal(e,n){if(n=n||{},e.location&&typeof e.location=="object"&&so(e.location,{parentTerminal:!0})){let o=e.location.parentTerminal;if(o){let i=this._terminals.find(s=>s.value===o);i&&(n.resolvedExtHostIdentifier=i._id)}}else e.location&&typeof e.location!="object"?n.location=e.location:n.location&&typeof n.location=="object"&&so(n.location,{splitActiveTerminal:!0})&&(n.location={splitActiveTerminal:!0});return n}attachPtyToTerminal(e,n){if(!this.getTerminalById(e))throw new Error(`Cannot resolve terminal with id ${e} for virtual process`);let i=new Eb(n),s=this._setupExtHostProcessListeners(e,i);this._terminalProcessDisposables[e]=s}async $acceptActiveTerminalChanged(e){let n=this._activeTerminal;if(e===null){this._activeTerminal=void 0,n!==this._activeTerminal&&this._onDidChangeActiveTerminal.fire(this._activeTerminal);return}let o=this.getTerminalById(e);o&&(this._activeTerminal=o,n!==this._activeTerminal&&this._onDidChangeActiveTerminal.fire(this._activeTerminal.value))}async $acceptTerminalProcessData(e,n){let o=this.getTerminalById(e);o&&this._onDidWriteTerminalData.fire({terminal:o.value,data:n})}async $acceptTerminalDimensions(e,n,o){let i=this.getTerminalById(e);i&&i.setDimensions(n,o)&&this._onDidChangeTerminalDimensions.fire({terminal:i.value,dimensions:i.value.dimensions})}async $acceptDidExecuteCommand(e,n){let o=this.getTerminalById(e);o&&this._onDidExecuteCommand.fire({terminal:o.value,...n})}async $acceptTerminalMaximumDimensions(e,n,o){this._terminalProcesses.get(e)?.resize(n,o)}async $acceptTerminalTitleChange(e,n){let o=this.getTerminalById(e);o&&(o.name=n)}async $acceptTerminalClosed(e,n,o){let i=this._getTerminalObjectIndexById(this._terminals,e);if(i!==null){let s=this._terminals.splice(i,1)[0];s.setExitStatus(n,o),this._onDidCloseTerminal.fire(s.value)}}$acceptTerminalOpened(e,n,o,i){if(n){let l=this._getTerminalObjectIndexById(this._terminals,n);if(l!==null){this._terminals[l]._id=e,this._onDidOpenTerminal.fire(this.terminals[l]),this._terminals[l].isOpen=!0;return}}let s={name:i.name,shellPath:i.executable,shellArgs:i.args,cwd:typeof i.cwd=="string"?i.cwd:b.revive(i.cwd),env:i.env,hideFromUser:i.hideFromUser,titleTemplate:i.titleTemplate},a=new vu(this._proxy,e,s,o);this._terminals.push(a),this._onDidOpenTerminal.fire(a.value),a.isOpen=!0}async $acceptTerminalProcessId(e,n){this.getTerminalById(e)?._setProcessId(n)}async $startExtensionTerminal(e,n){let o=this.getTerminalById(e);if(!o)return{message:p(3501,null,e)};o.isOpen||await new Promise(s=>{let a=this.onDidOpenTerminal(async l=>{l===o.value&&(a.dispose(),s())})});let i=this._terminalProcesses.get(e);i?i.startSendingEvents(n):this._extensionTerminalAwaitingStart[e]={initialDimensions:n}}_setupExtHostProcessListeners(e,n){let o=new $;o.add(n.onProcessReady(s=>this._proxy.$sendProcessReady(e,s.pid,s.cwd,s.windowsPty))),o.add(n.onDidChangeProperty(s=>this._proxy.$sendProcessProperty(e,s))),this._bufferer.startBuffering(e,n.onProcessData),o.add(n.onProcessExit(s=>this._onProcessExit(e,s))),this._terminalProcesses.set(e,n);let i=this._extensionTerminalAwaitingStart[e];return i&&n instanceof Eb&&(n.startSendingEvents(i.initialDimensions),delete this._extensionTerminalAwaitingStart[e]),o}$acceptProcessAckDataEvent(e,n){this._terminalProcesses.get(e)?.acknowledgeDataEvent(n)}$acceptProcessInput(e,n){this._terminalProcesses.get(e)?.input(n)}$acceptTerminalInteraction(e){let n=this.getTerminalById(e);n?.setInteractedWith()&&this._onDidChangeTerminalState.fire(n.value)}$acceptTerminalSelection(e,n){this.getTerminalById(e)?.setSelection(n)}$acceptProcessResize(e,n,o){try{this._terminalProcesses.get(e)?.resize(n,o)}catch(i){if(i.code!=="EPIPE"&&i.code!=="ERR_IPC_CHANNEL_CLOSED")throw i}}$acceptProcessShutdown(e,n){this._terminalProcesses.get(e)?.shutdown(n)}$acceptProcessRequestInitialCwd(e){this._terminalProcesses.get(e)?.getInitialCwd().then(n=>this._proxy.$sendProcessProperty(e,{type:"initialCwd",value:n}))}$acceptProcessRequestCwd(e){this._terminalProcesses.get(e)?.getCwd().then(n=>this._proxy.$sendProcessProperty(e,{type:"cwd",value:n}))}$acceptProcessRequestLatency(e){return Promise.resolve(e)}registerProfileProvider(e,n,o){if(this._profileProviders.has(n))throw new Error(`Terminal profile provider "${n}" already registered`);return this._profileProviders.set(n,{provider:o,extension:e}),this._proxy.$registerProfileProvider(n,e.identifier.value),new be(()=>{this._profileProviders.delete(n),this._proxy.$unregisterProfileProvider(n)})}registerTerminalCompletionProvider(e,n,...o){if(this._completionProviders.has(e.identifier.value))throw new Error(`Terminal completion provider "${e.identifier.value}" already registered`);return this._completionProviders.set(e.identifier.value,n),this._proxy.$registerCompletionProvider(e.identifier.value,e.identifier.value,...o),new be(()=>{this._completionProviders.delete(e.identifier.value),this._proxy.$unregisterCompletionProvider(e.identifier.value)})}async $provideTerminalCompletions(e,n){let o=new Ce().token;if(o.isCancellationRequested||!this.activeTerminal)return;let i=this._completionProviders.get(e);if(!i)return;let s=await i.provideTerminalCompletions(this.activeTerminal,n,o);if(s==null)return;let a=!Ie||this.activeTerminal.state?.shell==="gitbash"?"/":"\\";return bM.from(s,a)}$acceptTerminalShellType(e,n){let o=this.getTerminalById(e);o?.setShellType(n)&&this._onDidChangeTerminalState.fire(o.value)}registerTerminalQuickFixProvider(e,n,o){if(this._quickFixProviders.has(e))throw new Error(`Terminal quick fix provider "${e}" is already registered`);return this._quickFixProviders.set(e,o),this._proxy.$registerQuickFixProvider(e,n),new be(()=>{this._quickFixProviders.delete(e),this._proxy.$unregisterQuickFixProvider(e)})}async $provideTerminalQuickFixes(e,n){let o=new Ce().token;if(o.isCancellationRequested)return;let i=this._quickFixProviders.get(e);if(!i)return;let s=await i.provideTerminalQuickFixes(n,o);if(s===null||Array.isArray(s)&&s.length===0)return;let a=new $;if(this._lastQuickFixCommands.value=a,!Array.isArray(s))return s?ST.from(s,this._extHostCommands.converter,a):void 0;let l=[];for(let d of s){let c=ST.from(d,this._extHostCommands.converter,a);c&&l.push(c)}return l}async $createContributedProfileTerminal(e,n){let o=new Ce().token,i=this._profileProviders.get(e);if(!i)throw new Error(`No terminal profile provider registered for id "${e}"`);let s=await i.provider.provideTerminalProfile(o);if(o.isCancellationRequested)return;if(s&&!so(s,{options:!0})&&(s={options:s}),!s||!so(s,{options:!0}))throw new Error(`No terminal profile options provided for id "${e}"`);let a=He(i.extension,"terminalTitle");!a&&s.options.titleTemplate!==void 0&&(console.error(`[${i.extension.identifier.value}] \`titleTemplate\` returned from TerminalProfileProvider is ignored because the \`terminalTitle\` proposed API is not enabled.`),s={options:{...s.options,titleTemplate:void 0}}),!a&&n.titleTemplate!==void 0&&console.error(`[${i.extension.identifier.value}] \`titleTemplate\` passed to createContributedTerminalProfile is ignored because the \`terminalTitle\` proposed API is not enabled.`);let l=a&&n.titleTemplate&&!s.options.titleTemplate?{...s.options,titleTemplate:n.titleTemplate}:s.options;if(so(l,{pty:!0})){this.createExtensionTerminal(l,n);return}this.createTerminalFromOptions(l,n)}registerLinkProvider(e){return this._linkProviders.add(e),this._linkProviders.size===1&&this._proxy.$startLinkProvider(),new be(()=>{this._linkProviders.delete(e),this._linkProviders.size===0&&this._proxy.$stopLinkProvider()})}async $provideLinks(e,n){let o=this.getTerminalById(e);if(!o)return[];this._terminalLinkCache.delete(e),this._terminalLinkCancellationSource.get(e)?.dispose(!0);let s=new Ce;this._terminalLinkCancellationSource.set(e,s);let a=[],l={terminal:o.value,line:n},d=[];for(let m of this._linkProviders)d.push(Kr.withAsyncBody(async g=>{s.token.onCancellationRequested(()=>g({provider:m,links:[]}));let h=await m.provideTerminalLinks(l,s.token)||[];s.token.isCancellationRequested||g({provider:m,links:h})}));let c=await Promise.all(d);if(s.token.isCancellationRequested)return[];let u=new Map;for(let m of c)m&&m.links.length>0&&a.push(...m.links.map(g=>{let h={id:Iq++,startIndex:g.startIndex,length:g.length,label:g.tooltip};return u.set(h.id,{provider:m.provider,link:g}),h}));return this._terminalLinkCache.set(e,u),a}$activateLink(e,n){let o=this._terminalLinkCache.get(e)?.get(n);o&&o.provider.handleTerminalLink(o.link)}_onProcessExit(e,n){this._bufferer.stopBuffering(e),this._terminalProcesses.delete(e),delete this._extensionTerminalAwaitingStart[e];let o=this._terminalProcessDisposables[e];o&&(o.dispose(),delete this._terminalProcessDisposables[e]),this._proxy.$sendProcessExit(e,n)}getTerminalById(e){return this._getTerminalObjectById(this._terminals,e)}getTerminalIdByApiObject(e){let n=this._terminals.findIndex(o=>o.value===e);return n>=0?n:null}_getTerminalObjectById(e,n){let o=this._getTerminalObjectIndexById(e,n);return o!==null?e[o]:null}_getTerminalObjectIndexById(e,n){let o=e.findIndex(i=>i._id===n);return o>=0?o:null}getEnvironmentVariableCollection(e){let n=this._environmentVariableCollections.get(e.identifier.value);return n||(n=this._register(new $T),this._setEnvironmentVariableCollection(e.identifier.value,n)),n.getScopedEnvironmentVariableCollection(void 0)}_syncEnvironmentVariableCollection(e,n){let o=j4(n.map),i=G4(n.descriptionMap);this._proxy.$setEnvironmentVariableCollection(e,n.persistent,o.length===0?void 0:o,i)}$initEnvironmentVariableCollections(e){e.forEach(n=>{let o=n[0],i=this._register(new $T(n[1]));this._setEnvironmentVariableCollection(o,i)})}$acceptDefaultProfile(e,n){let o=this._defaultProfile;this._defaultProfile=e,this._defaultAutomationProfile=n,o?.path!==e.path&&this._onDidChangeShell.fire(e.path)}_setEnvironmentVariableCollection(e,n){this._environmentVariableCollections.set(e,n),this._register(n.onDidChangeCollection(()=>{this._syncEnvironmentVariableCollection(e,n)}))}};hu=_([C(1,Nn),C(2,se)],hu);var $T=class extends O{constructor(e){super();this.map=new Map;this.scopedCollections=new Map;this.descriptionMap=new Map;this._persistent=!0;this._onDidChangeCollection=this._register(new E);this.map=new Map(e)}get persistent(){return this._persistent}set persistent(e){this._persistent=e,this._onDidChangeCollection.fire()}get onDidChangeCollection(){return this._onDidChangeCollection&&this._onDidChangeCollection.event}getScopedEnvironmentVariableCollection(e){let n=this.getScopeKey(e),o=this.scopedCollections.get(n);return o||(o=new JM(this,e),this.scopedCollections.set(n,o),this._register(o.onDidChangeCollection(()=>this._onDidChangeCollection.fire()))),o}replace(e,n,o,i){this._setIfDiffers(e,{value:n,type:1,options:o??{applyAtProcessCreation:!0},scope:i})}append(e,n,o,i){this._setIfDiffers(e,{value:n,type:2,options:o??{applyAtProcessCreation:!0},scope:i})}prepend(e,n,o,i){this._setIfDiffers(e,{value:n,type:3,options:o??{applyAtProcessCreation:!0},scope:i})}_setIfDiffers(e,n){if(n.options&&n.options.applyAtProcessCreation===!1&&!n.options.applyAtShellIntegration)throw new Error("EnvironmentVariableMutatorOptions must apply at either process creation or shell integration");let o=this.getKey(e,n.scope),i=this.map.get(o),s=n.options?{applyAtProcessCreation:n.options.applyAtProcessCreation??!1,applyAtShellIntegration:n.options.applyAtShellIntegration??!1}:{applyAtProcessCreation:!0};if(!i||i.value!==n.value||i.type!==n.type||i.options?.applyAtProcessCreation!==s.applyAtProcessCreation||i.options?.applyAtShellIntegration!==s.applyAtShellIntegration||i.scope?.workspaceFolder?.index!==n.scope?.workspaceFolder?.index){let a=this.getKey(e,n.scope),l={variable:e,...n,options:s};this.map.set(a,l),this._onDidChangeCollection.fire()}}get(e,n){let o=this.getKey(e,n),i=this.map.get(o);return i?J4(i):void 0}getKey(e,n){let o=this.getScopeKey(n);return o.length?`${e}:::${o}`:e}getScopeKey(e){return this.getWorkspaceKey(e?.workspaceFolder)??""}getWorkspaceKey(e){return e?e.uri.toString():void 0}getVariableMap(e){let n=new Map;for(let[o,i]of this.map)this.getScopeKey(i.scope)===this.getScopeKey(e)&&n.set(i.variable,J4(i));return n}delete(e,n){let o=this.getKey(e,n);this.map.delete(o),this._onDidChangeCollection.fire()}clear(e){if(e?.workspaceFolder){for(let[n,o]of this.map)o.scope?.workspaceFolder?.index===e.workspaceFolder.index&&this.map.delete(n);this.clearDescription(e)}else this.map.clear(),this.descriptionMap.clear();this._onDidChangeCollection.fire()}setDescription(e,n){let o=this.getScopeKey(n),i=this.descriptionMap.get(o);if(!i||i.description!==e){let s;typeof e=="string"?s=e:s=e?.value.split(`

`)[0];let a={description:s,scope:n};this.descriptionMap.set(o,a),this._onDidChangeCollection.fire()}}getDescription(e){let n=this.getScopeKey(e);return this.descriptionMap.get(n)?.description}clearDescription(e){let n=this.getScopeKey(e);this.descriptionMap.delete(n)}},JM=class{constructor(t,e){this.collection=t;this.scope=e;this._onDidChangeCollection=new E}get persistent(){return this.collection.persistent}set persistent(t){this.collection.persistent=t}get onDidChangeCollection(){return this._onDidChangeCollection&&this._onDidChangeCollection.event}getScoped(t){return this.collection.getScopedEnvironmentVariableCollection(t)}replace(t,e,n){this.collection.replace(t,e,n,this.scope)}append(t,e,n){this.collection.append(t,e,n,this.scope)}prepend(t,e,n){this.collection.prepend(t,e,n,this.scope)}get(t){return this.collection.get(t,this.scope)}forEach(t,e){this.collection.getVariableMap(this.scope).forEach((n,o)=>t.call(e,o,n,this),this.scope)}[Symbol.iterator](){return this.collection.getVariableMap(this.scope).entries()}delete(t){this.collection.delete(t,this.scope),this._onDidChangeCollection.fire(void 0)}clear(){this.collection.clear(this.scope)}set description(t){this.collection.setDescription(t,this.scope)}get description(){return this.collection.getDescription(this.scope)}},Ig=class extends hu{constructor(t,e,n){super(!1,t,e),this._hasRemoteAuthority=!!n.remote.authority}createTerminal(t,e,n){if(!this._hasRemoteAuthority)throw new zd;return this.createTerminalFromOptions({name:t,shellPath:e,shellArgs:n})}createTerminalFromOptions(t,e){if(!this._hasRemoteAuthority)throw new zd;let n=new vu(this._proxy,Ae(),t,t.name);return this._terminals.push(n),n.create(t,this._serializeParentTerminal(t,e)),n.value}};Ig=_([C(0,Nn),C(1,se),C(2,Ye)],Ig);function Y4(r){if(!(!r||typeof r=="string"))return so(r,{id:!0})?{id:r.id,color:r.color}:r}function xq(r){return kp.isThemeColor(r)?r:void 0}function J4(r){let t={...r};return delete t.scope,t.options=t.options??void 0,t}var X4={label:p(8717,null),order:Number.MAX_SAFE_INTEGER};var XM="/.well-known",Sq=`${XM}/oauth-protected-resource`,Cq=`${XM}/oauth-authorization-server`,YM=`${XM}/openid-configuration`,zT=" ";function Tq(r){if(typeof r!="object"||r===null)return!1;let t=r;return!(!t.resource||t.scopes_supported!==void 0&&!Array.isArray(t.scopes_supported))}var Eq=["issuer","authorization_endpoint","token_endpoint","registration_endpoint","jwks_uri"];function wq(r){if(typeof r!="object"||r===null)return!1;let t=r;if(!t.issuer)throw new Error("Authorization server metadata must have an issuer");for(let e of Eq)if(t[e]){if(typeof t[e]!="string")throw new Error(`Authorization server metadata '${e}' must be a string`);if(!t[e].startsWith("https://")&&!t[e].startsWith("http://"))throw new Error(`Authorization server metadata '${e}' must start with http:// or https://`)}return!0}function kq(r){return typeof r!="object"||r===null?!1:r.client_id!==void 0}function wb(r){if(typeof r!="object"||r===null)return!1;let t=r;return t.access_token!==void 0&&t.token_type!==void 0}function eV(r){if(typeof r!="object"||r===null)return!1;let t=r;return t.device_code!==void 0&&t.user_code!==void 0&&t.verification_uri!==void 0&&t.expires_in!==void 0}function ZM(r){return typeof r!="object"||r===null?!1:r.error!==void 0}function Pq(r){return typeof r!="object"||r===null?!1:r.error!==void 0}function tV(r){return{issuer:r.toString(),authorization_endpoint:new URL("/authorize",r).toString(),token_endpoint:new URL("/token",r).toString(),registration_endpoint:new URL("/register",r).toString(),response_types_supported:["code","id_token","id_token token"]}}var Z4=["authorization_code","refresh_token","urn:ietf:params:oauth:grant-type:device_code"],e0=33418;async function t0(r,t,e){if(!r.registration_endpoint)throw new Error("Server does not support dynamic registration");let n={client_name:t,client_uri:"https://code.visualstudio.com",grant_types:r.grant_types_supported?r.grant_types_supported.filter(s=>Z4.includes(s)):Z4,response_types:["code"],redirect_uris:["https://insiders.vscode.dev/redirect","https://vscode.dev/redirect","http://127.0.0.1/",`http://127.0.0.1:${e0}/`],scope:e?.join(zT),token_endpoint_auth_method:"none",application_type:"native"},o=await fetch(r.registration_endpoint,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!o.ok){let s=await o.text(),a=s;try{let l=JSON.parse(s);Pq(l)&&(a=`${l.error}${l.error_description?`: ${l.error_description}`:""}`)}catch{}throw new Error(`Registration to ${r.registration_endpoint} failed: ${a}`)}let i=await o.json();if(kq(i))return i;throw new Error(`Invalid authorization dynamic client registration response: ${JSON.stringify(i)}`)}function n0(r){let t=[],e=[],n="",o=!1;for(let s=0;s<r.length;s++){let a=r[s];a==='"'?(o=!o,n+=a):a===","&&!o?(n.trim()&&e.push(n.trim()),n=""):n+=a}n.trim()&&e.push(n.trim());let i;for(let s of e)if(!s.includes("="))i&&t.push(i),i={scheme:s.trim(),params:{}};else{let l=s.indexOf(" ");if(l>0){let d=s.substring(0,l),c=s.substring(l+1);if(!d.includes("=")&&c.includes("=")){i&&t.push(i),i={scheme:d.trim(),params:{}};let u=c.indexOf("=");if(u>0){let m=c.substring(0,u).trim(),g=c.substring(u+1).trim().replace(/^"|"$/g,"");m&&g!==void 0&&(i.params[m]=g)}continue}}if(i){let d=s.indexOf("=");if(d>0){let c=s.substring(0,d).trim(),u=s.substring(d+1).trim().replace(/^"|"$/g,"");c&&u!==void 0&&(i.params[c]=u)}}}return i&&t.push(i),t}function o0(r){let t=r.split(".");if(t.length!==3)throw new Error("Invalid JWT token format: token must have three parts separated by dots");let[e,n,o]=t;try{if(typeof JSON.parse(Rr(e).toString())!="object")throw new Error("Invalid JWT token format: header is not a JSON object");let s=JSON.parse(Rr(n).toString());if(typeof s!="object")throw new Error("Invalid JWT token format: payload is not a JSON object");return s}catch(i){throw i instanceof Error?new Error(`Failed to parse JWT token: ${i.message}`):new Error("Failed to parse JWT token")}}function nV(r,t){if(r===t)return!0;if(!r||!t||r.length!==t.length)return!1;let e=[...r].sort(),n=[...t].sort();return e.every((o,i)=>o===n[i])}async function oV(r,t,e={}){let{sameOriginHeaders:n={},fetch:o=fetch}=e,i=new URL(r),s=async(c,u)=>{let m={Accept:"application/json"};new URL(c).origin===i.origin&&(m={...m,...n});let h=await o(c,{method:"GET",headers:m});if(h.status!==200){let I;try{I=await h.text()}catch{I=h.statusText}throw new Error(`Failed to fetch resource metadata from ${c}: ${h.status} ${I}`)}let f=await h.json();if(Tq(f)){let I=new URL(f.resource).toString(),S=new URL(u).toString();if(I!==S)throw new Error(`Protected Resource Metadata 'resource' property value "${I}" does not match expected value "${S}" for URL ${c}. Per RFC 9728, these MUST match. See https://datatracker.ietf.org/doc/html/rfc9728#PRConfigurationValidation`);return f}else throw new Error(`Invalid resource metadata from ${c}. Expected to follow shape of https://datatracker.ietf.org/doc/html/rfc9728#name-protected-resource-metadata (Hints: is scopes_supported an array? Is resource a string?). Current payload: ${JSON.stringify(f)}`)},a=[];if(t)try{return{metadata:await s(t,r),discoveryUrl:t,errors:a}}catch(c){a.push(c instanceof Error?c:new Error(String(c)))}let l=i.pathname!=="/",d=`${i.origin}${Sq}`;if(l){let c=`${d}${i.pathname}`;try{return{metadata:await s(c,r),discoveryUrl:c,errors:a}}catch(u){a.push(u instanceof Error?u:new Error(String(u)))}}try{return{metadata:await s(d,i.origin),discoveryUrl:d,errors:a}}catch(c){a.push(c instanceof Error?c:new Error(String(c)))}throw a.length===1?a[0]:new AggregateError(a,"Failed to fetch resource metadata from all attempted URLs")}async function _q(r){if(r.status===200)try{let t=await r.json();if(wq(t))return t}catch{}}async function Dq(r){try{return await r.text()}catch{return r.statusText}}async function rV(r,t={}){let{additionalHeaders:e={},fetch:n=fetch}=t,o=new URL(r),i=o.pathname==="/"?"":o.pathname,s=[],a=async m=>{try{let g=await n(m,{method:"GET",headers:{...e,Accept:"application/json"}}),h=await _q(g);if(h)return h;s.push(new Error(`Failed to fetch authorization server metadata from ${m}: ${g.status} ${await Dq(g)}`));return}catch(g){s.push(g instanceof Error?g:new Error(String(g)));return}},l=new URL(Cq,r).toString()+i,d=await a(l);if(d)return{metadata:d,discoveryUrl:l,errors:s};let c=new URL(YM,r).toString()+i;if(d=await a(c),d)return{metadata:d,discoveryUrl:c,errors:s};let u=r.endsWith("/")?r+YM.substring(1):r+YM;if(d=await a(u),d)return{metadata:d,discoveryUrl:u,errors:s};throw s.length===1?s[0]:new AggregateError(s,"Failed to fetch authorization server metadata from all attempted URLs")}var xd=class{constructor(t,e){this._onDidChangeWindowState=new E;this.onDidChangeWindowState=this._onDidChangeWindowState.event;this._state=xd.InitialState;t.handle&&(this._nativeHandle=Rr(t.handle).buffer),this._proxy=e.getProxy(F.MainThreadWindow),this._proxy.$getInitialState().then(({isFocused:n,isActive:o})=>{this.onDidChangeWindowProperty("focused",n),this.onDidChangeWindowProperty("active",o)})}static{this.InitialState={focused:!0,active:!0}}getState(){let t=this._state;return{get focused(){return t.focused},get active(){return t.active}}}get nativeHandle(){return this._nativeHandle}$onDidChangeActiveNativeWindowHandle(t){this._nativeHandle=t?Rr(t).buffer:void 0}$onDidChangeWindowFocus(t){this.onDidChangeWindowProperty("focused",t)}$onDidChangeWindowActive(t){this.onDidChangeWindowProperty("active",t)}onDidChangeWindowProperty(t,e){e!==this._state[t]&&(this._state={...this._state,[t]:e},this._onDidChangeWindowState.fire(this._state))}openUri(t,e){let n;if(typeof t=="string"){n=t;try{t=b.parse(t)}catch{return Promise.reject(`Invalid uri - '${t}'`)}}return rs(t.scheme)?Promise.reject("Invalid scheme - cannot be empty"):t.scheme===V.command?Promise.reject(`Invalid scheme '${t.scheme}'`):this._proxy.$openUri(t,n,e)}async asExternalUri(t,e){if(rs(t.scheme))return Promise.reject("Invalid scheme - cannot be empty");let n=await this._proxy.$asExternalUri(t,e);return b.from(n)}};xd=_([C(0,Ye),C(1,se)],xd);var bu=R("IExtHostWindow");var Sd=class{constructor(t){this.handles=new No;this.handlers=new Map;this._proxy=t.getProxy(F.MainThreadUrls)}static{this.HandlePool=0}registerUriHandler(t,e){let n=t.identifier;if(this.handles.has(n))throw new Error(`Protocol handler already registered for extension ${n}`);let o=Sd.HandlePool++;return this.handles.add(n),this.handlers.set(o,e),this._proxy.$registerUriHandler(o,n,t.displayName||t.name),K(()=>{this.handles.delete(n),this.handlers.delete(o),this._proxy.$unregisterUriHandler(o)})}$handleExternalUri(t,e){let n=this.handlers.get(t);if(!n)return Promise.resolve(void 0);try{n.handleUri(b.revive(e))}catch(o){ze(o)}return Promise.resolve(void 0)}async createAppUri(t){return b.revive(await this._proxy.$createAppUri(t))}};Sd=_([C(0,se)],Sd);var yu=R("IExtHostUrlsService");var Iu=R("IExtHostProgress"),xg=class{constructor(t){this._handles=0;this._mapHandleToCancellationSource=new Map;this._proxy=t.getProxy(F.MainThreadProgress)}async withProgress(t,e,n){let o=this._handles++,{title:i,location:s,cancellable:a}=e,l={label:t.displayName||t.name,id:t.identifier.value};return this._proxy.$startProgress(o,{location:iT.from(s),title:i,source:l,cancellable:a},t.isUnderDevelopment?void 0:t.identifier.value).catch(qd),this._withProgress(o,n,!!a)}async withProgressFromSource(t,e,n){let o=this._handles++,{title:i,location:s,cancellable:a}=e;return this._proxy.$startProgress(o,{location:iT.from(s),title:i,source:t,cancellable:a},void 0).catch(qd),this._withProgress(o,n,!!a)}_withProgress(t,e,n){let o;n&&(o=new Ce,this._mapHandleToCancellationSource.set(t,o));let i=a=>{this._proxy.$progressEnd(a),this._mapHandleToCancellationSource.delete(a),o?.dispose()},s;try{s=e(new qT(this._proxy,t),n&&o?o.token:ve.None)}catch(a){throw i(t),a}return s.then(a=>i(t),a=>i(t)),s}$acceptProgressCanceled(t){let e=this._mapHandleToCancellationSource.get(t);e&&(e.cancel(),this._mapHandleToCancellationSource.delete(t))}};xg=_([C(0,se)],xg);function Rq(r,t){return r.message=t.message,typeof t.increment=="number"&&(typeof r.increment=="number"?r.increment+=t.increment:r.increment=t.increment),r}var qT=class extends us{constructor(e,n){super(o=>this.throttledReport(o));this._proxy=e;this._handle=n}throttledReport(e){this._proxy.$progressReport(this._handle,e)}};_([CF(100,(e,n)=>Rq(e,n),()=>Object.create(null))],qT.prototype,"throttledReport",1);var Cg=R("IExtHostAuthentication"),Sg=class{constructor(t,e,n,o,i,s,a){this._initData=e;this._extHostWindow=n;this._extHostUrls=o;this._extHostProgress=i;this._extHostLoggerService=s;this._logService=a;this._dynamicAuthProviderCtor=xu;this._authenticationProviders=new Map;this._providerOperations=new pl;this._onDidChangeSessions=new E;this._getSessionTaskSingler=new r0;this._onDidDynamicAuthProviderTokensChange=new E;this._proxy=t.getProxy(F.MainThreadAuthentication)}getExtensionScopedSessionsEvent(t){let e=t.toLowerCase();return he.chain(this._onDidChangeSessions.event,n=>n.filter(o=>!o.extensionIdFilter||o.extensionIdFilter.includes(e)).map(o=>({provider:o.provider})))}async getSession(t,e,n,o={}){let i=Ee.toKey(t.identifier),a=Object.keys(o).map(d=>{switch(d){case"account":return`${d}:${o.account?.id}`;case"createIfNone":case"forceNewSession":{let c=typeof o[d]=="boolean"?`${o[d]}`:`'${o[d]?.detail}/${o[d]?.learnMore?.toString()}'`;return`${d}:${c}`}case"authorizationServer":return`${d}:${o.authorizationServer?.toString(!0)}`;default:return`${d}:${!!o[d]}`}}).sort().join(", "),l;if(xW(n)){let d=n,c=d.wwwAuthenticate,u=d.fallbackScopes?[...d.fallbackScopes].sort().join(" "):"";l=`${i} ${e} challenge:${c} ${u} ${a}`}else{let d=[...n].sort().join(" ");l=`${i} ${e} ${d} ${a}`}return await this._getSessionTaskSingler.getOrCreate(l,async()=>{await this._proxy.$ensureProvider(e);let d=t.displayName||t.name;return this._proxy.$getSession(e,n,i,d,o)})}async getAccounts(t){return await this._proxy.$ensureProvider(t),await this._proxy.$getAccounts(t)}registerAuthenticationProvider(t,e,n,o){return this._providerOperations.queue(t,async()=>{if(this._authenticationProviders.get(t)){this._logService.error(`An authentication provider with id '${t}' is already registered. The existing provider will not be replaced.`);return}let i=n.onDidChangeSessions(s=>this._proxy.$sendDidChangeSessions(t,s));this._authenticationProviders.set(t,{label:e,provider:n,disposable:i,options:o??{supportsMultipleAccounts:!1}}),await this._proxy.$registerAuthenticationProvider({id:t,label:e,supportsMultipleAccounts:o?.supportsMultipleAccounts??!1,supportedAuthorizationServers:o?.supportedAuthorizationServers,supportsChallenges:o?.supportsChallenges})}),new be(()=>{this._providerOperations.queue(t,async()=>{let i=this._authenticationProviders.get(t);i&&(i.disposable?.dispose(),this._authenticationProviders.delete(t),await this._proxy.$unregisterAuthenticationProvider(t))})})}$createSession(t,e,n){return this._providerOperations.queue(t,async()=>{let o=this._authenticationProviders.get(t);if(o)return n.authorizationServer=b.revive(n.authorizationServer),await o.provider.createSession(e,n);throw new Error(`Unable to find authentication provider with handle: ${t}`)})}$removeSession(t,e){return this._providerOperations.queue(t,async()=>{let n=this._authenticationProviders.get(t);if(n)return await n.provider.removeSession(e);throw new Error(`Unable to find authentication provider with handle: ${t}`)})}$getSessions(t,e,n){return this._providerOperations.queue(t,async()=>{let o=this._authenticationProviders.get(t);if(o)return n.authorizationServer=b.revive(n.authorizationServer),await o.provider.getSessions(e,n);throw new Error(`Unable to find authentication provider with handle: ${t}`)})}$getSessionsFromChallenges(t,e,n){return this._providerOperations.queue(t,async()=>{let o=this._authenticationProviders.get(t);if(o){let i=o.provider;if(typeof i.getSessionsFromChallenges=="function")return n.authorizationServer=b.revive(n.authorizationServer),await i.getSessionsFromChallenges(e,n);throw new Error(`Authentication provider with handle: ${t} does not support getSessionsFromChallenges`)}throw new Error(`Unable to find authentication provider with handle: ${t}`)})}$createSessionFromChallenges(t,e,n){return this._providerOperations.queue(t,async()=>{let o=this._authenticationProviders.get(t);if(o){let i=o.provider;if(typeof i.createSessionFromChallenges=="function")return n.authorizationServer=b.revive(n.authorizationServer),await i.createSessionFromChallenges(e,n);throw new Error(`Authentication provider with handle: ${t} does not support createSessionFromChallenges`)}throw new Error(`Unable to find authentication provider with handle: ${t}`)})}$onDidChangeAuthenticationSessions(t,e,n){return t.startsWith(tS)||this._onDidChangeSessions.fire({provider:{id:t,label:e},extensionIdFilter:n}),Promise.resolve()}$onDidUnregisterAuthenticationProvider(t){return this._providerOperations.queue(t,async()=>{let e=this._authenticationProviders.get(t);e&&(e.disposable?.dispose(),this._authenticationProviders.delete(t))})}async $registerDynamicAuthProvider(t,e,n,o,i,s){if(!o){let l=b.revive(t);if(e.registration_endpoint)try{let d=await t0(e,this._initData.environment.appName,n?.scopes_supported);o=d.client_id,i=d.client_secret}catch(d){this._logService.warn(`Dynamic registration failed for ${l.toString()}: ${d.message}. Prompting user for client ID and client secret...`)}if(!o){this._logService.info(`Prompting user for client registration details for ${l.toString()}`);let d=await this._proxy.$promptForClientRegistration(l.toString());if(!d)throw new Error("User did not provide client details");o=d.clientId,i=d.clientSecret,this._logService.info(`User provided client registration for ${l.toString()}`),i?this._logService.trace(`User provided client secret for ${l.toString()}`):this._logService.trace(`User did not provide client secret for ${l.toString()}`)}}let a=new this._dynamicAuthProviderCtor(this._extHostWindow,this._extHostUrls,this._initData,this._extHostProgress,this._extHostLoggerService,this._proxy,b.revive(t),e,n,o,i,this._onDidDynamicAuthProviderTokensChange,s||[]);return await this._providerOperations.queue(a.id,async()=>{this._authenticationProviders.set(a.id,{label:a.label,provider:a,disposable:be.from(a,a.onDidChangeSessions(l=>this._proxy.$sendDidChangeSessions(a.id,l)),a.onDidChangeClientId(()=>this._proxy.$sendDidChangeDynamicProviderInfo({providerId:a.id,clientId:a.clientId,clientSecret:a.clientSecret}))),options:{supportsMultipleAccounts:!0}}),await this._proxy.$registerDynamicAuthenticationProvider({id:a.id,label:a.label,supportsMultipleAccounts:!0,authorizationServer:t,resourceServer:n?b.parse(n.resource):void 0,clientId:a.clientId,clientSecret:a.clientSecret})}),a.id}async $onDidChangeDynamicAuthProviderTokens(t,e,n){this._onDidDynamicAuthProviderTokensChange.fire({authProviderId:t,clientId:e,tokens:n})}};Sg=_([C(0,se),C(1,Ye),C(2,bu),C(3,yu),C(4,Iu),C(5,Xo),C(6,oe)],Sg);var r0=class{constructor(){this._inFlightPromises=new Map}getOrCreate(t,e){let n=this._inFlightPromises.get(t);if(n)return n;let o=e().finally(()=>this._inFlightPromises.delete(t));return this._inFlightPromises.set(t,o),o}},xu=class{constructor(t,e,n,o,i,s,a,l,d,c,u,m,g){this._extHostWindow=t;this._extHostUrls=e;this._initData=n;this._extHostProgress=o;this._proxy=s;this.authorizationServer=a;this._serverMetadata=l;this._resourceMetadata=d;this._clientId=c;this._clientSecret=u;this._onDidChangeSessions=new E;this.onDidChangeSessions=this._onDidChangeSessions.event;this._onDidChangeClientId=new E;this.onDidChangeClientId=this._onDidChangeClientId.event;let h=a.toString(!0);this.id=d?.resource?h+" "+d?.resource:h,this.label=d?.resource_name??this.authorizationServer.authority,this._logger=i.createLogger(this.id,{name:`Auth: ${this.label}`}),this._disposable=new $,this._disposable.add(this._onDidChangeSessions),this._disposable.add(this._onDidChangeClientId);let f=he.chain(m.event,I=>I.filter(S=>S.authProviderId===this.id&&S.clientId===c).map(S=>S.tokens));this._tokenStore=this._disposable.add(new i0({onDidChange:f,set:I=>s.$setSessionsForDynamicAuthProvider(this.id,this.clientId,I)},g,this._logger)),this._disposable.add(this._tokenStore.onDidChangeSessions(I=>this._onDidChangeSessions.fire(I))),this._createFlows=[],l.authorization_endpoint&&this._createFlows.push({label:p(3485,null),handler:(I,S,T)=>this._createWithUrlHandler(I,S,T)})}get clientId(){return this._clientId}get clientSecret(){return this._clientSecret}async getSessions(t,e){if(this._logger.info(`Getting sessions for scopes: ${t?.join(" ")??"all"}`),!t)return this._tokenStore.sessions;let n=[...t].sort(),o=t.join(" "),i=this._tokenStore.sessions.filter(s=>rn([...s.scopes].sort(),n));if(this._logger.info(`Found ${i.length} sessions for scopes: ${o}`),i.length){let s=[],a=[],l=new Map(this._tokenStore.tokens.map(d=>[d.access_token,d]));for(let d of i){let c=l.get(d.accessToken);if(c&&c.expires_in){let u=Date.now(),m=c.expires_in*1e3;if(u>c.created_at+m-300*1e3){if(this._logger.info(`Token for session ${d.id} is about to expire, refreshing...`),a.push(c),!c.refresh_token){this._logger.warn(`No refresh token available for scopes ${d.scopes.join(" ")}. Throwing away token.`);continue}try{let g=await this.exchangeRefreshTokenForToken(c.refresh_token);g.scope!==o&&(this._logger.warn(`Token scopes '${g.scope}' do not match requested scopes '${o}'. Overwriting token with what was requested...`),g.scope=o),this._logger.info(`Successfully created a new token for scopes ${d.scopes.join(" ")}.`),s.push(g)}catch(g){this._logger.error(`Failed to refresh token: ${g}`)}}}}return(s.length||a.length)&&(this._tokenStore.update({added:s,removed:a}),i=this._tokenStore.sessions.filter(d=>rn([...d.scopes].sort(),n))),this._logger.info(`Found ${i.length} sessions for scopes: ${o}`),i}return[]}async createSession(t,e){this._logger.info(`Creating session for scopes: ${t.join(" ")}`);let n;for(let i=0;i<this._createFlows.length;i++){let{handler:s}=this._createFlows[i];try{if(n=await this._extHostProgress.withProgressFromSource({label:this.label,id:this.id},{location:15,title:p(3482,null,this.label),cancellable:!0},(a,l)=>s(t,a,l)),n)break}catch(a){let l=this._createFlows[i+1]?.label;if(!l)break;let d=Qt(a)?p(3486,null,this.label,l):p(3484,null,this.label,l);if(!await this._proxy.$showContinueNotification(d))throw new Be;this._logger.error(`Failed to create token via flow '${l}': ${a}`)}}if(!n)throw new Error("Failed to create authentication token");n.scope!==t.join(" ")&&(this._logger.warn(`Token scopes '${n.scope}' do not match requested scopes '${t.join(" ")}'. Overwriting token with what was requested...`),n.scope=t.join(" ")),this._tokenStore.update({added:[{...n,created_at:Date.now()}],removed:[]});let o=this._tokenStore.sessions.find(i=>i.accessToken===n.access_token);return this._logger.info(`Created ${n.refresh_token?"refreshable":"non-refreshable"} session for scopes: ${n.scope}${n.expires_in?` that expires in ${n.expires_in} seconds`:""}`),o}async removeSession(t){this._logger.info(`Removing session with id: ${t}`);let e=this._tokenStore.sessions.find(o=>o.id===t);if(!e){this._logger.error(`Session with id ${t} not found`);return}let n=this._tokenStore.tokens.find(o=>o.access_token===e.accessToken);if(!n){this._logger.error(`Failed to retrieve token for removed session: ${e.id}`);return}this._tokenStore.update({added:[],removed:[n]}),this._logger.info(`Removed token for session: ${e.id} with scopes: ${e.scopes.join(" ")}`)}dispose(){this._disposable.dispose()}async _createWithUrlHandler(t,e,n){if(!this._serverMetadata.authorization_endpoint)throw new Error("Authorization Endpoint required");if(!this._serverMetadata.token_endpoint)throw new Error("Token endpoint not available in server metadata");let o=this.generateRandomString(64),i=await this.generateCodeChallenge(o),s=this.generateRandomString(32),a=b.parse(`${this._initData.environment.appUriScheme}://dynamicauthprovider/${this.authorizationServer.authority}/authorize?nonce=${s}`),l;try{l=await this._extHostUrls.createAppUri(a)}catch(I){throw new Error(`Failed to create external URI: ${I}`)}let d=new URL(this._serverMetadata.authorization_endpoint);d.searchParams.append("client_id",this._clientId),d.searchParams.append("response_type","code"),d.searchParams.append("state",l.toString()),d.searchParams.append("code_challenge",i),d.searchParams.append("code_challenge_method","S256");let c=t.join(" ");c&&d.searchParams.append("scope",c),this._resourceMetadata?.resource&&d.searchParams.append("resource",this._resourceMetadata.resource);let u="https://vscode.dev/redirect";d.searchParams.append("redirect_uri",u);let m=this.waitForAuthorizationCode(a);if(this._logger.info(`Opening authorization URL for scopes: ${c}`),this._logger.trace(`Authorization URL: ${d.toString()}`),!await this._extHostWindow.openUri(d.toString(),{}))throw new Be;e.report({message:p(3483,null)});let h;try{h=(await ml(m,n)).code}catch(I){throw Qt(I)?(this._logger.info("Authorization code request was cancelled by the user."),I):(this._logger.error(`Failed to receive authorization code: ${I}`),new Error(`Failed to receive authorization code: ${I}`))}return this._logger.info(`Authorization code received for scopes: ${c}`),await this.exchangeCodeForToken(h,o,u)}generateRandomString(t){let e=new Uint8Array(t);return crypto.getRandomValues(e),Array.from(e).map(n=>n.toString(16).padStart(2,"0")).join("").substring(0,t)}async generateCodeChallenge(t){let n=new TextEncoder().encode(t),o=await crypto.subtle.digest("SHA-256",n);return Ao(H.wrap(new Uint8Array(o)),!1,!1).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async waitForAuthorizationCode(t){let e=await this._proxy.$waitForUriHandler(t),n=/[?&]code=([^&]+)/.exec(e.query||"");if(!n||n.length<2)throw new Error("Authentication failed: No authorization code received");return{code:n[1]}}async exchangeCodeForToken(t,e,n){if(!this._serverMetadata.token_endpoint)throw new Error("Token endpoint not available in server metadata");let o=new URLSearchParams;o.append("client_id",this._clientId),o.append("grant_type","authorization_code"),o.append("code",t),o.append("redirect_uri",n),o.append("code_verifier",e),this._resourceMetadata?.resource&&o.append("resource",this._resourceMetadata.resource),this._clientSecret&&o.append("client_secret",this._clientSecret),this._logger.info("Exchanging authorization code for token..."),this._logger.trace(`Url: ${this._serverMetadata.token_endpoint}`),this._logger.trace(`Token request body: ${o.toString()}`);let i;try{i=await fetch(this._serverMetadata.token_endpoint,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:o.toString()})}catch(a){throw this._logger.error(`Failed to exchange authorization code for token: ${a}`),new Error(`Failed to exchange authorization code for token: ${a}`)}if(!i.ok){let a=await i.text();throw new Error(`Token exchange failed: ${i.status} ${i.statusText} - ${a}`)}let s=await i.json();if(wb(s))return this._logger.info("Successfully exchanged authorization code for token."),s;throw ZM(s)&&s.error==="invalid_client"?(this._logger.warn(`Client ID (${this._clientId}) was invalid, generated a new one.`),await this._generateNewClientId(),new Error("Client ID was invalid, generated a new one. Please try again.")):new Error(`Invalid authorization token response: ${JSON.stringify(s)}`)}async exchangeRefreshTokenForToken(t){if(!this._serverMetadata.token_endpoint)throw new Error("Token endpoint not available in server metadata");let e=new URLSearchParams;e.append("client_id",this._clientId),e.append("grant_type","refresh_token"),e.append("refresh_token",t),this._resourceMetadata?.resource&&e.append("resource",this._resourceMetadata.resource),this._clientSecret&&e.append("client_secret",this._clientSecret);let o=await(await fetch(this._serverMetadata.token_endpoint,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:e.toString()})).json();if(wb(o))return{...o,created_at:Date.now()};throw ZM(o)&&o.error==="invalid_client"?(this._logger.warn(`Client ID (${this._clientId}) was invalid, generated a new one.`),await this._generateNewClientId(),new Error("Client ID was invalid, generated a new one. Please try again.")):new Error(`Invalid authorization token response: ${JSON.stringify(o)}`)}async _generateNewClientId(){try{let t=await t0(this._serverMetadata,this._initData.environment.appName,this._resourceMetadata?.scopes_supported);this._clientId=t.client_id,this._clientSecret=t.client_secret,this._onDidChangeClientId.fire()}catch(t){this._logger.info(`Dynamic registration failed for ${this.authorizationServer.toString()}: ${t}. Prompting user for client ID and client secret.`);try{let e=await this._proxy.$promptForClientRegistration(this.authorizationServer.toString());if(!e)throw new Error("User did not provide client details");this._clientId=e.clientId,this._clientSecret=e.clientSecret,this._logger.info(`User provided client ID for ${this.authorizationServer.toString()}`),e.clientSecret?this._logger.info(`User provided client secret for ${this.authorizationServer.toString()}`):this._logger.info(`User did not provide client secret for ${this.authorizationServer.toString()} (optional)`),this._onDidChangeClientId.fire()}catch{throw this._logger.error(`Failed to fetch new client ID and user did not provide one: ${t}`),new Error(`Failed to fetch new client ID and user did not provide one: ${t}`)}}}};xu=_([C(0,bu),C(1,yu),C(2,Ye),C(3,Iu),C(4,Xo)],xu);var i0=class{constructor(t,e,n){this._persistence=t;this._logger=n;this._onDidChangeSessions=new E;this.onDidChangeSessions=this._onDidChangeSessions.event;this._disposable=new $,this._tokensObservable=to("tokens",e),this._sessionsObservable=fv({equalsFn:(o,i)=>rn(o,i,(s,a)=>s.accessToken===a.accessToken)},o=>this._tokensObservable.read(o).map(i=>this._getSessionFromToken(i))),this._disposable.add(this._registerChangeEventAutorun()),this._disposable.add(this._persistence.onDidChange(o=>this._tokensObservable.set(o,void 0)))}get tokens(){return this._tokensObservable.get()}get sessions(){return this._sessionsObservable.get()}dispose(){this._disposable.dispose()}update({added:t,removed:e}){this._logger.trace(`Updating tokens: added ${t.length}, removed ${e.length}`);let n=[...this._tokensObservable.get()];for(let o of e){let i=n.findIndex(s=>s.access_token===o.access_token);i!==-1&&n.splice(i,1)}for(let o of t){let i=n.findIndex(s=>s.access_token===o.access_token);i===-1?n.push(o):n[i]=o}(t.length||e.length)&&(this._tokensObservable.set(n,void 0),this._persistence.set(n)),this._logger.trace(`Tokens updated: ${n.length} tokens stored.`)}_registerChangeEventAutorun(){let t=[];return Vo(e=>{this._logger.trace("Checking for session changes...");let n=this._sessionsObservable.read(e);if(t===n){this._logger.trace("No session changes detected.");return}if(!n||n.length===0){this._logger.trace("All sessions removed."),t.length>0&&(this._onDidChangeSessions.fire({added:[],removed:t,changed:[]}),t=[]);return}let o=[],i=[];for(let s of n)t.some(l=>l.accessToken===s.accessToken)||o.push(s);for(let s of t)n.some(l=>l.accessToken===s.accessToken)||i.push(s);(o.length>0||i.length>0)&&(this._logger.trace(`Sessions changed: added ${o.length}, removed ${i.length}`),this._onDidChangeSessions.fire({added:o,removed:i,changed:[]})),t=n})}_getSessionFromToken(t){let e;if(t.id_token)try{e=o0(t.id_token)}catch{}if(!e)try{e=o0(t.access_token)}catch{}let n=t.scope?t.scope.split(" "):e?.scope?e.scope.split(" "):[];return{id:jI(t.access_token,0).toString(),accessToken:t.access_token,account:{id:e?.sub||"unknown",label:e?.preferred_username||e?.name||e?.email||"MCP"},scopes:n,idToken:t.id_token}}};var Tg=R("IExtHostLanguageModels"),s0=class{constructor(){this._defaultStream=new wI;this._isDone=!1;let t=this,[e,n]=mp.tee(t._defaultStream.asyncIterable);this.apiObject={get stream(){return e},get text(){return n.map(o=>{if(o instanceof tn)return o.value}).coalesce()}}}handleResponsePart(t){if(this._isDone)return;let e=[];for(let n of Nt.wrap(t)){let o;n.type==="text"?o=new tn(n.value,n.audience):n.type==="thinking"?o=new Ui(n.value,n.id,n.metadata):n.type==="data"?o=new Ln(n.data.buffer,n.mimeType,n.audience):o=new ni(n.toolCallId,n.name,n.parameters),e.push(o)}this._defaultStream.emitMany(e)}reject(t){this._isDone=!0,this._defaultStream.reject(t)}resolve(){this._isDone=!0,this._defaultStream.resolve()}},Cd=class{constructor(t,e,n){this._logService=e;this._extHostAuthentication=n;this._onDidChangeModelAccess=new E;this._onDidChangeProviders=new E;this.onDidChangeProviders=this._onDidChangeProviders.event;this._onDidChangeModelProxyAvailability=new E;this.onDidChangeModelProxyAvailability=this._onDidChangeModelProxyAvailability.event;this._languageModelProviders=new Map;this._localModels=new Map;this._modelAccessList=new uo;this._pendingRequest=new Map;this._ignoredFileProviders=new Map;this._languageAccessInformationExtensions=new Set;this._proxy=t.getProxy(F.MainThreadLanguageModels)}static{this._idPool=1}dispose(){this._onDidChangeModelAccess.dispose(),this._onDidChangeProviders.dispose(),this._onDidChangeModelProxyAvailability.dispose()}registerLanguageModelChatProvider(t,e,n){this._languageModelProviders.set(e,{extension:t,provider:n}),this._proxy.$registerLanguageModelProvider(e);let o;return n.onDidChangeLanguageModelChatInformation&&(o=n.onDidChangeLanguageModelChatInformation(()=>{this._proxy.$onLMProviderChange(e)})),K(()=>{this._languageModelProviders.delete(e),this._localModels.forEach((i,s)=>{i.metadata.vendor===e&&this._localModels.delete(s)}),o?.dispose(),this._proxy.$unregisterProvider(e)})}toModelIdentifier(t,e,n){return e?`${t}/${e}/${n}`:`${t}/${n}`}getVendorFromModelIdentifier(t){let e=t.indexOf("/");return e===-1?void 0:t.substring(0,e)}async $provideLanguageModelChatInfo(t,e,n){let o=this._languageModelProviders.get(t);if(!o)return[];let i=await o.provider.provideLanguageModelChatInformation({silent:e.silent,configuration:e.configuration},n)??[],s=i.map(a=>{let l;a.requiresAuthorization&&He(o.extension,"chatProvider")&&(l={providerLabel:o.extension.displayName||o.extension.name,accountLabel:typeof a.requiresAuthorization=="object"?a.requiresAuthorization.label:void 0}),a.capabilities.editTools&&A(o.extension,"chatProvider");let d={};if(He(o.extension,"chatProvider")){if(a.isDefault===!0)for(let c of Object.values(Ti))typeof c=="string"&&(d[c]=!0);else if(typeof a.isDefault=="object")for(let c of Object.keys(a.isDefault)){let u=parseInt(c);d[Qm.from(u)]=a.isDefault[u]}}return{metadata:{extension:o.extension.identifier,id:a.id,vendor:t,name:a.name??"",family:a.family??"",detail:a.detail,tooltip:a.tooltip,version:a.version,multiplier:a.multiplier,multiplierNumeric:a.multiplierNumeric,maxInputTokens:a.maxInputTokens,maxOutputTokens:a.maxOutputTokens,auth:l,isDefaultForLocation:d,isUserSelectable:a.isUserSelectable,statusIcon:a.statusIcon,targetChatSessionType:a.targetChatSessionType,configurationSchema:a.configurationSchema,modelPickerCategory:a.category??X4,capabilities:a.capabilities?{vision:a.capabilities.imageInput,editTools:a.capabilities.editTools,toolCalling:!!a.capabilities.toolCalling,agentMode:!!a.capabilities.toolCalling}:void 0},identifier:this.toModelIdentifier(t,e.group,a.id)}});this._localModels.forEach((a,l)=>{a.metadata.vendor===t&&a.group===e.group&&this._localModels.delete(l)});for(let a=0;a<s.length;a++)this._localModels.set(s[a].identifier,{group:e.group,metadata:s[a].metadata,info:i[a]});return s}async $startChatRequest(t,e,n,o,i,s){let a=this._localModels.get(t);if(!a)throw new Error("Model not found");let l=this._languageModelProviders.get(a.metadata.vendor);if(!l)throw new Error(`Language model provider for '${a.metadata.id}' not found.`);let d=[],c=()=>{d.length>0&&(this._proxy.$reportResponsePart(e,new Gt(d)),d.length=0)},u=new jn(c,30),m=f=>{d.push(f)>30?(c(),u.cancel()):u.schedule()},g=new us(async f=>{if(s.isCancellationRequested){this._logService.warn(`[CHAT](${l.extension.identifier.value}) CANNOT send progress because the REQUEST IS CANCELLED`);return}let I;if(f instanceof ni?I={type:"tool_use",name:f.name,parameters:f.input,toolCallId:f.callId}:f instanceof tn?I={type:"text",value:f.value,audience:f.audience}:f instanceof Ln?I={type:"data",mimeType:f.mimeType,data:H.wrap(f.data),audience:f.audience}:f instanceof Ui&&(I={type:"thinking",value:f.value,id:f.id,metadata:f.metadata}),!I){this._logService.warn(`[CHAT](${l.extension.identifier.value}) UNKNOWN part ${JSON.stringify(f)}`);return}m(I)}),h;try{h=l.provider.provideLanguageModelChatResponse(a.info,o.value.map(lT.to),{...i,modelOptions:i.modelOptions??{},modelConfiguration:i.configuration,requestInitiator:n?Ee.toKey(n):"core",toolMode:i.toolMode??1},g,s)}catch(f){throw f}Promise.resolve(h).then(()=>{c(),this._proxy.$reportResponseDone(e,void 0)},f=>{c(),this._proxy.$reportResponseDone(e,Yi(f))})}$provideTokenLength(t,e,n){let o=this._localModels.get(t);if(!o)return Promise.resolve(0);let i=this._languageModelProviders.get(o.metadata.vendor);return i?Promise.resolve(i.provider.provideTokenCount(o.info,e,n)):Promise.resolve(0)}async getDefaultLanguageModel(t,e){let n;e&&await this.selectLanguageModels(t,{});for(let[o,i]of this._localModels)if(i.metadata.isDefaultForLocation.panel&&i.metadata.vendor==="copilot"){n=o;break}return!n&&!e?this.getDefaultLanguageModel(t,!0):this.getLanguageModelByIdentifier(t,n)}async getLanguageModelByIdentifier(t,e){if(!e)return;let n=this._localModels.get(e);if(!n){this._logService.warn(`[LanguageModelProxy](${t.identifier.value}) Could not find model '${e}' in local cache. Trying to resolve model again.`);let i=this.getVendorFromModelIdentifier(e);if(!i){this._logService.warn(`[LanguageModelProxy](${t.identifier.value}) Could not extract vendor from model identifier '${e}'.`);return}if(await this.selectLanguageModels(t,{vendor:i}),n=this._localModels.get(e),!n){this._logService.warn(`[LanguageModelProxy](${t.identifier.value}) Could not find model '${e}' in local cache after re-resolving models.`);return}}this._isUsingAuth(t.identifier,n.metadata)&&await this._fakeAuthPopulate(n.metadata);let o;if(!o){let i=this;o={id:n.info.id,vendor:n.metadata.vendor,family:n.info.family,version:n.info.version,name:n.info.name,capabilities:{supportsImageToText:n.metadata.capabilities?.vision??!1,supportsToolCalling:!!n.metadata.capabilities?.toolCalling,editToolsHint:n.metadata.capabilities?.editTools},maxInputTokens:n.metadata.maxInputTokens,countTokens(s,a){if(!i._localModels.has(e))throw Tr.NotFound(e);return i._computeTokenLength(e,s,a??ve.None)},sendRequest(s,a,l){if(!i._localModels.has(e))throw Tr.NotFound(e);return i._sendChatRequest(t,e,s,a??{},l??ve.None)}},Object.freeze(o)}return o}async selectLanguageModels(t,e){let n=await this._proxy.$selectChatModels({...e,extension:t.identifier}),o=[],i=n.map(a=>this.getLanguageModelByIdentifier(t,a)),s=await Promise.all(i);for(let a of s)a&&o.push(a);return o}async _sendChatRequest(t,e,n,o,i){let s=this._convertMessages(t,n),a=t.identifier,l=this._localModels.get(e)?.metadata;if(!l||!this._localModels.has(e))throw Tr.NotFound(`Language model '${e}' is unknown.`);if(this._isUsingAuth(a,l)&&(!await this._getAuthAccess(t,{identifier:l.extension,displayName:l.auth.providerLabel},o.justification,!1)||!this._modelAccessList.get(a)?.has(l.extension)))throw Tr.NoPermissions(`Language model '${e}' cannot be used by '${a.value}'.`);let d=Math.random()*1e6|0,c=new s0;this._pendingRequest.set(d,{languageModelId:e,res:c});try{await this._proxy.$tryStartChatRequest(a,e,d,new Gt(s),o,i)}catch(u){throw this._pendingRequest.delete(d),Tr.tryDeserialize(u)??u}return c.apiObject}_convertMessages(t,e){let n=[];for(let o of e)o.role===3&&A(t,"languageModelSystem"),n.push(lT.from(o));return n}async $acceptResponsePart(t,e){let n=this._pendingRequest.get(t);n&&n.res.handleResponsePart(e.value)}async $acceptResponseDone(t,e){let n=this._pendingRequest.get(t);n&&(this._pendingRequest.delete(t),e?n.res.reject(Tr.tryDeserialize(e)??_P(e)):n.res.resolve())}async _getAuthAccess(t,e,n,o){let i=tS+e.identifier.value;if(await this._extHostAuthentication.getSession(t,i,[],{silent:!0}))return this.$updateModelAccesslist([{from:t.identifier,to:e.identifier,enabled:!0}]),!0;if(o)return!1;try{let a=n?p(3492,null,e.displayName,n):void 0;return await this._extHostAuthentication.getSession(t,i,[],{forceNewSession:{detail:a}}),this.$updateModelAccesslist([{from:t.identifier,to:e.identifier,enabled:!0}]),!0}catch{return!1}}_isUsingAuth(t,e){return!!e.auth&&!Ee.equals(e.extension,t)}async _fakeAuthPopulate(t){if(t.auth)for(let e of this._languageAccessInformationExtensions)try{await this._getAuthAccess(e,{identifier:t.extension,displayName:""},void 0,!0)}catch(n){this._logService.error("Fake Auth request failed"),this._logService.error(n)}}async _computeTokenLength(t,e,n){let o=this._localModels.get(t);if(!o)throw Tr.NotFound(`Language model '${t}' is unknown.`);return this._languageModelProviders.get(o.metadata.vendor)?.provider.provideTokenCount(o.info,e,n)??0}$updateModelAccesslist(t){let e=new Array;for(let{from:n,to:o,enabled:i}of t){let s=this._modelAccessList.get(n)??new No;if(s.has(o)!==i){i?s.add(o):s.delete(o),this._modelAccessList.set(n,s);let l={from:n,to:o};e.push(l),this._onDidChangeModelAccess.fire(l)}}}createLanguageModelAccessInformation(t){this._languageAccessInformationExtensions.add(t);let e=he.signal(he.filter(this._onDidChangeModelAccess.event,o=>Ee.equals(o.from,t.identifier))),n=he.signal(this._onDidChangeProviders.event);return{get onDidChange(){return he.any(e,n)},canSendRequest(o){return!0}}}fileIsIgnored(t,e,n=ve.None){return A(t,"chatParticipantAdditions"),this._proxy.$fileIsIgnored(e,n)}get isModelProxyAvailable(){return!!this._languageModelProxyProvider}async getModelProxy(t){if(A(t,"languageModelProxy"),!this._languageModelProxyProvider)throw this._logService.trace("[LanguageModelProxy] No LanguageModelProxyProvider registered"),new Error("No language model proxy provider is registered.");let e=Ee.toKey(t.identifier);try{let n=await Promise.resolve(this._languageModelProxyProvider.provideModelProxy(e,ve.None));if(!n)throw this._logService.warn(`[LanguageModelProxy] Provider returned no proxy for ${e}`),new Error("Language model proxy is not available.");return n}catch(n){throw this._logService.error(`[LanguageModelProxy] Provider failed to return proxy for ${e}`,n),n}}async $isFileIgnored(t,e,n){let o=this._ignoredFileProviders.get(t);if(!o)throw new Error("Unknown LanguageModelIgnoredFileProvider");return await o.provideFileIgnored(b.revive(e),n)??!1}registerIgnoredFileProvider(t,e){A(t,"chatParticipantPrivate");let n=Cd._idPool++;return this._proxy.$registerFileIgnoreProvider(n),this._ignoredFileProviders.set(n,e),K(()=>{this._proxy.$unregisterFileIgnoreProvider(n),this._ignoredFileProviders.delete(n)})}registerLanguageModelProxyProvider(t,e){return A(t,"chatParticipantPrivate"),this._languageModelProxyProvider=e,this._onDidChangeModelProxyAvailability.fire(),K(()=>{this._languageModelProxyProvider===e&&(this._languageModelProxyProvider=void 0,this._onDidChangeModelProxyAvailability.fire())})}};Cd=_([C(0,se),C(1,oe),C(2,Cg)],Cd);var Mq=60,Lq=Mq*60,a0=Lq*24,MLe=a0*7,LLe=a0*30,OLe=a0*365;function iV(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 Eg={DateTimeFormat(r,t){return new mt(()=>{try{return new Intl.DateTimeFormat(r,t)}catch{return new Intl.DateTimeFormat(void 0,t)}})},Collator(r,t){return new mt(()=>{try{return new Intl.Collator(r,t)}catch{return new Intl.Collator(void 0,t)}})},Segmenter(r,t){return new mt(()=>{try{return new Intl.Segmenter(r,t)}catch{return new Intl.Segmenter(void 0,t)}})},Locale(r,t){return new mt(()=>{try{return new Intl.Locale(r,t)}catch{return new Intl.Locale(es,t)}})},NumberFormat(r,t){return new mt(()=>{try{return new Intl.NumberFormat(r,t)}catch{return new Intl.NumberFormat(void 0,t)}})}};var wg=class r{constructor(t){let e=ZP(t);this._defaultValue=e,this._asciiMap=r._createAsciiMap(e),this._map=new Map}static _createAsciiMap(t){let e=new Uint8Array(256);return e.fill(t),e}set(t,e){let n=ZP(e);t>=0&&t<256?this._asciiMap[t]=n:this._map.set(t,n)}get(t){return t>=0&&t<256?this._asciiMap[t]:this._map.get(t)||this._defaultValue}clear(){this._asciiMap.fill(this._defaultValue),this._map.clear()}};var l0=class extends wg{constructor(e,n){super(0);this._segmenter=null;this._cachedLine=null;this._cachedSegments=[];this.intlSegmenterLocales=n,this.intlSegmenterLocales.length>0?this._segmenter=Eg.Segmenter(this.intlSegmenterLocales,{granularity:"word"}):this._segmenter=null;for(let o=0,i=e.length;o<i;o++)this.set(e.charCodeAt(o),2);this.set(32,1),this.set(9,1)}findPrevIntlWordBeforeOrAtOffset(e,n){let o=null;for(let i of this._getIntlSegmenterWordsOnLine(e)){if(i.index>n)break;o=i}return o}findNextIntlWordAtOrAfterOffset(e,n){for(let o of this._getIntlSegmenterWordsOnLine(e))if(!(o.index<n))return o;return null}_getIntlSegmenterWordsOnLine(e){return this._segmenter?this._cachedLine===e?this._cachedSegments:(this._cachedLine=e,this._cachedSegments=this._filterWordSegments(this._segmenter.value.segment(e)),this._cachedSegments):[]}_filterWordSegments(e){let n=[];for(let o of e)this._isWordLike(o)&&n.push(o);return n}_isWordLike(e){return!!e.isWordLike}},sV=new $r(10);function aV(r,t){let e=`${r}/${t.join(",")}`,n=sV.get(e);return n||(n=new l0(r,t),sV.set(e,n)),n}var kb=class{constructor(t,e,n,o){this.searchString=t,this.isRegex=e,this.matchCase=n,this.wordSeparators=o}parseSearchRequest(){if(this.searchString==="")return null;let t;this.isRegex?t=d0(this.searchString):t=this.searchString.indexOf(`
`)>=0;let e=null;try{e=dI(this.searchString,this.isRegex,{matchCase:this.matchCase,wholeWord:!1,multiline:t,global:!0,unicode:!0})}catch{return null}if(!e)return null;let n=!this.isRegex&&!t;return n&&this.searchString.toLowerCase()!==this.searchString.toUpperCase()&&(n=this.matchCase),new yx(e,this.wordSeparators?aV(this.wordSeparators,[]):null,n?this.searchString:null)}};function d0(r){if(!r||r.length===0)return!1;for(let t=0,e=r.length;t<e;t++){let n=r.charCodeAt(t);if(n===10)return!0;if(n===92){if(t++,t>=e)break;let o=r.charCodeAt(t);if(o===110||o===114||o===87)return!0}}return!1}function c0(r,t,e){if(!e)return new yc(r,null);let n=[];for(let o=0,i=t.length;o<i;o++)n[o]=t[o];return new yc(r,n)}function Nq(r,t,e,n,o){if(n===0)return!0;let i=t.charCodeAt(n-1);if(r.get(i)!==0||i===13||i===10)return!0;if(o>0){let s=t.charCodeAt(n);if(r.get(s)!==0)return!0}return!1}function Uq(r,t,e,n,o){if(n+o===e)return!0;let i=t.charCodeAt(n+o);if(r.get(i)!==0||i===13||i===10)return!0;if(o>0){let s=t.charCodeAt(n+o-1);if(r.get(s)!==0)return!0}return!1}function u0(r,t,e,n,o){return Nq(r,t,e,n,o)&&Uq(r,t,e,n,o)}var KT=class{constructor(t,e){this._wordSeparators=t,this._searchRegex=e,this._prevMatchStartIndex=-1,this._prevMatchLength=0}reset(t){this._searchRegex.lastIndex=t,this._prevMatchStartIndex=-1,this._prevMatchLength=0}next(t){let e=t.length,n;do{if(this._prevMatchStartIndex+this._prevMatchLength===e||(n=this._searchRegex.exec(t),!n))return null;let o=n.index,i=n[0].length;if(o===this._prevMatchStartIndex&&i===this._prevMatchLength){if(i===0){s_(t,e,this._searchRegex.lastIndex)>65535?this._searchRegex.lastIndex+=2:this._searchRegex.lastIndex+=1;continue}return null}if(this._prevMatchStartIndex=o,this._prevMatchLength=i,!this._wordSeparators||u0(this._wordSeparators,t,e,o,i))return n}while(n);return null}};function lV(r){return r.scheme!==V.file&&r.scheme!==V.vscodeRemote}function Fq(r){if(r.folders.length)return r.folders.every(t=>lV(t.uri))?r.folders[0].uri:void 0;if(r.configuration&&lV(r.configuration))return r.configuration}function dV(r){return Fq(r)?.scheme}var kg=R("remoteAgentService"),nOe=new class{constructor(){this.maxSampleCount=5;this.sampleDelay=2e3;this.initial=[];this.maxInitialCount=3;this.average=[];this.maxAverageCount=100;this.highLatencyMultiple=2;this.highLatencyMinThreshold=500;this.highLatencyMaxThreshold=1500;this.lastMeasurement=void 0}get latency(){return this.lastMeasurement}async measure(r){let t=1/0;for(let n=0;n<this.maxSampleCount;n++){let o=await r.getRoundTripTime();if(o===void 0)return;t=Math.min(t,o/2),await Ut(this.sampleDelay)}this.average.push(t),this.average.length>this.maxAverageCount&&this.average.shift();let e;return this.initial.length<this.maxInitialCount?this.initial.push(t):e=this.initial.reduce((n,o)=>n+o,0)/this.initial.length,this.lastMeasurement={initial:e,current:t,average:this.average.reduce((n,o)=>n+o,0)/this.average.length,high:typeof e>"u"?!1:t>this.highLatencyMaxThreshold||t>this.highLatencyMinThreshold&&t>e*this.highLatencyMultiple},this.lastMeasurement}};var cV=R("pathService"),Pg=class{constructor(t,e,n,o){this.localUserHome=t;this.remoteAgentService=e;this.environmentService=n;this.contextService=o;this.resolveOS=(async()=>(await this.remoteAgentService.getEnvironment())?.os||lr)(),this.resolveUserHome=(async()=>{let i=await this.remoteAgentService.getEnvironment();return this.maybeUnresolvedUserHome=i?.userHome??t})()}hasValidBasename(t,e,n){return typeof e=="string"||typeof e>"u"?this.resolveOS.then(o=>this.doHasValidBasename(t,o,e)):this.doHasValidBasename(t,e,n)}doHasValidBasename(t,e,n){return t.scheme===V.file||t.scheme===V.vscodeRemote?UU(n??Tt(t),e===1):!0}get defaultUriScheme(){return Pg.findDefaultUriScheme(this.environmentService,this.contextService)}static findDefaultUriScheme(t,e){if(t.remoteAuthority)return V.vscodeRemote;let n=dV(e.getWorkspace());if(n)return n;let o=e.getWorkspace().folders[0];if(o)return o.uri.scheme;let i=e.getWorkspace().configuration;return i?i.scheme:V.file}userHome(t){return t?.preferLocal?this.localUserHome:this.resolveUserHome}get resolvedUserHome(){return this.maybeUnresolvedUserHome}get path(){return this.resolveOS.then(t=>t===1?fn:Ge)}async fileURI(t){let e="";if(await this.resolveOS===1&&(t=t.replace(/\\/g,"/")),t[0]==="/"&&t[1]==="/"){let o=t.indexOf("/",2);o===-1?(e=t.substring(2),t="/"):(e=t.substring(2,o),t=t.substring(o)||"/")}return b.from({scheme:V.file,authority:e,path:t,query:"",fragment:""})}};Pg=_([C(1,kg),C(2,Kp),C(3,cs)],Pg);function Wq(r){return typeof r=="object"&&"uri"in r&&"pattern"in r}var Pb=class{constructor(t,e,n,o,i,s){this.configurationService=t;this.workspaceContextService=e;this.editorGroupsService=n;this.logService=o;this.pathService=i;this.uriIdentityService=s}aiText(t,e,n={}){return{...this.commonQuery(e?.map(Qh),n),type:3,contentPattern:t}}text(t,e,n={}){t=this.getContentPattern(t,n);let o=this.configurationService.getValue(),i=e&&e.some(a=>!this.configurationService.getValue({resource:a}).search.useRipgrep);return{...this.commonQuery(e?.map(Qh),n),type:2,contentPattern:t,previewOptions:n.previewOptions,maxFileSize:n.maxFileSize,usePCRE2:o.search.usePCRE2||i||!1,surroundingContext:n.surroundingContext,userDisabledExcludesAndIgnoreFiles:n.disregardExcludeSettings&&n.disregardIgnoreFiles}}getContentPattern(t,e){let n=this.configurationService.getValue();t.isRegExp&&(t.pattern=t.pattern.replace(/\r?\n/g,"\\n"));let o={...t,wordSeparators:n.editor.wordSeparators};return this.isCaseSensitive(t,e)&&(o.isCaseSensitive=!0),this.isMultiline(t)&&(o.isMultiline=!0),e.notebookSearchConfig?.includeMarkupInput&&(o.notebookInfo||(o.notebookInfo={}),o.notebookInfo.isInNotebookMarkdownInput=e.notebookSearchConfig.includeMarkupInput),e.notebookSearchConfig?.includeMarkupPreview&&(o.notebookInfo||(o.notebookInfo={}),o.notebookInfo.isInNotebookMarkdownPreview=e.notebookSearchConfig.includeMarkupPreview),e.notebookSearchConfig?.includeCodeInput&&(o.notebookInfo||(o.notebookInfo={}),o.notebookInfo.isInNotebookCellInput=e.notebookSearchConfig.includeCodeInput),e.notebookSearchConfig?.includeOutput&&(o.notebookInfo||(o.notebookInfo={}),o.notebookInfo.isInNotebookCellOutput=e.notebookSearchConfig.includeOutput),o}file(t,e={}){return{...this.commonQuery(t,e),type:1,filePattern:e.filePattern?e.filePattern.trim():e.filePattern,exists:e.exists,sortByScore:e.sortByScore,cacheKey:e.cacheKey,shouldGlobMatchFilePattern:e.shouldGlobSearch}}handleIncludeExclude(t,e){if(!t)return{};if(Array.isArray(t)){if(t=t.filter(n=>n.length>0).map(jT),!t.length)return{}}else t=jT(t);return e?this.parseSearchPaths(t):{pattern:p0(...Array.isArray(t)?t:[t])}}commonQuery(t=[],e={}){let n=Array.isArray(e.excludePattern)?e.excludePattern.map(c=>c.pattern).flat():e.excludePattern;n=n?.length===1?n[0]:n;let o=this.handleIncludeExclude(e.includePattern,e.expandPatterns),i=this.handleIncludeExclude(n,e.expandPatterns),s=t.length>1,a=(o.searchPaths&&o.searchPaths.length?o.searchPaths.map(c=>this.getFolderQueryForSearchPath(c,e,i)):t.map(c=>this.getFolderQueryForRoot(c,e,i,s))).filter(c=>!!c),l={_reason:e._reason,folderQueries:a,usingSearchPaths:!!(o.searchPaths&&o.searchPaths.length),extraFileResources:e.extraFileResources,excludePattern:i.pattern,includePattern:o.pattern,ignoreGlobCase:e.ignoreGlobCase,onlyOpenEditors:e.onlyOpenEditors,maxResults:e.maxResults,onlyFileScheme:e.onlyFileScheme};if(e.onlyOpenEditors){let c=tt(this.editorGroupsService.groups.flatMap(g=>g.editors.map(h=>h.resource)));this.logService.trace("QueryBuilder#commonQuery - openEditor URIs",JSON.stringify(c));let u=c.filter(g=>kM(l,g.fsPath)),m=this.commonQueryFromFileList(u);return this.logService.trace("QueryBuilder#commonQuery - openEditor Query",JSON.stringify(m)),{...l,...m}}let d=e.extraFileResources&&e.extraFileResources.filter(c=>kM(l,c.fsPath));return l.extraFileResources=d&&d.length?d:void 0,l}commonQueryFromFileList(t){let e=[],n=new Ke,o={},i=!1;return t.forEach(s=>{if(s.scheme===V.walkThrough)return;if(YU(s)){let l=this.workspaceContextService.getWorkspaceFolder(s)?.uri??this.uriIdentityService.extUri.dirname(s),d=n.get(l);d||(i=!0,d={folder:l,includePattern:{}},e.push(d),n.set(l,d));let c=gi(l.fsPath,s.fsPath);pi(d.includePattern)[uV(c.replace(/\\/g,"/"))]=!0}else s.fsPath&&(i=!0,o[uV(s.fsPath)]=!0)}),{folderQueries:e,includePattern:o,usingSearchPaths:!0,excludePattern:i?void 0:{"**/*":!0}}}isCaseSensitive(t,e){if(e.isSmartCase){if(t.isRegExp){if(l_(t.pattern,!0))return!0}else if(l_(t.pattern))return!0}return!!t.isCaseSensitive}isMultiline(t){return t.isMultiline||t.isRegExp&&d0(t.pattern)||t.pattern.indexOf(`
`)>=0?!0:!!t.isMultiline}parseSearchPaths(t){let e=u=>En(u)||/^\.\.?([\/\\]|$)/.test(u),o=(Array.isArray(t)?t:Bq(t)).map(u=>{let m=this.pathService.resolvedUserHome;return m?xc(u,m.scheme===V.file?m.fsPath:m.path):u}),i=ju(o,u=>e(u)?"searchPaths":"exprSegments"),s=(i.exprSegments||[]).map(u=>mr(u,"/")).map(u=>mr(u,"\\")).map(u=>(u[0]==="."&&(u="*"+u),$q(u))),a={},l=this.expandSearchPathPatterns(i.searchPaths||[]);l&&l.length&&(a.searchPaths=l);let d=s.flat(),c=p0(...d);return c&&(a.pattern=c),a}getExcludesForFolder(t,e){return e.disregardExcludeSettings?void 0:E4(t,!e.disregardSearchExcludeSettings)}expandSearchPathPatterns(t){if(!t||!t.length)return[];let e=t.flatMap(o=>{let{pathPortion:i,globPortion:s}=Vq(o);return s&&(s=m0(s)),this.expandOneSearchPath(i).flatMap(l=>this.resolveOneSearchPathPattern(l,s))}),n=new Map;return e.forEach(o=>{let i=o.searchPath.toString(),s=n.get(i);s?o.pattern&&(s.pattern=s.pattern||{},s.pattern[o.pattern]=!0):n.set(i,{searchPath:o.searchPath,pattern:o.pattern?p0(o.pattern):void 0})}),Array.from(n.values())}expandOneSearchPath(t){if(En(t)){let e=this.workspaceContextService.getWorkspace().folders;return e[0]&&e[0].uri.scheme!==V.file?[{searchPath:e[0].uri.with({path:t})}]:[{searchPath:b.file(bo(t))}]}if(this.workspaceContextService.getWorkbenchState()===2){let e=this.workspaceContextService.getWorkspace().folders[0].uri;if(t=jT(t),t.startsWith("../")||t===".."){let o=Ge.resolve(e.path,t);return[{searchPath:e.with({path:o})}]}let n=m0(t);return[{searchPath:e,pattern:n}]}else{if(t==="./"||t===".\\")return[];{let e=t.replace(/^\.[\/\\]/,""),o=this.workspaceContextService.getWorkspace().folders.map(i=>{let s=e.match(new RegExp(`^${pr(i.name)}(?:/(.*)|$)`));return s?{match:s,folder:i}:null}).filter(vo);if(o.length)return o.map(i=>{let s=i.match[1];return{searchPath:i.folder.uri,pattern:s&&m0(s)}});{let i=t.match(/\.[\/\\](.+)[\/\\]?/),s=i?i[1]:t,a=p(17946,null,s);throw new Error(a)}}}}resolveOneSearchPathPattern(t,e){let n=t.pattern&&e?`${t.pattern}/${e}`:t.pattern||e,o=[{searchPath:t.searchPath,pattern:n}];return n&&!n.endsWith("**")&&o.push({searchPath:t.searchPath,pattern:n+"/**"}),o}getFolderQueryForSearchPath(t,e,n){let o=this.getFolderQueryForRoot(Qh(t.searchPath),e,n,!1);return o?{...o,includePattern:t.pattern}:null}getFolderQueryForRoot(t,e,n,o){let i,s=b.isUri(t)?t:t.uri,a=e.excludePattern?.map(g=>{let h=e.excludePattern&&Wq(g)?g.uri:void 0;return!h||!(b.isUri(t)&&this.uriIdentityService.extUri.isEqual(t,h))?h:void 0});if(a?.length||(a=[void 0]),n.searchPaths){let g=n.searchPaths.filter(h=>Ro(h.searchPath,s))[0];if(g&&!g.pattern)return null;g&&(i=g.pattern)}let l=this.configurationService.getValue({resource:s}),c={...this.getExcludesForFolder(l,e)||{},...i||{}},u=b.isUri(t)?Tt(t):t.name,m=a.map(g=>Object.keys(c).length>0?{folder:g,pattern:c}:void 0).filter(g=>g);return{folder:s,folderName:o?u:void 0,excludePattern:m,fileEncoding:l.files&&l.files.encoding,disregardIgnoreFiles:typeof e.disregardIgnoreFiles=="boolean"?e.disregardIgnoreFiles:!l.search.useIgnoreFiles,disregardGlobalIgnoreFiles:typeof e.disregardGlobalIgnoreFiles=="boolean"?e.disregardGlobalIgnoreFiles:!l.search.useGlobalIgnoreFiles,disregardParentIgnoreFiles:typeof e.disregardParentIgnoreFiles=="boolean"?e.disregardParentIgnoreFiles:!l.search.useParentIgnoreFiles,ignoreSymlinks:typeof e.ignoreSymlinks=="boolean"?e.ignoreSymlinks:!l.search.followSymlinks,ignoreGlobCase:e.ignoreGlobCase}}};Pb=_([C(0,Kt),C(1,cs),C(2,fW),C(3,oe),C(4,cV),C(5,$x)],Pb);function Vq(r){let t=r.match(/[\*\{\}\(\)\[\]\?]/);if(t){let e=t.index,n=r.substr(0,e).match(/[/|\\][^/\\]*$/);if(n){let o=r.substr(0,n.index);return o.match(/[/\\]/)||(o+="/"),{pathPortion:o,globPortion:r.substr((n.index||0)+1)}}}return{pathPortion:r}}function p0(...r){return r.length?r.reduce((t,e)=>(t[e]=!0,t),Object.create(null)):void 0}function Bq(r){return va(r,",").map(t=>t.trim()).filter(t=>!!t.length)}function $q(r){return[`**/${r}/**`,`**/${r}`].map(e=>e.replace(/\*\*\/\*\*/g,"**"))}function jT(r){return r.replace(/\\/g,"/")}function m0(r){return jT(r).replace(/^\.\//,"").replace(/\/+$/g,"")}function uV(r){return r.replace(/([?*[\]])/g,"[$1]")}var zq=7e3;function mV(r,t){let e=t.activationEvents;if(!e)return Promise.resolve(void 0);let n=[],o=[];for(let c of e)if(/^workspaceContains:/.test(c)){let u=c.substr(18);u.indexOf("*")>=0||u.indexOf("?")>=0||r.forceUsingSearch?o.push(u):n.push(u)}if(n.length===0&&o.length===0)return Promise.resolve(void 0);let{promise:i,resolve:s}=Sh(),a=c=>s({activationEvent:c}),l=Promise.all(n.map(c=>qq(r,c,a))).then(()=>{}),d=Kq(r,t.identifier,o,a);return Promise.all([l,d]).then(()=>{s(void 0)}),i}async function qq(r,t,e){for(let n of r.folders)if(await r.exists(Et(b.revive(n),t))){e(`workspaceContains:${t}`);return}}async function Kq(r,t,e,n){if(e.length===0)return Promise.resolve(void 0);let o=new Ce,i=r.checkExists(r.folders,e,o.token),s=setTimeout(async()=>{o.cancel(),r.logService.info(`Not activating extension '${t.value}': Timed out while searching for 'workspaceContains' pattern ${e.join(",")}`)},zq),a=!1;try{a=await i}catch(l){Qt(l)||ze(l)}o.dispose(),clearTimeout(s),a&&n(`workspaceContains:${e.join(",")}`)}var _g=class{constructor(t){this._onDidChangePassword=new E;this.onDidChangePassword=this._onDidChangePassword.event;this._proxy=t.getProxy(F.MainThreadSecretState)}async $onDidChangePassword(t){this._onDidChangePassword.fire(t)}get(t,e){return this._proxy.$getPassword(t,e)}store(t,e,n){return this._proxy.$setPassword(t,e,n)}delete(t,e){return this._proxy.$deletePassword(t,e)}keys(t){return this._proxy.$getKeys(t)}},Dg=R("IExtHostSecretState");var GT=class{constructor(t,e){this.disposables=new $;this._id=Ee.toKey(t.identifier),this.#e=e,this.onDidChange=he.map(he.filter(this.#e.onDidChangePassword,n=>n.extensionId===this._id),n=>({key:n.key}),this.disposables)}#e;dispose(){this.disposables.dispose()}get(t){return this.#e.get(this._id,t)}store(t,e){return this.#e.store(this._id,t,e)}delete(t){return this.#e.delete(this._id,t)}keys(){return this.#e.keys(this._id)||[]}};var Rg=class{constructor(t,e,n){this.logService=n;this.bundleCache=new Map;this._proxy=e.getProxy(F.MainThreadLocalization),this.currentLanguage=t.environment.appLanguage,this.isDefaultLanguage=this.currentLanguage===es}getMessage(t,e){let{message:n,args:o,comment:i}=e;if(this.isDefaultLanguage)return o_(n,o??{});let s=n;i&&i.length>0&&(s+=`/${Array.isArray(i)?i.join(""):i}`);let a=this.bundleCache.get(t)?.contents[s];return a||this.logService.warn(`Using default string since no string found in i18n bundle that has the key: ${s}`),o_(a??n,o??{})}getBundle(t){return this.bundleCache.get(t)?.contents}getBundleUri(t){return this.bundleCache.get(t)?.uri}async initializeLocalizedMessages(t){if(this.isDefaultLanguage||!t.l10n&&!t.isBuiltin||this.bundleCache.has(t.identifier.value))return;let e,n=await this.getBundleLocation(t);if(!n){this.logService.error(`No bundle location found for extension ${t.identifier.value}`);return}try{let o=await this._proxy.$fetchBundleContents(n),i=JSON.parse(o);e=t.isBuiltin?i.contents?.bundle:i}catch(o){this.logService.error(`Failed to load translations for ${t.identifier.value} from ${n}: ${o.message}`);return}e&&this.bundleCache.set(t.identifier.value,{contents:e,uri:n})}async getBundleLocation(t){if(t.isBuiltin){let e=await this._proxy.$fetchBuiltInBundleUri(t.identifier.value,this.currentLanguage);return b.revive(e)}return t.l10n?b.joinPath(t.extensionLocation,t.l10n,`bundle.l10n.${this.currentLanguage}.json`):void 0}};Rg=_([C(0,Ye),C(1,se),C(2,oe)],Rg);var Ag=R("IExtHostLocalizationService");var Lg=R("IExtHostManagedSockets"),Mg=class{constructor(t){this._remoteSocketIdCounter=0;this._factory=null;this._managedRemoteSockets=new Map;this._proxy=t.getProxy(F.MainThreadManagedSockets)}setFactory(t,e){for(let n of this._managedRemoteSockets.values())n.dispose();this._factory&&this._proxy.$unregisterSocketFactory(this._factory.socketFactoryId),this._factory=new g0(t,e),this._proxy.$registerSocketFactory(this._factory.socketFactoryId)}async $openRemoteSocket(t){if(!this._factory||this._factory.socketFactoryId!==t)throw new Error(`No socket factory with id ${t}`);let e=++this._remoteSocketIdCounter,n=await this._factory.makeConnection(),o=new $;return this._managedRemoteSockets.set(e,new f0(e,n,o)),o.add(K(()=>this._managedRemoteSockets.delete(e))),o.add(n.onDidEnd(()=>{this._proxy.$onDidManagedSocketEnd(e),o.dispose()})),o.add(n.onDidClose(i=>{this._proxy.$onDidManagedSocketClose(e,i?.stack??i?.message),o.dispose()})),o.add(n.onDidReceiveMessage(i=>this._proxy.$onDidManagedSocketHaveData(e,H.wrap(i)))),e}$remoteSocketWrite(t,e){this._managedRemoteSockets.get(t)?.actual.send(e.buffer)}$remoteSocketEnd(t){let e=this._managedRemoteSockets.get(t);e&&(e.actual.end(),e.dispose())}async $remoteSocketDrain(t){await this._managedRemoteSockets.get(t)?.actual.drain?.()}};Mg=_([C(0,se)],Mg);var g0=class{constructor(t,e){this.socketFactoryId=t;this.makeConnection=e}},f0=class extends O{constructor(e,n,o){super();this.socketId=e;this.actual=n;this._register(o)}};var b0=R("IHostUtils"),Td=class extends O{constructor(e,n,o,i,s,a,l,d,c,u,m,g,h){super();this._extHostManagedSockets=g;this._extHostLanguageModels=h;this._onDidChangeRemoteConnectionData=this._register(new E);this.onDidChangeRemoteConnectionData=this._onDidChangeRemoteConnectionData.event;this._realPathCache=new Map;this._isTerminating=!1;this._hostUtils=n,this._extHostContext=o,this._initData=l,this._extHostWorkspace=i,this._extHostConfiguration=s,this._logService=a,this._extHostTunnelService=c,this._extHostTerminalService=u,this._extHostLocalizationService=m,this._mainThreadWorkspaceProxy=this._extHostContext.getProxy(F.MainThreadWorkspace),this._mainThreadTelemetryProxy=this._extHostContext.getProxy(F.MainThreadTelemetry),this._mainThreadExtensionsProxy=this._extHostContext.getProxy(F.MainThreadExtensionService),this._almostReadyToRunExtensions=new In,this._readyToStartExtensionHost=new In,this._readyToRunExtensions=new In,this._eagerExtensionsActivated=new In,this._activationEventsReader=new v0(this._initData.extensions.activationEvents),this._globalRegistry=new Ba(this._activationEventsReader,this._initData.extensions.allExtensions);let f=new No(this._initData.extensions.myExtensions);this._myRegistry=new Ba(this._activationEventsReader,hV(this._globalRegistry,f)),sl&&(this._logService.info(`Creating extension host with the following global extensions: ${Og(this._globalRegistry)}`),this._logService.info(`Creating extension host with the following local extensions: ${Og(this._myRegistry)}`)),this._storage=new dg(this._extHostContext,this._logService),this._secretState=new _g(this._extHostContext),this._storagePath=d,this._instaService=this._store.add(e.createChild(new xl([cg,this._storage],[Dg,this._secretState]))),this._activator=this._register(new sg(this._myRegistry,this._globalRegistry,{onExtensionActivationError:(I,S,T)=>{this._mainThreadExtensionsProxy.$onExtensionActivationError(I,Yi(S),T)},actualActivateExtension:async(I,S)=>{if(Ba.isHostExtension(I,this._myRegistry,this._globalRegistry))return await this._mainThreadExtensionsProxy.$activateExtension(I,S),new UT;let T=this._myRegistry.getExtensionDescription(I);return this._activateExtension(T,S)}},this._logService)),this._extensionPathIndex=null,this._resolvers=Object.create(null),this._started=!1,this._remoteConnectionData=this._initData.remote.connectionData}getRemoteConnectionData(){return this._remoteConnectionData}async initialize(){try{await this._beforeAlmostReadyToRunExtensions(),this._almostReadyToRunExtensions.open(),await this._extHostWorkspace.waitForInitializeCall(),Ft("code/extHost/ready"),this._readyToStartExtensionHost.open(),this._initData.autoStart&&this._startExtensionHost()}catch(e){ze(e)}}async _deactivateAll(){this._storagePath.onWillDeactivateAll();let e=[];try{e=this._myRegistry.getAllExtensionDescriptions().map(s=>s.identifier).filter(s=>this.isActivated(s)).map(s=>this._deactivate(s))}catch{}await Promise.all(e)}terminate(e,n=0){if(this._isTerminating)return;this._isTerminating=!0,this._logService.info(`Extension host terminating: ${e}`),this._logService.flush(),this._extHostTerminalService.dispose(),this._activator.dispose(),ih(i=>{this._logService.error(i)}),this._extHostContext.dispose();let o=this._deactivateAll();Promise.race([Ut(5e3),o]).finally(()=>{this._hostUtils.pid?this._logService.info(`Extension host with pid ${this._hostUtils.pid} exiting with code ${n}`):this._logService.info(`Extension host exiting with code ${n}`),this._logService.flush(),this._logService.dispose(),this._hostUtils.exit(n)})}isActivated(e){return this._readyToRunExtensions.isOpen()?this._activator.isActivated(e):!1}async getExtension(e){let n=await this._mainThreadExtensionsProxy.$getExtension(e);return n&&{...n,identifier:new Ee(n.identifier.value),extensionLocation:b.revive(n.extensionLocation)}}_activateByEvent(e,n){return this._activator.activateByEvent(e,n)}_activateById(e,n){return this._activator.activateById(e,n)}activateByIdWithErrors(e,n){return this._activateById(e,n).then(()=>{let o=this._activator.getActivatedExtension(e);if(o.activationFailed)return Promise.reject(o.activationFailedError)})}getExtensionRegistry(){return this._readyToRunExtensions.wait().then(e=>this._myRegistry)}getExtensionExports(e){if(this._readyToRunExtensions.isOpen())return this._activator.getActivatedExtension(e).exports;try{return this._activator.getActivatedExtension(e).exports}catch{return null}}async _realPathExtensionUri(e){if(e.scheme===V.file&&this._hostUtils.fsRealpath){let n=e.fsPath;this._realPathCache.has(n)||this._realPathCache.set(n,this._hostUtils.fsRealpath(n));let o=await this._realPathCache.get(n);return b.file(o)}return e}async getExtensionPathIndex(){return this._extensionPathIndex||(this._extensionPathIndex=this._createExtensionPathIndex(this._myRegistry.getAllExtensionDescriptions()).then(e=>new h0(e))),this._extensionPathIndex}async _createExtensionPathIndex(e){let n=er.forUris(o=>tc.ignorePathCasing(o));return await Promise.all(e.map(async o=>{if(this._getEntryPoint(o)){let i=await this._realPathExtensionUri(o.extensionLocation);n.set(i,o)}})),n}_deactivate(e){let n=Promise.resolve(void 0);if(!this._readyToRunExtensions.isOpen()||!this._activator.isActivated(e))return n;let o=this._activator.getActivatedExtension(e);if(!o)return n;try{typeof o.module.deactivate=="function"&&(n=Promise.resolve(o.module.deactivate()).then(void 0,i=>(this._logService.error(i),Promise.resolve(void 0))))}catch(i){this._logService.error(`An error occurred when deactivating the extension '${e.value}':`),this._logService.error(i)}try{o.disposable.dispose()}catch(i){this._logService.error(`An error occurred when disposing the subscriptions for extension '${e.value}':`),this._logService.error(i)}return n}async _activateExtension(e,n){return this._initData.remote.isRemote?this._mainThreadExtensionsProxy.$onWillActivateExtension(e.identifier):await this._mainThreadExtensionsProxy.$onWillActivateExtension(e.identifier),this._doActivateExtension(e,n).then(o=>{let i=o.activationTimes;return this._mainThreadExtensionsProxy.$onDidActivateExtension(e.identifier,i.codeLoadingTime,i.activateCallTime,i.activateResolvedTime,n),this._logExtensionActivationTimes(e,n,"success",i),o},o=>{throw this._logExtensionActivationTimes(e,n,"failure"),o})}_logExtensionActivationTimes(e,n,o,i){let s=fV(e,n);this._mainThreadTelemetryProxy.$publicLog2("extensionActivationTimes",{...s,...i||{},outcome:o})}_doActivateExtension(e,n){let o=fV(e,n);this._mainThreadTelemetryProxy.$publicLog2("activatePlugin",o);let i=this._getEntryPoint(e);if(!i)return Promise.resolve(new NT(mu.NONE));this._logService.info(`ExtensionService#_doActivateExtension ${e.identifier.value}, startup: ${n.startup}, activationEvent: '${n.activationEvent}'${e.identifier.value!==n.extensionId.value?`, root cause: ${n.extensionId.value}`:""}`),this._logService.flush();let s=this._isESM(e),a=new $,l=new ag(n.startup);return Promise.all([s?this._loadESMModule(e,Et(e.extensionLocation,i),l):this._loadCommonJSModule(e,Et(e.extensionLocation,i),l),this._loadExtensionContext(e,a)]).then(d=>(Ft(`code/extHost/willActivateExtension/${e.identifier.value}`),Td._callActivate(this._logService,e.identifier,d[0],d[1],a,l))).then(d=>(Ft(`code/extHost/didActivateExtension/${e.identifier.value}`),d))}_loadExtensionContext(e,n){let o=this._extHostLanguageModels.createLanguageModelAccessInformation(e),i=n.add(new FT(e,this._storage)),s=n.add(new Sb(e.identifier.value,!1,this._storage)),a=n.add(new GT(e,this._secretState)),l=e.isUnderDevelopment?this._initData.environment.extensionTestsLocationURI?3:2:1,d=this._initData.remote.isRemote?2:1;return this._logService.trace(`ExtensionService#loadExtensionContext ${e.identifier.value}`),Promise.all([i.whenReady,s.whenReady,this._storagePath.whenReady]).then(()=>{let c=this,u,m,g=He(e,"ipc")?this._initData.messagePorts?.get(Ee.toKey(e.identifier)):void 0;return Object.freeze({globalState:i,workspaceState:s,secrets:a,subscriptions:[],get languageModelAccessInformation(){return o},get extensionUri(){return e.extensionLocation},get extensionPath(){return e.extensionLocation.fsPath},asAbsolutePath(h){return Ne(e.extensionLocation.fsPath,h)},get storagePath(){return c._storagePath.workspaceValue(e)?.fsPath},get globalStoragePath(){return c._storagePath.globalValue(e).fsPath},get logPath(){return Ne(c._initData.logsLocation.fsPath,e.identifier.value)},get logUri(){return b.joinPath(c._initData.logsLocation,e.identifier.value)},get storageUri(){return c._storagePath.workspaceValue(e)},get globalStorageUri(){return c._storagePath.globalValue(e)},get extensionMode(){return l},get extension(){return u===void 0&&(u=new Ed(c,e.identifier,e,d,!1)),u},get extensionRuntime(){return A(e,"extensionRuntime"),c.extensionRuntime},get environmentVariableCollection(){return c._extHostTerminalService.getEnvironmentVariableCollection(e)},get messagePassingProtocol(){if(!m){if(!g)return;let h=he.buffer(he.fromDOMEventEmitter(g,"message",f=>f.data),"onDidReceiveMessage");g.start(),m={onDidReceiveMessage:h,postMessage:g.postMessage.bind(g)}}return m}})})}static _callActivate(e,n,o,i,s,a){return o=o||{activate:void 0,deactivate:void 0},this._callActivateOptional(e,n,o,i,a).then(l=>new gu(!1,null,a.build(),o,l,K(()=>{s.dispose(),Cn(i.subscriptions)})))}static _callActivateOptional(e,n,o,i,s){if(typeof o.activate=="function")try{s.activateCallStart(),e.trace(`ExtensionService#_callActivateOptional ${n.value}`);let a=o.activate.apply(globalThis,[i]);return s.activateCallStop(),s.activateResolveStart(),Promise.resolve(a).then(l=>(s.activateResolveStop(),l))}catch(a){return Promise.reject(a)}else return Promise.resolve(o)}_activateOneStartupFinished(e,n){this._activateById(e.identifier,{startup:!1,extensionId:e.identifier,activationEvent:n}).then(void 0,o=>{this._logService.error(o)})}_activateAllStartupFinishedDeferred(e,n=0){let i=Date.now();Xy(()=>{for(let s=n;s<e.length;s+=1){let a=e[s];for(let l of a.activationEvents??[])if(l==="onStartupFinished")if(Date.now()-i>50){this._activateAllStartupFinishedDeferred(e,s);break}else this._activateOneStartupFinished(a,l)}})}_activateAllStartupFinished(){this._mainThreadExtensionsProxy.$setPerformanceMarks(pF()),this._extHostConfiguration.getConfigProvider().then(e=>{let n=e.getConfiguration("extensions.experimental").get("deferredStartupFinishedActivation"),o=this._myRegistry.getAllExtensionDescriptions();if(n)this._activateAllStartupFinishedDeferred(o);else for(let i of o)if(i.activationEvents)for(let s of i.activationEvents)s==="onStartupFinished"&&this._activateOneStartupFinished(i,s)})}_handleEagerExtensions(){let e=this._activateByEvent("*",!0).then(void 0,a=>{this._logService.error(a)});this._register(this._extHostWorkspace.onDidChangeWorkspace(a=>this._handleWorkspaceContainsEagerExtensions(a.added)));let n=this._extHostWorkspace.workspace?this._extHostWorkspace.workspace.folders:[],o=this._handleWorkspaceContainsEagerExtensions(n),i=this._handleRemoteResolverEagerExtensions(),s=Promise.all([i,e,o]).then(()=>{});return Promise.race([s,Ut(1e4)]).then(()=>{this._activateAllStartupFinished()}),s}_handleWorkspaceContainsEagerExtensions(e){return e.length===0?Promise.resolve(void 0):Promise.all(this._myRegistry.getAllExtensionDescriptions().map(n=>this._handleWorkspaceContainsEagerExtension(e,n))).then(()=>{})}async _handleWorkspaceContainsEagerExtension(e,n){if(this.isActivated(n.identifier))return;let o=!this._initData.remote.isRemote&&!!this._initData.remote.authority,i={logService:this._logService,folders:e.map(a=>a.uri),forceUsingSearch:o||!this._hostUtils.fsExists,exists:a=>this._hostUtils.fsExists(a.fsPath),checkExists:(a,l,d)=>this._mainThreadWorkspaceProxy.$checkExists(a,l,d)},s=await mV(i,n);if(s)return this._activateById(n.identifier,{startup:!0,extensionId:n.identifier,activationEvent:s.activationEvent}).then(void 0,a=>this._logService.error(a))}async _handleRemoteResolverEagerExtensions(){if(this._initData.remote.authority)return this._activateByEvent(`onResolveRemoteAuthority:${this._initData.remote.authority}`,!1)}async $extensionTestsExecute(){await this._eagerExtensionsActivated.wait();try{return await this._doHandleExtensionTests()}catch(e){throw console.error(e),e}}async _doHandleExtensionTests(){let{extensionDevelopmentLocationURI:e,extensionTestsLocationURI:n}=this._initData.environment;if(!e||!n)throw new Error(p(3489,null));let o=(await this.getExtensionPathIndex()).findSubstr(n),s=await(this._isESM(o,n.path)?this._loadESMModule(null,n,new ag(!1)):this._loadCommonJSModule(null,n,new ag(!1)));if(!s||typeof s.run!="function")throw new Error(p(3488,null,n.toString()));return new Promise((a,l)=>{let d=(m,g)=>{m?(sl&&this._logService.error("Test runner called back with error",m),l(m)):(sl&&(g?this._logService.info(`Test runner called back with ${g} failures.`):this._logService.info("Test runner called back with successful outcome.")),a(typeof g=="number"&&g>0?1:0))},c=zr(n),u=s.run(c,d);u&&u.then&&u.then(()=>{sl&&this._logService.info("Test runner finished successfully."),a(0)}).catch(m=>{sl&&this._logService.error("Test runner finished with error",m),l(m instanceof Error&&m.stack?m.stack:String(m))})})}_startExtensionHost(){if(this._started)throw new Error("Extension host is already started!");return this._started=!0,this._readyToStartExtensionHost.wait().then(()=>this._readyToRunExtensions.open()).then(()=>Promise.race([this._activator.waitForActivatingExtensions(),Ut(1e3)])).then(()=>this._handleEagerExtensions()).then(()=>{this._eagerExtensionsActivated.open(),this._logService.info("Eager extensions activated")})}registerRemoteAuthorityResolver(e,n){return this._resolvers[e]=n,K(()=>{delete this._resolvers[e]})}async getRemoteExecServer(e){let{resolver:n}=await this._activateAndGetResolver(e);return n?.resolveExecServer?.(e,{resolveAttempt:0})}async _activateAndGetResolver(e){let n=e.indexOf("+");if(n===-1)throw new Ps("Not an authority that can be resolved!","InvalidAuthority");let o=e.substr(0,n);return await this._almostReadyToRunExtensions.wait(),await this._activateByEvent(`onResolveRemoteAuthority:${o}`,!1),{authorityPrefix:o,resolver:this._resolvers[o]}}async $resolveAuthority(e,n){let o=an.create(!1),i=()=>`[resolveAuthority(${XA(e)},${n})][${o.elapsed()}ms] `,s=P=>this._logService.info(`${i()}${P}`),a=P=>this._logService.warn(`${i()}${P}`),l=(P,L=void 0)=>this._logService.error(`${i()}${P}`,L),d=P=>{if(P instanceof Ps)return{type:"error",error:{code:P._code,message:P._message,detail:P._detail}};throw P},c=async P=>{s(`activating resolver for ${P}...`);let{resolver:L,authorityPrefix:q}=await this._activateAndGetResolver(P);if(!L)throw l(`no resolver for ${q}`),new Ps(`No remote extension installed to resolve ${q}.`,"NoResolverFound");return{resolver:L,authorityPrefix:q,remoteAuthority:P}},u=e.split(/@|%40/g).reverse();s(`activating remote resolvers ${u.join(" -> ")}`);let m;try{m=await Promise.all(u.map(c)).catch(async P=>{if(!(P instanceof Ps)||P._code!=="InvalidAuthority")throw P;return a(`resolving nested authorities failed: ${P.message}`),[await c(e)]})}catch(P){return d(P)}let g=new cp;g.cancelAndSet(()=>s("waiting..."),1e3);let h,f;for(let[P,{authorityPrefix:L,resolver:q,remoteAuthority:N}]of m.entries())try{if(P===m.length-1)s("invoking final resolve()..."),Ft(`code/extHost/willResolveAuthority/${L}`),h=await q.resolve(N,{resolveAttempt:n,execServer:f}),Ft(`code/extHost/didResolveAuthorityOK/${L}`),s("setting tunnel factory..."),this._register(await this._extHostTunnelService.setTunnelFactory(q,Ql.isManagedResolvedAuthority(h)?h:void 0));else{if(s(`invoking resolveExecServer() for ${N}`),Ft(`code/extHost/willResolveExecServer/${L}`),f=await q.resolveExecServer?.(N,{resolveAttempt:n,execServer:f}),!f)throw new Ps(`Exec server was not available for ${N}`,"NoResolverFound");Ft(`code/extHost/didResolveExecServerOK/${L}`)}}catch(B){return Ft(`code/extHost/didResolveAuthorityError/${L}`),l("returned an error",B),g.dispose(),d(B)}g.dispose();let I={environmentTunnels:h.environmentTunnels,features:h.tunnelFeatures?{elevation:h.tunnelFeatures.elevation,privacyOptions:h.tunnelFeatures.privacyOptions,protocol:h.tunnelFeatures.protocol===void 0?!0:h.tunnelFeatures.protocol}:void 0},S={extensionHostEnv:h.extensionHostEnv,isTrusted:h.isTrusted,authenticationSession:h.authenticationSessionForInitializingExtensions?{id:h.authenticationSessionForInitializingExtensions.id,providerId:h.authenticationSessionForInitializingExtensions.providerId}:void 0};s(`returned ${Ql.isManagedResolvedAuthority(h)?"managed authority":`${h.host}:${h.port}`}`);let T;if(Ql.isManagedResolvedAuthority(h)){let P=n;this._extHostManagedSockets.setFactory(P,h.makeConnection),T={authority:e,connectTo:new Jp(P),connectionToken:h.connectionToken}}else T={authority:e,connectTo:new bS(h.host,h.port),connectionToken:h.connectionToken};return{type:"ok",value:{authority:T,options:S,tunnelInformation:I}}}async $getCanonicalURI(e,n){this._logService.info(`$getCanonicalURI invoked for authority (${XA(e)})`);let{resolver:o}=await this._activateAndGetResolver(e);if(!o)return null;let i=b.revive(n);if(typeof o.getCanonicalURI>"u")return i;let s=await hn(()=>o.getCanonicalURI(i));return s||i}async $startExtensionHost(e){e.toAdd.forEach(a=>a.extensionLocation=b.revive(a.extensionLocation));let{globalRegistry:n,myExtensions:o}=gV(this._activationEventsReader,this._globalRegistry,this._myRegistry,e),i=await this._createExtensionPathIndex(o);return(await this.getExtensionPathIndex()).setSearchTree(i),this._globalRegistry.set(n.getAllExtensionDescriptions()),this._myRegistry.set(o),sl&&(this._logService.info(`$startExtensionHost: global extensions: ${Og(this._globalRegistry)}`),this._logService.info(`$startExtensionHost: local extensions: ${Og(this._myRegistry)}`)),this._startExtensionHost()}$activateByEvent(e,n){return n===1?this._almostReadyToRunExtensions.wait().then(o=>this._activateByEvent(e,!1)):this._readyToRunExtensions.wait().then(o=>this._activateByEvent(e,!1))}async $activate(e,n){return await this._readyToRunExtensions.wait(),this._myRegistry.getExtensionDescription(e)?(await this._activateById(e,n),!0):!1}async $deltaExtensions(e){e.toAdd.forEach(a=>a.extensionLocation=b.revive(a.extensionLocation));let{globalRegistry:n,myExtensions:o}=gV(this._activationEventsReader,this._globalRegistry,this._myRegistry,e),i=await this._createExtensionPathIndex(o);return(await this.getExtensionPathIndex()).setSearchTree(i),this._globalRegistry.set(n.getAllExtensionDescriptions()),this._myRegistry.set(o),sl&&(this._logService.info(`$deltaExtensions: global extensions: ${Og(this._globalRegistry)}`),this._logService.info(`$deltaExtensions: local extensions: ${Og(this._myRegistry)}`)),Promise.resolve(void 0)}async $test_latency(e){return e}async $test_up(e){return e.byteLength}async $test_down(e){let n=H.alloc(e),o=Math.random()%256;for(let i=0;i<e;i++)n.writeUInt8(o,i);return n}async $updateRemoteConnectionData(e){this._remoteConnectionData=e,this._onDidChangeRemoteConnectionData.fire()}_isESM(e,n){return n??=e?this._getEntryPoint(e):n,n?.endsWith(".mjs")||e?.type==="module"&&!n?.endsWith(".cjs")}};Td=_([C(0,Jo),C(1,b0),C(2,se),C(3,On),C(4,Sn),C(5,oe),C(6,Ye),C(7,pg),C(8,bd),C(9,wo),C(10,Ag),C(11,Lg),C(12,Tg)],Td);function gV(r,t,e,n){r.addActivationEvents(n.addActivationEvents);let o=new Ba(r,t.getAllExtensionDescriptions());o.deltaExtensions(n.toAdd,n.toRemove);let i=new No(e.getAllExtensionDescriptions().map(a=>a.identifier));for(let a of n.myToRemove)i.delete(a);for(let a of n.myToAdd)i.add(a);let s=hV(o,i);return{globalRegistry:o,myExtensions:s}}function fV(r,t){return{id:r.identifier.value,name:r.name,extensionVersion:r.version,publisherDisplayName:r.publisher,activationEvents:r.activationEvents?r.activationEvents.join(","):null,isBuiltin:r.isBuiltin,reason:t.activationEvent,reasonId:t.extensionId.value}}function Og(r){return r.getAllExtensionDescriptions().map(t=>t.identifier.value).join(",")}var go=R("IExtHostExtensionService"),Ed=class{#e;#t;#n;constructor(t,e,n,o,i){this.#e=t,this.#t=e,this.#n=n.identifier,this.id=n.identifier.value,this.extensionUri=n.extensionLocation,this.extensionPath=bo(zr(n.extensionLocation)),this.packageJSON=n,this.extensionKind=o,this.isFromDifferentExtensionHost=i}get isActive(){return this.#e.isActivated(this.#n)}get exports(){if(!(this.packageJSON.api==="none"||this.isFromDifferentExtensionHost))return this.#e.getExtensionExports(this.#n)}async activate(){if(this.isFromDifferentExtensionHost)throw new Error("Cannot activate foreign extension");return await this.#e.activateByIdWithErrors(this.#n,{startup:!1,extensionId:this.#t,activationEvent:"api"}),this.exports}};function hV(r,t){return r.getAllExtensionDescriptions().filter(e=>t.has(e.identifier))}var h0=class{constructor(t){this._searchTree=t}setSearchTree(t){this._searchTree=t}findSubstr(t){return this._searchTree.findSubstr(t)}forEach(t){return this._searchTree.forEach(t)}},v0=class{constructor(t){this._map=new uo;this.addActivationEvents(t)}readActivationEvents(t){return this._map.get(t.identifier)??[]}addActivationEvents(t){for(let e of Object.keys(t))this._map.set(e,t[e])}};var Wi=R("IExtHostApiDeprecationService"),Ng=class{constructor(t,e){this._extHostLogService=e;this._reportedUsages=new Set;this._telemetryShape=t.getProxy(F.MainThreadTelemetry)}report(t,e,n,o){let i=this.getUsageKey(t,e,o?.usageId);this._reportedUsages.has(i)||(this._reportedUsages.add(i),e.isUnderDevelopment&&this._extHostLogService.warn(`[Deprecation Warning] '${t}' is deprecated. ${n}`),this._telemetryShape.$publicLog2("extHostDeprecatedApiUsage",{extensionId:e.identifier.value,apiId:t,usageId:o?.usageId??""}))}getUsageKey(t,e,n){let o=`${t}-${e.identifier.value}`;return n?`${o}-${n}`:o}};Ng=_([C(0,se),C(1,oe)],Ng);var zUe=Object.freeze(new class{report(r,t,e){}});var QT=class{static async installEarlyHandler(t){Error.stackTraceLimit=100;let e=t.get(oe),o=t.get(se).getProxy(F.MainThreadErrors);ih(i=>{e.error(i);let s=Yi(i);o.$onUnexpectedError(s)})}static async installFullHandler(t){let e=t.get(oe),n=t.get(se),o=t.get(go),i=t.get(Id),s=t.get(Wi),a=n.getProxy(F.MainThreadExtensionService),l=n.getProxy(F.MainThreadErrors),d=await o.getExtensionRegistry(),c=await o.getExtensionPathIndex(),u=new WeakMap;function m(f,I){if(u.has(f))return u.get(f).stack;let S="",T,P;for(let q of I)S+=`
	at ${q.toString()}`,P=q.getFileName(),!T&&P&&(T=c.findSubstr(b.file(P)));let L=`${f.name||"Error"}: ${f.message||""}${S}`;return u.set(f,{extensionIdentifier:T?.identifier,stack:L}),L}let g=Symbol("prepareStackTrace wrapped"),h=m;Object.defineProperty(Error,"prepareStackTrace",{configurable:!1,get(){return h},set(f){if(f===m||!f||f[g]){h=f||m;return}h=function(I,S){return m(I,S),f.call(Error,I,S)},Object.assign(h,{[g]:!0})}}),ih(f=>{$d.is(f)||e.error(f);let I=Yi(f),S;if(f instanceof Sp?S=f.extension:S=u.get(f)?.extensionIdentifier,!!S)if($d.is(f)){let T=d.getExtensionDescription(S);T&&s.report(f.name,T,`${f.message}
 FROM: ${f.stack}`)}else{a.$onExtensionRuntimeError(S,I);let T=i.onExtensionError(S,f);e.trace("forwarded error to extension?",T,S)}}),Gu.addListener(f=>{l.$onUnexpectedError(f)})}},JT=class r{constructor(t,e,n,o,i){this._hostUtils=n,this._rpcProtocol=new qI(t,null,o),e=r._transform(e,this._rpcProtocol);let s=new xl(...o2());s.set(Ye,{_serviceBrand:void 0,...e,messagePorts:i}),s.set(se,new ex(this._rpcProtocol)),s.set(ds,new tx(o)),s.set(b0,n);let a=new ZI(s,!0);a.invokeFunction(QT.installEarlyHandler),this._logService=a.invokeFunction(l=>l.get(oe)),Ft("code/extHost/didCreateServices"),this._hostUtils.pid?this._logService.info(`Extension host with pid ${this._hostUtils.pid} started`):this._logService.info("Extension host started"),this._logService.trace("initData",e),this._extensionService=a.invokeFunction(l=>l.get(go)),this._extensionService.initialize(),a.invokeFunction(QT.installFullHandler)}async asBrowserUri(t){let e=this._rpcProtocol.getProxy(F.MainThreadExtensionService);return b.revive(await e.$asBrowserUri(t))}terminate(t){this._extensionService.terminate(t)}static _transform(t,e){t.extensions.allExtensions.forEach(o=>{o.extensionLocation=b.revive(e.transformIncomingURIs(o.extensionLocation))}),t.environment.appRoot=b.revive(e.transformIncomingURIs(t.environment.appRoot));let n=t.environment.extensionDevelopmentLocationURI;return n&&(t.environment.extensionDevelopmentLocationURI=n.map(o=>b.revive(e.transformIncomingURIs(o)))),t.environment.extensionTestsLocationURI=b.revive(e.transformIncomingURIs(t.environment.extensionTestsLocationURI)),t.environment.globalStorageHome=b.revive(e.transformIncomingURIs(t.environment.globalStorageHome)),t.environment.workspaceStorageHome=b.revive(e.transformIncomingURIs(t.environment.workspaceStorageHome)),t.nlsBaseUrl=b.revive(e.transformIncomingURIs(t.nlsBaseUrl)),t.logsLocation=b.revive(e.transformIncomingURIs(t.logsLocation)),t.workspace=e.transformIncomingURIs(t.workspace),t}};function jq(r){return{transformIncoming:t=>t.scheme==="vscode-remote"?{scheme:"file",path:t.path,query:t.query,fragment:t.fragment}:t.scheme==="file"?{scheme:"vscode-local",path:t.path,query:t.query,fragment:t.fragment}:t,transformOutgoing:t=>t.scheme==="file"?{scheme:"vscode-remote",authority:r,path:t.path,query:t.query,fragment:t.fragment}:t.scheme==="vscode-local"?{scheme:"file",path:t.path,query:t.query,fragment:t.fragment}:t,transformOutgoingScheme:t=>t==="file"?"vscode-remote":t==="vscode-local"?"file":t}}function vV(r){return new $I(jq(r))}var Ug=class r{constructor(t){this.pipeName=t;this.type=1}static{this.ENV_KEY="VSCODE_EXTHOST_IPC_HOOK"}serialize(t){t[r.ENV_KEY]=this.pipeName}},_b=class r{constructor(){this.type=2}static{this.ENV_KEY="VSCODE_EXTHOST_WILL_SEND_SOCKET"}serialize(t){t[r.ENV_KEY]="1"}},Db=class r{constructor(){this.type=3}static{this.ENV_KEY="VSCODE_WILL_SEND_MESSAGE_PORT"}serialize(t){t[r.ENV_KEY]="1"}};function Gq(r){delete r[Ug.ENV_KEY],delete r[_b.ENV_KEY],delete r[Db.ENV_KEY]}function bV(r){if(r[Ug.ENV_KEY])return y0(r,new Ug(r[Ug.ENV_KEY]));if(r[_b.ENV_KEY])return y0(r,new _b);if(r[Db.ENV_KEY])return y0(r,new Db);throw new Error("No connection information defined in environment!")}function y0(r,t){return Gq(r),t}var TFe=new w("inOutput",!1),EFe=new w("activeLogOutput",!1),wFe=new w("activeLogOutput.isLog",!1),kFe=new w("activeLogOutput.levelSettable",!1),PFe=new w("activeLogOutput.level",""),_Fe=new w("activeLogOutput.levelIsDefault",!1),DFe=new w("outputView.scrollLock",!1),RFe=new w("activeOutputChannel",""),AFe=new w("output.filter.trace",!0),MFe=new w("output.filter.debug",!0),LFe=new w("output.filter.info",!0),OFe=new w("output.filter.warning",!0),NFe=new w("output.filter.error",!0),UFe=new w("outputFilterFocus",!1),FFe=new w("output.filter.categories",""),HFe=R("outputService");var Qq={OutputChannels:"workbench.contributions.outputChannels"};function Jq(r){return Array.isArray(r.source)}var I0=class extends O{constructor(){super(...arguments);this.channels=new Map;this._onDidRegisterChannel=this._register(new E);this.onDidRegisterChannel=this._onDidRegisterChannel.event;this._onDidRemoveChannel=this._register(new E);this.onDidRemoveChannel=this._onDidRemoveChannel.event;this._onDidUpdateChannelFiles=this._register(new E);this.onDidUpdateChannelSources=this._onDidUpdateChannelFiles.event}registerChannel(e){this.channels.has(e.id)||(this.channels.set(e.id,e),this._onDidRegisterChannel.fire(e.id))}getChannels(){let e=[];return this.channels.forEach(n=>e.push(n)),e}getChannel(e){return this.channels.get(e)}updateChannelSources(e,n){let o=this.channels.get(e);o&&Jq(o)&&(o.source=n,this._onDidUpdateChannelFiles.fire(o))}removeChannel(e){let n=this.channels.get(e);n&&(this.channels.delete(e),this._onDidRemoveChannel.fire(n))}};vt.add(Qq.OutputChannels,new I0);var YT=class extends Il{constructor(e,n,o,i,s){super();this.id=e;this.name=n;this.logger=o;this.proxy=i;this.extension=s;this.offset=0;this.visible=!1;this.setLevel(o.getLevel()),this._register(o.onDidChangeLogLevel(a=>this.setLevel(a))),this._register(K(()=>this.proxy.$dispose(this.id)))}get logLevel(){return this.getLevel()}appendLine(e){this.append(e+`
`)}append(e){this.info(e)}clear(){let e=this.offset;this.logger.flush(),this.proxy.$update(this.id,3,e)}replace(e){let n=this.offset;this.info(e),this.proxy.$update(this.id,2,n),this.visible&&this.logger.flush()}show(e,n){this.logger.flush(),this.proxy.$reveal(this.id,!!(typeof e=="boolean"?e:n))}hide(){this.proxy.$close(this.id)}log(e,n){this.offset+=H.fromString(n).byteLength,t2(this.logger,e,n),this.visible&&(this.logger.flush(),this.proxy.$update(this.id,1))}},x0=class extends YT{appendLine(t){this.append(t)}},Fg=class{constructor(t,e,n,o,i,s){this.initData=e;this.extHostFileSystem=n;this.extHostFileSystemInfo=o;this.loggerService=i;this.logService=s;this.extensionLogDirectoryCreationPromise=new Ke;this.logOutputChannels=new Ke;this.namePool=1;this.channels=new Map;this.visibleChannelId=null;this.proxy=t.getProxy(F.MainThreadOutputService),this.outputsLocation=this.extHostFileSystemInfo.extUri.joinPath(e.logsLocation,`output_logging_${iV(new Date).replace(/-|:|\.\d+Z$/g,"")}`)}$setVisibleChannel(t){this.visibleChannelId=t;for(let[e,n]of this.channels)n.visible=e===this.visibleChannelId}createOutputChannel(t,e,n){if(t=t.trim(),!t)throw new Error("illegal argument `name`. must not be falsy");let o=typeof e=="object"&&e.log,i=De(e)?e:void 0;if(De(i)&&!i.trim())throw new Error("illegal argument `languageId`. must not be empty");let s=new $,a,l=this.initData.environment.extensionLogLevel?.find(([c])=>Ee.equals(n.identifier,c))?.[1],d;if(o){let c=this.extHostFileSystemInfo.extUri.joinPath(this.initData.logsLocation,n.identifier.value);d=this.extHostFileSystemInfo.extUri.joinPath(c,`${t.replace(/[\\/:\*\?"<>\|]/g,"")}.log`);let u=this.logOutputChannels.get(d);if(u)return u;let m=this.loggerService.getRegisteredLogger(d);m?.logLevel!==void 0&&(l=m.logLevel),a=this.doCreateLogOutputChannel(t,d,l,n,s)}else a=this.doCreateOutputChannel(t,i,n,s);if(a.then(c=>{this.channels.set(c.id,c),c.visible=c.id===this.visibleChannelId,s.add(K(()=>{this.channels.delete(c.id),d&&this.logOutputChannels.delete(d)}))}),d){let c=this.createExtHostLogOutputChannel(t,l??this.logService.getLevel(),a,s);return this.logOutputChannels.set(d,c),c}return this.createExtHostOutputChannel(t,a,s)}async doCreateOutputChannel(t,e,n,o){this.outputDirectoryPromise||(this.outputDirectoryPromise=this.extHostFileSystem.value.createDirectory(this.outputsLocation).then(()=>this.outputsLocation));let i=await this.outputDirectoryPromise,s=this.extHostFileSystemInfo.extUri.joinPath(i,`${this.namePool++}-${t.replace(/[\\/:\*\?"<>\|]/g,"")}.log`),a=o.add(this.loggerService.createLogger(s,{logLevel:"always",donotRotate:!0,donotUseFormatters:!0,hidden:!0})),l=await this.proxy.$register(t,s,e,n.identifier.value);return o.add(K(()=>this.loggerService.deregisterLogger(s))),new YT(l,t,a,this.proxy,n)}async doCreateLogOutputChannel(t,e,n,o,i){await this.createExtensionLogDirectory(e);let s=`${o.identifier.value}.${this.extHostFileSystemInfo.extUri.basename(e)}`,a=i.add(this.loggerService.createLogger(e,{id:s,name:t,logLevel:n,extensionId:o.identifier.value}));return i.add(K(()=>this.loggerService.deregisterLogger(e))),new x0(s,t,a,this.proxy,o)}createExtensionLogDirectory(t){let e=this.extHostFileSystemInfo.extUri.dirname(t),n=this.extensionLogDirectoryCreationPromise.get(e);return n||this.extensionLogDirectoryCreationPromise.set(e,n=(async()=>{try{await this.extHostFileSystem.value.createDirectory(e)}catch(o){if(Ep(o)!=="EntryExists")throw o}})()),n}createExtHostOutputChannel(t,e,n){let o=()=>{if(n.isDisposed)throw new Error("Channel has been closed")};return e.then(i=>n.add(i)),{get name(){return t},append(i){o(),e.then(s=>s.append(i))},appendLine(i){o(),e.then(s=>s.appendLine(i))},clear(){o(),e.then(i=>i.clear())},replace(i){o(),e.then(s=>s.replace(i))},show(i,s){o(),e.then(a=>a.show(i,s))},hide(){o(),e.then(i=>i.hide())},dispose(){n.dispose()}}}createExtHostLogOutputChannel(t,e,n,o){let i=()=>{if(o.isDisposed)throw new Error("Channel has been closed")},s=o.add(new E);function a(l){e=l,s.fire(l)}return n.then(l=>{l.logLevel!==e&&a(l.logLevel),o.add(l.onDidChangeLogLevel(d=>a(d)))}),{...this.createExtHostOutputChannel(t,n,o),get logLevel(){return e},onDidChangeLogLevel:s.event,trace(l,...d){i(),n.then(c=>c.trace(l,...d))},debug(l,...d){i(),n.then(c=>c.debug(l,...d))},info(l,...d){i(),n.then(c=>c.info(l,...d))},warn(l,...d){i(),n.then(c=>c.warn(l,...d))},error(l,...d){i(),n.then(c=>c.error(l,...d))}}}};Fg=_([C(0,se),C(1,Ye),C(2,Hs),C(3,Gr),C(4,Xo),C(5,oe)],Fg);var XT=R("IExtHostOutputService");var Vs=class{constructor(t,e){this._logService=e;this._provider=new Map;this._proxy=t.getProxy(F.MainThreadDecorations)}static{this._handlePool=0}static{this._maxEventSize=250}registerFileDecorationProvider(t,e){let n=Vs._handlePool++;this._provider.set(n,{provider:t,extensionDescription:e}),this._proxy.$registerDecorationProvider(n,e.identifier.value);let o=t.onDidChangeFileDecorations&&t.onDidChangeFileDecorations(i=>{if(!i){this._proxy.$onDidChange(n,null);return}let s=Dn(i);if(s.length<=Vs._maxEventSize){this._proxy.$onDidChange(n,s);return}this._logService.warn("[Decorations] CAPPING events from decorations provider",e.identifier.value,s.length);let a=s.map(c=>({uri:c,rank:wU(c.path,"/")})),l=UN(a,(c,u)=>c.rank-u.rank||fi(c.uri.path,u.uri.path)),d=[];e:for(let c of l){let u;for(let m of c){let g=cn(m.uri.path);if(u!==g&&(u=g,d.push(m.uri)>=Vs._maxEventSize))break e}}this._proxy.$onDidChange(n,d)});return new be(()=>{o?.dispose(),this._proxy.$unregisterDecorationProvider(n),this._provider.delete(n)})}async $provideDecorations(t,e,n){if(!this._provider.has(t))return Object.create(null);let o=Object.create(null),{provider:i,extensionDescription:s}=this._provider.get(t);return await Promise.all(e.map(async a=>{try{let{uri:l,id:d}=a,c=await Promise.resolve(i.provideFileDecoration(b.revive(l),n));if(!c)return;try{Kc.validate(c),c.badge&&typeof c.badge!="string"&&A(s,"codiconDecoration"),o[d]=[c.propagate,c.tooltip,c.badge,c.color]}catch(u){this._logService.warn(`INVALID decoration from extension '${s.identifier.value}': ${u}`)}}catch(l){this._logService.error(l)}})),o}};Vs=_([C(0,se),C(1,oe)],Vs);var ZT=R("IExtHostDecorations");var eE=class{constructor(t){this.values=t,this.prefixSum=new Uint32Array(t.length),this.prefixSumValidIndex=new Int32Array(1),this.prefixSumValidIndex[0]=-1}getCount(){return this.values.length}insertValues(t,e){t=Xd(t);let n=this.values,o=this.prefixSum,i=e.length;return i===0?!1:(this.values=new Uint32Array(n.length+i),this.values.set(n.subarray(0,t),0),this.values.set(n.subarray(t),t+i),this.values.set(e,t),t-1<this.prefixSumValidIndex[0]&&(this.prefixSumValidIndex[0]=t-1),this.prefixSum=new Uint32Array(this.values.length),this.prefixSumValidIndex[0]>=0&&this.prefixSum.set(o.subarray(0,this.prefixSumValidIndex[0]+1)),!0)}setValue(t,e){return t=Xd(t),e=Xd(e),this.values[t]===e?!1:(this.values[t]=e,t-1<this.prefixSumValidIndex[0]&&(this.prefixSumValidIndex[0]=t-1),!0)}removeValues(t,e){t=Xd(t),e=Xd(e);let n=this.values,o=this.prefixSum;if(t>=n.length)return!1;let i=n.length-t;return e>=i&&(e=i),e===0?!1:(this.values=new Uint32Array(n.length-e),this.values.set(n.subarray(0,t),0),this.values.set(n.subarray(t+e),t),this.prefixSum=new Uint32Array(this.values.length),t-1<this.prefixSumValidIndex[0]&&(this.prefixSumValidIndex[0]=t-1),this.prefixSumValidIndex[0]>=0&&this.prefixSum.set(o.subarray(0,this.prefixSumValidIndex[0]+1)),!0)}getTotalSum(){return this.values.length===0?0:this._getPrefixSum(this.values.length-1)}getPrefixSum(t){return t<0?0:(t=Xd(t),this._getPrefixSum(t))}_getPrefixSum(t){if(t<=this.prefixSumValidIndex[0])return this.prefixSum[t];let e=this.prefixSumValidIndex[0]+1;e===0&&(this.prefixSum[0]=this.values[0],e++),t>=this.values.length&&(t=this.values.length-1);for(let n=e;n<=t;n++)this.prefixSum[n]=this.prefixSum[n-1]+this.values[n];return this.prefixSumValidIndex[0]=Math.max(this.prefixSumValidIndex[0],t),this.prefixSum[t]}getIndexOf(t){t=Math.floor(t),this.getTotalSum();let e=0,n=this.values.length-1,o=0,i=0,s=0;for(;e<=n;)if(o=e+(n-e)/2|0,i=this.prefixSum[o],s=i-this.values[o],t<s)n=o-1;else if(t>=i)e=o+1;else break;return new S0(o,t-s)}};var S0=class{constructor(t,e){this.index=t;this.remainder=e;this._prefixSumIndexOfResultBrand=void 0;this.index=t,this.remainder=e}};var tE=class{constructor(t,e,n,o){this._uri=t,this._lines=e,this._eol=n,this._versionId=o,this._lineStarts=null,this._cachedTextValue=null}dispose(){this._lines.length=0}get version(){return this._versionId}getText(){return this._cachedTextValue===null&&(this._cachedTextValue=this._lines.join(this._eol)),this._cachedTextValue}onEvents(t){t.eol&&t.eol!==this._eol&&(this._eol=t.eol,this._lineStarts=null);let e=t.changes;for(let n of e)this._acceptDeleteRange(n.range),this._acceptInsertText(new An(n.range.startLineNumber,n.range.startColumn),n.text);this._versionId=t.versionId,this._cachedTextValue=null}_ensureLineStarts(){if(!this._lineStarts){let t=this._eol.length,e=this._lines.length,n=new Uint32Array(e);for(let o=0;o<e;o++)n[o]=this._lines[o].length+t;this._lineStarts=new eE(n)}}_setLineText(t,e){this._lines[t]=e,this._lineStarts&&this._lineStarts.setValue(t,this._lines[t].length+this._eol.length)}_acceptDeleteRange(t){if(t.startLineNumber===t.endLineNumber){if(t.startColumn===t.endColumn)return;this._setLineText(t.startLineNumber-1,this._lines[t.startLineNumber-1].substring(0,t.startColumn-1)+this._lines[t.startLineNumber-1].substring(t.endColumn-1));return}this._setLineText(t.startLineNumber-1,this._lines[t.startLineNumber-1].substring(0,t.startColumn-1)+this._lines[t.endLineNumber-1].substring(t.endColumn-1)),this._lines.splice(t.startLineNumber,t.endLineNumber-t.startLineNumber),this._lineStarts&&this._lineStarts.removeValues(t.startLineNumber,t.endLineNumber-t.startLineNumber)}_acceptInsertText(t,e){if(e.length===0)return;let n=uI(e);if(n.length===1){this._setLineText(t.lineNumber-1,this._lines[t.lineNumber-1].substring(0,t.column-1)+n[0]+this._lines[t.lineNumber-1].substring(t.column-1));return}n[n.length-1]+=this._lines[t.lineNumber-1].substring(t.column-1),this._setLineText(t.lineNumber-1,this._lines[t.lineNumber-1].substring(0,t.column-1)+n[0]);let o=new Uint32Array(n.length-1);for(let i=1;i<n.length;i++)this._lines.splice(t.lineNumber+i-1,0,n[i]),o[i-1]=n[i].length+this._eol.length;this._lineStarts&&this._lineStarts.insertValues(t.lineNumber,o)}};var C0=new Map;function yV(r,t){t?C0.set(r,t):C0.delete(r)}function Yq(r){return C0.get(r)}var nE=class extends tE{constructor(e,n,o,i,s,a,l,d,c=!0){super(n,o,i,s);this._proxy=e;this._languageId=a;this._isDirty=l;this._encoding=d;this._strictInstanceofChecks=c;this._isDisposed=!1}dispose(){qn(!this._isDisposed),this._isDisposed=!0,this._isDirty=!1}equalLines(e){return rn(this._lines,e)}get document(){if(!this._document){let e=this;this._document={get uri(){return e._uri},get fileName(){return e._uri.fsPath},get isUntitled(){return e._uri.scheme===V.untitled},get languageId(){return e._languageId},get version(){return e._versionId},get isClosed(){return e._isDisposed},get isDirty(){return e._isDirty},get encoding(){return e._encoding},save(){return e._save()},getText(n){return n?e._getTextInRange(n):e.getText()},get eol(){return e._eol===`
`?1:2},get lineCount(){return e._lines.length},lineAt(n){return e._lineAt(n)},offsetAt(n){return e._offsetAt(n)},positionAt(n){return e._positionAt(n)},validateRange(n){return e._validateRange(n)},validatePosition(n){return e._validatePosition(n)},getWordRangeAtPosition(n,o){return e._getWordRangeAtPosition(n,o)},[Symbol.for("debug.description")](){return`TextDocument(${e._uri.toString()})`}}}return Object.freeze(this._document)}_acceptLanguageId(e){qn(!this._isDisposed),this._languageId=e}_acceptIsDirty(e){qn(!this._isDisposed),this._isDirty=e}_acceptEncoding(e){qn(!this._isDisposed),this._encoding=e}_save(){return this._isDisposed?Promise.reject(new Error("Document has been closed")):this._proxy.$trySaveDocument(this._uri)}_getTextInRange(e){let n=this._validateRange(e);if(n.isEmpty)return"";if(n.isSingleLine)return this._lines[n.start.line].substring(n.start.character,n.end.character);let o=this._eol,i=n.start.line,s=n.end.line,a=[];a.push(this._lines[i].substring(n.start.character));for(let l=i+1;l<s;l++)a.push(this._lines[l]);return a.push(this._lines[s].substring(0,n.end.character)),a.join(o)}_lineAt(e){let n;if(e instanceof we?n=e.line:typeof e=="number"?n=e:!this._strictInstanceofChecks&&we.isPosition(e)&&(n=e.line),typeof n!="number"||n<0||n>=this._lines.length||Math.floor(n)!==n)throw new Error("Illegal value for `line`");return new T0(n,this._lines[n],n===this._lines.length-1)}_offsetAt(e){return e=this._validatePosition(e),this._ensureLineStarts(),this._lineStarts.getPrefixSum(e.line-1)+e.character}_positionAt(e){e=Math.floor(e),e=Math.max(0,e),this._ensureLineStarts();let n=this._lineStarts.getIndexOf(e),o=this._lines[n.index].length;return new we(n.index,Math.min(n.remainder,o))}_validateRange(e){if(this._strictInstanceofChecks){if(!(e instanceof fe))throw new Error("Invalid argument")}else if(!fe.isRange(e))throw new Error("Invalid argument");let n=this._validatePosition(e.start),o=this._validatePosition(e.end);return n===e.start&&o===e.end?e:new fe(n.line,n.character,o.line,o.character)}_validatePosition(e){if(this._strictInstanceofChecks){if(!(e instanceof we))throw new Error("Invalid argument")}else if(!we.isPosition(e))throw new Error("Invalid argument");if(this._lines.length===0)return e.with(0,0);let{line:n,character:o}=e,i=!1;if(n<0)n=0,o=0,i=!0;else if(n>=this._lines.length)n=this._lines.length-1,o=this._lines[n].length,i=!0;else{let s=this._lines[n].length;o<0?(o=0,i=!0):o>s&&(o=s,i=!0)}return i?new we(n,o):e}_getWordRangeAtPosition(e,n){let o=this._validatePosition(e);if(!n)n=Yq(this._languageId);else if(cI(n))throw new Error(`[getWordRangeAtPosition]: ignoring custom regexp '${n.source}' because it matches the empty string.`);let i=aD(o.character+1,sD(n),this._lines[o.line],0);if(i)return new fe(o.line,i.startColumn-1,o.line,i.endColumn-1)}},T0=class{constructor(t,e,n){this._line=t,this._text=e,this._isLastLine=n}get lineNumber(){return this._line}get text(){return this._text}get range(){return new fe(this._line,0,this._line,this._text.length)}get rangeIncludingLineBreak(){return this._isLastLine?this.range:new fe(this._line,0,this._line+1,0)}get firstNonWhitespaceCharacterIndex(){return/^(\s*)/.exec(this._text)[1].length}get isEmptyOrWhitespace(){return this.firstNonWhitespaceCharacterIndex===this._text.length}};var wd=class{constructor(t){this._prefix=t,this._lastId=0}nextId(){return this._prefix+ ++this._lastId}},K2e=new wd("id#");var oE=class r{static{this._Keys=new wd("TextEditorDecorationType")}constructor(t,e,n){let o=r._Keys.nextId();t.$registerTextEditorDecorationType(e.identifier,o,J1.from(n)),this.value=Object.freeze({key:o,dispose(){t.$removeTextEditorDecorationType(o)}})}},E0=class{constructor(t,e){this._collectedEdits=[];this._setEndOfLine=void 0;this._finalized=!1;this._document=t,this._documentVersionId=t.version,this._undoStopBefore=e.undoStopBefore,this._undoStopAfter=e.undoStopAfter}finalize(){return this._finalized=!0,{documentVersionId:this._documentVersionId,edits:this._collectedEdits,setEndOfLine:this._setEndOfLine,undoStopBefore:this._undoStopBefore,undoStopAfter:this._undoStopAfter}}_throwIfFinalized(){if(this._finalized)throw new Error("Edit is only valid while callback runs")}replace(t,e){this._throwIfFinalized();let n=null;if(t instanceof we)n=new fe(t,t);else if(t instanceof fe)n=t;else throw new Error("Unrecognized location");this._pushEdit(n,e,!1)}insert(t,e){this._throwIfFinalized(),this._pushEdit(new fe(t,t),e,!0)}delete(t){this._throwIfFinalized();let e=null;if(t instanceof fe)e=t;else throw new Error("Unrecognized location");this._pushEdit(e,null,!0)}_pushEdit(t,e,n){let o=this._document.validateRange(t);this._collectedEdits.push({range:o,text:e,forceMoveMarkers:n})}setEndOfLine(t){if(this._throwIfFinalized(),t!==1&&t!==2)throw Fe("endOfLine");this._setEndOfLine=t}},w0=class{constructor(t,e,n,o){this._proxy=t,this._id=e,this._accept(n),this._logService=o;let i=this;this.value={get tabSize(){return i._tabSize},set tabSize(s){i._setTabSize(s)},get indentSize(){return i._indentSize},set indentSize(s){i._setIndentSize(s)},get insertSpaces(){return i._insertSpaces},set insertSpaces(s){i._setInsertSpaces(s)},get cursorStyle(){return i._cursorStyle},set cursorStyle(s){i._setCursorStyle(s)},get lineNumbers(){return i._lineNumbers},set lineNumbers(s){i._setLineNumbers(s)}}}_accept(t){this._tabSize=t.tabSize,this._indentSize=t.indentSize,this._originalIndentSize=t.originalIndentSize,this._insertSpaces=t.insertSpaces,this._cursorStyle=t.cursorStyle,this._lineNumbers=du.to(t.lineNumbers)}_validateTabSize(t){if(t==="auto")return"auto";if(typeof t=="number"){let e=Math.floor(t);return e>0?e:null}if(typeof t=="string"){let e=parseInt(t,10);return isNaN(e)?null:e>0?e:null}return null}_setTabSize(t){let e=this._validateTabSize(t);if(e!==null){if(typeof e=="number"){if(this._tabSize===e)return;this._tabSize=e}this._warnOnError("setTabSize",this._proxy.$trySetOptions(this._id,{tabSize:e}))}}_validateIndentSize(t){if(t==="tabSize")return"tabSize";if(typeof t=="number"){let e=Math.floor(t);return e>0?e:null}if(typeof t=="string"){let e=parseInt(t,10);return isNaN(e)?null:e>0?e:null}return null}_setIndentSize(t){let e=this._validateIndentSize(t);if(e!==null){if(typeof e=="number"){if(this._originalIndentSize===e)return;this._indentSize=e,this._originalIndentSize=e}this._warnOnError("setIndentSize",this._proxy.$trySetOptions(this._id,{indentSize:e}))}}_validateInsertSpaces(t){return t==="auto"?"auto":t==="false"?!1:!!t}_setInsertSpaces(t){let e=this._validateInsertSpaces(t);if(typeof e=="boolean"){if(this._insertSpaces===e)return;this._insertSpaces=e}this._warnOnError("setInsertSpaces",this._proxy.$trySetOptions(this._id,{insertSpaces:e}))}_setCursorStyle(t){this._cursorStyle!==t&&(this._cursorStyle=t,this._warnOnError("setCursorStyle",this._proxy.$trySetOptions(this._id,{cursorStyle:t})))}_setLineNumbers(t){this._lineNumbers!==t&&(this._lineNumbers=t,this._warnOnError("setLineNumbers",this._proxy.$trySetOptions(this._id,{lineNumbers:du.from(t)})))}assign(t){let e={},n=!1;if(typeof t.tabSize<"u"){let o=this._validateTabSize(t.tabSize);o==="auto"?(n=!0,e.tabSize=o):typeof o=="number"&&this._tabSize!==o&&(this._tabSize=o,n=!0,e.tabSize=o)}if(typeof t.indentSize<"u"){let o=this._validateIndentSize(t.indentSize);o==="tabSize"?(n=!0,e.indentSize=o):typeof o=="number"&&this._originalIndentSize!==o&&(this._indentSize=o,this._originalIndentSize=o,n=!0,e.indentSize=o)}if(typeof t.insertSpaces<"u"){let o=this._validateInsertSpaces(t.insertSpaces);o==="auto"?(n=!0,e.insertSpaces=o):this._insertSpaces!==o&&(this._insertSpaces=o,n=!0,e.insertSpaces=o)}typeof t.cursorStyle<"u"&&this._cursorStyle!==t.cursorStyle&&(this._cursorStyle=t.cursorStyle,n=!0,e.cursorStyle=t.cursorStyle),typeof t.lineNumbers<"u"&&this._lineNumbers!==t.lineNumbers&&(this._lineNumbers=t.lineNumbers,n=!0,e.lineNumbers=du.from(t.lineNumbers)),n&&this._warnOnError("setOptions",this._proxy.$trySetOptions(this._id,e))}_warnOnError(t,e){e.catch(n=>{this._logService.warn(`ExtHostTextEditorOptions '${t}' failed:'`),this._logService.warn(n)})}},rE=class{constructor(t,e,n,o,i,s,a,l){this.id=t;this._proxy=e;this._logService=n;this._disposed=!1;this._hasDecorationsForKey=new Set;this._selections=i,this._options=new w0(this._proxy,this.id,s,n),this._visibleRanges=a,this._viewColumn=l;let d=this;this.value=Object.freeze({get document(){return o.value},set document(c){throw new ui("document")},get selection(){return d._selections&&d._selections[0]},set selection(c){if(!(c instanceof Jn))throw Fe("selection");d._selections=[c],d._trySetSelection()},get selections(){return d._selections},set selections(c){if(!Array.isArray(c)||c.some(u=>!(u instanceof Jn)))throw Fe("selections");c.length===0&&(c=[new Jn(0,0,0,0)]),d._selections=c,d._trySetSelection()},get visibleRanges(){return d._visibleRanges},set visibleRanges(c){throw new ui("visibleRanges")},get diffInformation(){return d._diffInformation},get options(){return d._options.value},set options(c){d._disposed||d._options.assign(c)},get viewColumn(){return d._viewColumn},set viewColumn(c){throw new ui("viewColumn")},edit(c,u={undoStopBefore:!0,undoStopAfter:!0}){if(d._disposed)return Promise.reject(new Error("TextEditor#edit not possible on closed editors"));let m=new E0(o.value,u);return c(m),d._applyEdit(m)},insertSnippet(c,u,m={undoStopBefore:!0,undoStopAfter:!0}){if(d._disposed)return Promise.reject(new Error("TextEditor#insertSnippet not possible on closed editors"));let g;if(!u||Array.isArray(u)&&u.length===0)g=d._selections.map(h=>j.from(h));else if(u instanceof we){let{lineNumber:h,column:f}=ct.from(u);g=[{startLineNumber:h,startColumn:f,endLineNumber:h,endColumn:f}]}else if(u instanceof fe)g=[j.from(u)];else{g=[];for(let h of u)if(h instanceof fe)g.push(j.from(h));else{let{lineNumber:f,column:I}=ct.from(h);g.push({startLineNumber:f,startColumn:I,endLineNumber:f,endColumn:I})}}return m.keepWhitespace===void 0&&(m.keepWhitespace=!1),e.$tryInsertSnippet(t,o.value.version,c.value,g,m)},setDecorations(c,u){let m=u.length===0;m&&!d._hasDecorationsForKey.has(c.key)||(m?d._hasDecorationsForKey.delete(c.key):d._hasDecorationsForKey.add(c.key),d._runOnProxy(()=>{if(Q1(u))return e.$trySetDecorations(t,c.key,d4(u));{let g=new Array(4*u.length);for(let h=0,f=u.length;h<f;h++){let I=u[h];g[4*h]=I.start.line+1,g[4*h+1]=I.start.character+1,g[4*h+2]=I.end.line+1,g[4*h+3]=I.end.character+1}return e.$trySetDecorationsFast(t,c.key,g)}}))},revealRange(c,u){d._runOnProxy(()=>e.$tryRevealRange(t,j.from(c),u||0))},show(c){e.$tryShowEditor(t,Vt.from(c))},hide(){e.$tryHideEditor(t)},[Symbol.for("debug.description")](){return`TextEditor(${this.document.uri.toString()})`}})}dispose(){qn(!this._disposed),this._disposed=!0}_acceptOptions(t){qn(!this._disposed),this._options._accept(t)}_acceptVisibleRanges(t){qn(!this._disposed),this._visibleRanges=t}_acceptViewColumn(t){qn(!this._disposed),this._viewColumn=t}_acceptSelections(t){qn(!this._disposed),this._selections=t}_acceptDiffInformation(t){qn(!this._disposed),this._diffInformation=t}async _trySetSelection(){let t=this._selections.map(Eo.from);return await this._runOnProxy(()=>this._proxy.$trySetSelections(this.id,t)),this.value}_applyEdit(t){let e=t.finalize();if(e.edits.length===0&&!e.setEndOfLine)return Promise.resolve(!0);let n=e.edits.map(i=>i.range);n.sort((i,s)=>i.end.line===s.end.line?i.end.character===s.end.character?i.start.line===s.start.line?i.start.character-s.start.character:i.start.line-s.start.line:i.end.character-s.end.character:i.end.line-s.end.line);for(let i=0,s=n.length-1;i<s;i++){let a=n[i].end;if(n[i+1].start.isBefore(a))return Promise.reject(new Error("Overlapping ranges are not allowed!"))}let o=e.edits.map(i=>({range:j.from(i.range),text:i.text,forceMoveMarkers:i.forceMoveMarkers}));return this._proxy.$tryApplyEdits(this.id,e.documentVersionId,o,{setEndOfLine:typeof e.setEndOfLine=="number"?ru.from(e.setEndOfLine):void 0,undoStopBefore:e.undoStopBefore,undoStopAfter:e.undoStopAfter})}_runOnProxy(t){return this._disposed?(this._logService.warn("TextEditor is closed/disposed"),Promise.resolve(void 0)):t().then(()=>this,e=>(e instanceof Error&&e.name==="DISPOSED"||this._logService.warn(e),null))}};var k0=class{constructor(t){this.value=t;this._count=0}ref(){this._count++}unref(){return--this._count===0}},Hg=class{constructor(t,e){this._extHostRpc=t;this._logService=e;this._activeEditorId=null;this._editors=new Map;this._documents=new Ke;this._onDidAddDocuments=new E;this._onDidRemoveDocuments=new E;this._onDidChangeVisibleTextEditors=new E;this._onDidChangeActiveTextEditor=new E;this.onDidAddDocuments=this._onDidAddDocuments.event;this.onDidRemoveDocuments=this._onDidRemoveDocuments.event;this.onDidChangeVisibleTextEditors=this._onDidChangeVisibleTextEditors.event;this.onDidChangeActiveTextEditor=this._onDidChangeActiveTextEditor.event}$acceptDocumentsAndEditorsDelta(t){this.acceptDocumentsAndEditorsDelta(t)}acceptDocumentsAndEditorsDelta(t){let e=[],n=[],o=[];if(t.removedDocuments)for(let i of t.removedDocuments){let s=b.revive(i),a=this._documents.get(s);a?.unref()&&(this._documents.delete(s),e.push(a.value))}if(t.addedDocuments)for(let i of t.addedDocuments){let s=b.revive(i.uri),a=this._documents.get(s);if(a&&s.scheme!==V.vscodeNotebookCell&&s.scheme!==V.vscodeInteractiveInput)throw new Error(`document '${s} already exists!'`);a||(a=new k0(new nE(this._extHostRpc.getProxy(F.MainThreadDocuments),s,i.lines,i.EOL,i.versionId,i.languageId,i.isDirty,i.encoding)),this._documents.set(s,a),n.push(a.value)),a.ref()}if(t.removedEditors)for(let i of t.removedEditors){let s=this._editors.get(i);this._editors.delete(i),s&&o.push(s)}if(t.addedEditors)for(let i of t.addedEditors){let s=b.revive(i.documentUri);qn(this._documents.has(s),`document '${s}' does not exist`),qn(!this._editors.has(i.id),`editor '${i.id}' already exists!`);let a=this._documents.get(s).value,l=new rE(i.id,this._extHostRpc.getProxy(F.MainThreadTextEditors),this._logService,new mt(()=>a.document),i.selections.map(Eo.to),i.options,i.visibleRanges.map(d=>j.to(d)),typeof i.editorPosition=="number"?Vt.to(i.editorPosition):void 0);this._editors.set(i.id,l)}t.newActiveEditor!==void 0&&(qn(t.newActiveEditor===null||this._editors.has(t.newActiveEditor),`active editor '${t.newActiveEditor}' does not exist`),this._activeEditorId=t.newActiveEditor),Cn(e),Cn(o),t.removedDocuments&&this._onDidRemoveDocuments.fire(e),t.addedDocuments&&this._onDidAddDocuments.fire(n),(t.removedEditors||t.addedEditors)&&this._onDidChangeVisibleTextEditors.fire(this.allEditors().map(i=>i.value)),t.newActiveEditor!==void 0&&this._onDidChangeActiveTextEditor.fire(this.activeEditor())}getDocument(t){return this._documents.get(t)?.value}allDocuments(){return Nt.map(this._documents.values(),t=>t.value)}getEditor(t){return this._editors.get(t)}activeEditor(t){if(!this._activeEditorId)return;let e=this._editors.get(this._activeEditorId);return t?e:e?.value}allEditors(){return[...this._editors.values()]}};Hg=_([C(0,se),C(1,oe)],Hg);var Hr=R("IExtHostDocumentsAndEditors");var Xq={type:"object",additionalProperties:!1,properties:{type:{type:"string",description:p(14700,null)},required:{type:"array",items:{type:"string"}},properties:{type:"object",description:p(14701,null),additionalProperties:{$ref:"http://json-schema.org/draft-07/schema#"}},when:{type:"string",markdownDescription:p(14702,null),default:""}}},IV;(t=>{function r(e,n,o){if(!e)return;let i=De(e.type)?e.type:void 0;if(!i||i.length===0){o.error(p(14704,null));return}let s=[];if(Array.isArray(e.required))for(let a of e.required)De(a)&&s.push(a);return{extensionId:n.value,taskType:i,required:s,properties:e.properties?at(e.properties):{},when:e.when?Wt.deserialize(e.when):void 0}}t.from=r})(IV||={});var Zq=Jx.registerExtensionPoint({extensionPoint:"taskDefinitions",activationEventsGenerator:function*(r){for(let t of r)t.type&&(yield`onTaskType:${t.type}`)},jsonSchema:{description:p(14703,null),type:"array",items:Xq}}),P0=class{constructor(){this._onDefinitionsChanged=new E;this.onDefinitionsChanged=this._onDefinitionsChanged.event;this.taskTypes=Object.create(null),this.readyPromise=new Promise((t,e)=>{Zq.setHandler((n,o)=>{this._schema=void 0;try{for(let i of o.removed){let s=i.value;for(let a of s)this.taskTypes&&a.type&&this.taskTypes[a.type]&&delete this.taskTypes[a.type]}for(let i of o.added){let s=i.value;for(let a of s){let l=IV.from(a,i.description.identifier,i.collector);l&&(this.taskTypes[l.taskType]=l)}}(o.removed.length>0||o.added.length>0)&&this._onDefinitionsChanged.fire()}catch{}t(void 0)})})}onReady(){return this.readyPromise}get(t){return this.taskTypes[t]}all(){return Object.keys(this.taskTypes).map(t=>this.taskTypes[t])}getJsonSchema(){if(this._schema===void 0){let t=[];for(let e of this.all()){let n={type:"object",additionalProperties:!1};e.required.length>0&&(n.required=e.required.slice(0)),e.properties!==void 0?n.properties=at(e.properties):n.properties=Object.create(null),n.properties.type={type:"string",enum:[e.taskType]},t.push(n)}this._schema={oneOf:t}}return this._schema}},xV=new P0;var eK={IconContribution:"base.contributions.icons"},tK;(t=>{function r(e,n){let o=e.defaults;for(;ut.isThemeIcon(o);){let i=Wg.getIcon(o.id);if(!i)return;o=i.defaults}return o}t.getDefinition=r})(tK||={});var nK;(e=>{function r(n){return{weight:n.weight,style:n.style,src:n.src.map(o=>({format:o.format,location:o.location.toString()}))}}e.toJSONObject=r;function t(n){let o=i=>De(i)?i:void 0;if(n&&Array.isArray(n.src)&&n.src.every(i=>De(i.format)&&De(i.location)))return{weight:o(n.weight),style:o(n.style),src:n.src.map(i=>({format:i.format,location:b.parse(i.location)}))}}e.fromJSONObject=t})(nK||={});var oK=/^([\w_-]+)$/;var rK=p(2668,null),_0=class extends O{constructor(){super();this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this.iconSchema={definitions:{icons:{type:"object",properties:{fontId:{type:"string",description:p(2665,null),pattern:oK.source,patternErrorMessage:rK},fontCharacter:{type:"string",description:p(2664,null)}},additionalProperties:!1,defaultSnippets:[{body:{fontCharacter:"\\\\e030"}}]}},type:"object",properties:{}};this.iconReferenceSchema={type:"string",pattern:`^${ut.iconNameExpression}$`,enum:[],enumDescriptions:[]};this.iconsById={},this.iconFontsById={}}registerIcon(e,n,o,i){let s=this.iconsById[e];if(s){if(o&&!s.description){s.description=o,this.iconSchema.properties[e].markdownDescription=`${o} $(${e})`;let d=this.iconReferenceSchema.enum.indexOf(e);d!==-1&&(this.iconReferenceSchema.enumDescriptions[d]=o),this._onDidChange.fire()}return s}let a={id:e,description:o,defaults:n,deprecationMessage:i};this.iconsById[e]=a;let l={$ref:"#/definitions/icons"};return i&&(l.deprecationMessage=i),o&&(l.markdownDescription=`${o}: $(${e})`),this.iconSchema.properties[e]=l,this.iconReferenceSchema.enum.push(e),this.iconReferenceSchema.enumDescriptions.push(o||""),this._onDidChange.fire(),{id:e}}deregisterIcon(e){delete this.iconsById[e],delete this.iconSchema.properties[e];let n=this.iconReferenceSchema.enum.indexOf(e);n!==-1&&(this.iconReferenceSchema.enum.splice(n,1),this.iconReferenceSchema.enumDescriptions.splice(n,1)),this._onDidChange.fire()}getIcons(){return Object.keys(this.iconsById).map(e=>this.iconsById[e])}getIcon(e){return this.iconsById[e]}getIconSchema(){return this.iconSchema}getIconReferenceSchema(){return this.iconReferenceSchema}registerIconFont(e,n){let o=this.iconFontsById[e];return o||(this.iconFontsById[e]=n,this._onDidChange.fire(),n)}deregisterIconFont(e){delete this.iconFontsById[e]}getIconFont(e){return this.iconFontsById[e]}toString(){let e=(s,a)=>s.id.localeCompare(a.id),n=s=>{for(;ut.isThemeIcon(s.defaults);)s=this.iconsById[s.defaults.id];return`codicon codicon-${s?s.id:""}`},o=[];o.push("| preview     | identifier                        | default codicon ID                | description"),o.push("| ----------- | --------------------------------- | --------------------------------- | --------------------------------- |");let i=Object.keys(this.iconsById).map(s=>this.iconsById[s]);for(let s of i.filter(a=>!!a.description).sort(e))o.push(`|<i class="${n(s)}"></i>|${s.id}|${ut.isThemeIcon(s.defaults)?s.defaults.id:s.id}|${s.description||""}|`);o.push("| preview     | identifier                        "),o.push("| ----------- | --------------------------------- |");for(let s of i.filter(a=>!ut.isThemeIcon(a.defaults)).sort(e))o.push(`|<i class="${n(s)}"></i>|${s.id}|`);return o.join(`
`)}},Wg=new _0;vt.add(eK.IconContribution,Wg);function Su(r,t,e,n){return Wg.registerIcon(r,t,e,n)}function iK(){let r=C2();for(let t in r){let e="\\"+r[t].toString(16);Wg.registerIcon(t,{fontCharacter:e})}}iK();var CV="vscode://schemas/icons",TV=vt.as(kc.JSONContribution);TV.registerSchema(CV,Wg.getIconSchema());var SV=new jn(()=>TV.notifySchemaChanged(CV),200);Wg.onDidChange(()=>{SV.isScheduled()||SV.schedule()});var FHe=Su("widget-close",ce.close,p(2669,null)),HHe=Su("goto-previous-location",ce.arrowUp,p(2667,null)),WHe=Su("goto-next-location",ce.arrowDown,p(2666,null)),VHe=ut.modify(ce.sync,"spin"),BHe=ut.modify(ce.loading,"spin");var EV="settings",JHe=new w("taskRunning",!1,p(14707,null)),YHe=new w("taskTerminalActive",!1,p(14709,null)),XHe=Qd(14708,"Tasks"),R0=(n=>(n[n.Escape=1]="Escape",n[n.Strong=2]="Strong",n[n.Weak=3]="Weak",n))(R0||{});(t=>{function r(e){if(!e)return 2;switch(e.toLowerCase()){case"escape":return 1;case"strong":return 2;case"weak":return 3;default:return 2}}t.from=r})(R0||={});var sK;(t=>t.defaults={cwd:"${workspaceFolder}"})(sK||={});var A0=(n=>(n[n.Always=1]="Always",n[n.Silent=2]="Silent",n[n.Never=3]="Never",n))(A0||{});(t=>{function r(e){switch(e.toLowerCase()){case"always":return 1;case"silent":return 2;case"never":return 3;default:return 1}}t.fromString=r})(A0||={});var M0=(n=>(n[n.Never=1]="Never",n[n.OnProblem=2]="OnProblem",n[n.Always=3]="Always",n))(M0||{});(t=>{function r(e){switch(e.toLowerCase()){case"always":return 3;case"never":return 1;case"onproblem":return 2;default:return 2}}t.fromString=r})(M0||={});var L0=(n=>(n[n.Shared=1]="Shared",n[n.Dedicated=2]="Dedicated",n[n.New=3]="New",n))(L0||{});(t=>{function r(e){switch(e.toLowerCase()){case"shared":return 1;case"dedicated":return 2;case"new":return 3;default:return 1}}t.fromString=r})(L0||={});var aK;(t=>t.defaults={echo:!0,reveal:1,revealProblems:1,focus:!1,panel:1,showReuseMessage:!0,clear:!1,preserveTerminalName:!1})(aK||={});var O0=(n=>(n[n.Shell=1]="Shell",n[n.Process=2]="Process",n[n.CustomExecution=3]="CustomExecution",n))(O0||{});(e=>{function r(n){switch(n.toLowerCase()){case"shell":return 1;case"process":return 2;case"customExecution":return 3;default:return 2}}e.fromString=r;function t(n){switch(n){case 1:return"shell";case 2:return"process";case 3:return"customExecution";default:return"process"}}e.toString=t})(O0||={});var lK;(t=>{function r(e){return De(e)?e:e.value}t.value=r})(lK||={});var dK;(s=>{s.Clean={_id:"clean",isDefault:!1},s.Build={_id:"build",isDefault:!1},s.Rebuild={_id:"rebuild",isDefault:!1},s.Test={_id:"test",isDefault:!1};function o(a){return a===s.Clean._id||a===s.Build._id||a===s.Rebuild._id||a===s.Test._id}s.is=o;function i(a){if(a!==void 0)return De(a)?o(a)?{_id:a,isDefault:!1}:void 0:a}s.from=i})(dK||={});var cK;(s=>{s.Workspace="workspace",s.Extension="extension",s.InMemory="inMemory",s.WorkspaceFile="workspaceFile",s.User="user";function i(a){switch(a){case s.User:return 2;case s.WorkspaceFile:return 5;default:return 6}}s.toConfigurationTarget=i})(cK||={});var uK;(t=>t.defaults={reevaluateOnRerun:!0,runOn:1,instanceLimit:1,instancePolicy:"prompt"})(uK||={});var N0=(e=>(e[e.Process=1]="Process",e[e.Terminal=2]="Terminal",e))(N0||{});(t=>t._default=2)(N0||={});var pK;(d=>{function r(c){return{taskId:c._id,taskName:c.configurationProperties.name,runType:c.configurationProperties.isBackground?"background":"singleRun",group:c.configurationProperties.group,__task:c}}function t(c,u,m){return{...r(c),kind:"start",terminalId:u,resolvedVariables:m}}d.start=t;function e(c,u,m){return{...r(c),kind:"processStarted",terminalId:u,processId:m}}d.processStarted=e;function n(c,u,m,g){return{...r(c),kind:"processEnded",terminalId:u,exitCode:m,durationMs:g}}d.processEnded=n;function o(c,u,m){return{...r(c),kind:"inactive",terminalId:u,durationMs:m}}d.inactive=o;function i(c,u,m){return{...r(c),kind:"terminated",exitReason:m,terminalId:u}}d.terminated=i;function s(c,u,m){return{...r(u),kind:c,terminalId:m}}d.general=s;function a(c,u,m){return{...r(c),kind:"problemMatcherEnded",hasErrors:u}}d.problemMatcherEnded=a;function l(){return{kind:"changed"}}d.changed=l})(pK||={});var D0;(e=>{function r(n){let o=Object.keys(n).sort(),i="";for(let s of o){let a=n[s];a instanceof Object?a=r(a):typeof a=="string"&&(a=a.replace(/,/g,",,")),i+=s+","+a+","}return i}function t(n){let i={_key:r(n),type:n.taskType};return Object.assign(i,n),i}e.create=t})(D0||={});var mK;(t=>{function r(e,n){let o=xV.get(e.type);if(o===void 0){let l=at(e);return delete l._key,D0.create(l)}let i=Object.create(null);i.type=o.taskType;let s=new Set;o.required.forEach(l=>s.add(l));let a=o.properties;for(let l of Object.keys(a)){let d=e[l];if(d!=null)i[l]=d;else if(s.has(l)){let c=a[l];if(c.default!==void 0)i[l]=at(c.default);else switch(c.type){case"boolean":i[l]=!1;break;case"number":case"integer":i[l]=0;break;case"string":i[l]="";break;default:n.error(p(14706,null,JSON.stringify(e,void 0,0),l));return}}}return D0.create(i)}t.createTaskIdentifier=r})(mK||={});var ZHe=Su("rerun-task",ce.refresh,p(14705,null));var U0;(e=>{function r(n){if(n!=null)return n}e.from=r;function t(n){if(n!=null)return n}e.to=t})(U0||={});var F0;(e=>{function r(n){if(n!=null)return n}e.from=r;function t(n){if(n!=null)return n}e.to=t})(F0||={});var wV;(e=>{function r(n){if(n!=null)return n}e.from=r;function t(n){if(n!=null)return n}e.to=t})(wV||={});var iE;(n=>{function r(o){if(o){let i=o;return i&&!!i.process}else return!1}n.is=r;function t(o){if(o==null)return;let i={process:o.process,args:o.args};return o.options&&(i.options=wV.from(o.options)),i}n.from=t;function e(o){if(o!=null)return new Cs(o.process,o.args,o.options)}n.to=e})(iE||={});var kV;(e=>{function r(n){if(n!=null)return n}e.from=r;function t(n){if(n!=null)return n}e.to=t})(kV||={});var sE;(n=>{function r(o){if(o){let i=o;return i&&(!!i.commandLine||!!i.command)}else return!1}n.is=r;function t(o){if(o==null)return;let i={};return o.commandLine!==void 0?i.commandLine=o.commandLine:(i.command=o.command,i.args=o.args),o.options&&(i.options=kV.from(o.options)),i}n.from=t;function e(o){if(!(o==null||o.command===void 0&&o.commandLine===void 0))return o.commandLine?new Di(o.commandLine,o.options):new Di(o.command,o.args?o.args:[],o.options)}n.to=e})(sE||={});var Vi;(n=>{function r(o){if(o){let i=o;return i&&i.customExecution==="customExecution"}else return!1}n.is=r;function t(o){return{customExecution:"customExecution"}}n.from=t;function e(o,i){return i.get(o)}n.to=e})(Vi||={});var H0;(t=>{function r(e,n){let o;return e.scope!==void 0&&typeof e.scope!="number"?o=e.scope.uri:e.scope!==void 0&&typeof e.scope=="number"&&(e.scope===2&&n&&n.workspaceFile?o=n.workspaceFile:o=EV),{id:e._id,workspaceFolder:o}}t.from=r})(H0||={});var PV;(t=>{function r(e){if(e!=null)return{_id:e.id,isDefault:e.isDefault}}t.from=r})(PV||={});var Bs;(n=>{function r(o,i){if(o==null)return[];let s=[];for(let a of o){let l=t(a,i);l&&s.push(l)}return s}n.fromMany=r;function t(o,i){if(o==null)return;let s;o.execution instanceof Cs?s=iE.from(o.execution):o.execution instanceof Di?s=sE.from(o.execution):o.execution&&o.execution instanceof zc&&(s=Vi.from(o.execution));let a=U0.from(o.definition),l;return o.scope?typeof o.scope=="number"?l=o.scope:l=o.scope.uri:l=2,!a||!l?void 0:{_id:o._id,definition:a,name:o.name,source:{extensionId:i.identifier.value,label:o.source,scope:l},execution:s,isBackground:o.isBackground,group:PV.from(o.group),presentationOptions:F0.from(o.presentationOptions),problemMatchers:Dn(o.problemMatchers),hasDefinedMatchers:o.hasDefinedMatchers,runOptions:o.runOptions?o.runOptions:{reevaluateOnRerun:!0},detail:o.detail}}n.from=t;async function e(o,i,s){if(o==null)return;let a;iE.is(o.execution)?a=iE.to(o.execution):sE.is(o.execution)?a=sE.to(o.execution):Vi.is(o.execution)&&(a=Vi.to(o._id,s));let l=U0.to(o.definition),d;if(o.source&&(o.source.scope!==void 0?typeof o.source.scope=="number"?d=o.source.scope:d=await i.resolveWorkspaceFolder(b.revive(o.source.scope)):d=2),!l||!d)return;let c=new Vn(l,d,o.name,o.source.label,a,o.problemMatchers);return o.isBackground!==void 0&&(c.isBackground=o.isBackground),o.group!==void 0&&(c.group=Mn.from(o.group._id),c.group&&o.group.isDefault&&(c.group=new Mn(c.group.id,c.group.label),o.group.isDefault===!0&&(c.group.isDefault=o.group.isDefault))),o.presentationOptions&&(c.presentationOptions=F0.to(o.presentationOptions)),o.runOptions&&(c.runOptions=o.runOptions),o._id&&(c._id=o._id),o.detail&&(c.detail=o.detail),c}n.to=e})(Bs||={});var _V;(e=>{function r(n){return n}e.from=r;function t(n){if(n)return Object.assign(Object.create(null),n)}e.to=t})(_V||={});var Rb=class{constructor(t,e,n){this._id=e;this._task=n;this.#e=t}#e;get task(){return this._task}terminate(){this.#e.terminateTask(this)}fireDidStartProcess(t){}fireDidEndProcess(t){}get terminal(){return this._terminal}set terminal(t){this._terminal=t}},Cu=class{constructor(t,e,n,o,i,s,a,l){this._onDidExecuteTask=new E;this._onDidTerminateTask=new E;this._onDidTaskProcessStarted=new E;this._onDidTaskProcessEnded=new E;this._onDidStartTaskProblemMatchers=new E;this._onDidEndTaskProblemMatchers=new E;this._proxy=t.getProxy(F.MainThreadTask),this._workspaceProvider=n,this._editorService=o,this._configurationService=i,this._terminalService=s,this._handleCounter=0,this._handlers=new Map,this._taskExecutions=new Map,this._taskExecutionPromises=new Map,this._providedCustomExecutions2=new Map,this._notProvidedCustomExecutions=new Set,this._activeCustomExecutions2=new Map,this._logService=a,this._deprecationService=l,this._proxy.$registerSupportedExecutions(!0)}registerTaskProvider(t,e,n){if(!n)return new be(()=>{});let o=this.nextHandle();return this._handlers.set(o,{type:e,provider:n,extension:t}),this._proxy.$registerTaskProvider(o,e),new be(()=>{this._handlers.delete(o),this._proxy.$unregisterTaskProvider(o)})}registerTaskSystem(t,e){this._proxy.$registerTaskSystem(t,e)}fetchTasks(t){return this._proxy.$fetchTasks(_V.from(t)).then(async e=>{let n=[];for(let o of e){let i=await Bs.to(o,this._workspaceProvider,this._providedCustomExecutions2);i&&n.push(i)}return n})}get taskExecutions(){let t=[];return this._taskExecutions.forEach(e=>t.push(e)),t}terminateTask(t){if(!(t instanceof Rb))throw new Error("No valid task execution provided");return this._proxy.$terminateTask(t._id)}get onDidStartTask(){return this._onDidExecuteTask.event}async $onDidStartTask(t,e,n){let o=this._providedCustomExecutions2.get(t.id);o&&(this._activeCustomExecutions2.set(t.id,o),this._terminalService.attachPtyToTerminal(e,await o.callback(n))),this._lastStartedTask=t.id;let i=await this.getTaskExecution(t),s=this._terminalService.getTerminalById(e)?.value;i&&(i.terminal=s),this._onDidExecuteTask.fire({execution:i})}get onDidEndTask(){return this._onDidTerminateTask.event}async $OnDidEndTask(t){if(!this._taskExecutionPromises.has(t.id))return;let e=await this.getTaskExecution(t);this._taskExecutionPromises.delete(t.id),this._taskExecutions.delete(t.id),this.customExecutionComplete(t),this._onDidTerminateTask.fire({execution:e})}get onDidStartTaskProcess(){return this._onDidTaskProcessStarted.event}async $onDidStartTaskProcess(t){let e=await this.getTaskExecution(t.id);this._onDidTaskProcessStarted.fire({execution:e,processId:t.processId})}get onDidEndTaskProcess(){return this._onDidTaskProcessEnded.event}async $onDidEndTaskProcess(t){let e=await this.getTaskExecution(t.id);this._onDidTaskProcessEnded.fire({execution:e,exitCode:t.exitCode})}get onDidStartTaskProblemMatchers(){return this._onDidStartTaskProblemMatchers.event}async $onDidStartTaskProblemMatchers(t){let e;try{e=await this.getTaskExecution(t.execution.id)}catch{return}this._onDidStartTaskProblemMatchers.fire({execution:e})}get onDidEndTaskProblemMatchers(){return this._onDidEndTaskProblemMatchers.event}async $onDidEndTaskProblemMatchers(t){let e;try{e=await this.getTaskExecution(t.execution.id)}catch{return}this._onDidEndTaskProblemMatchers.fire({execution:e,hasErrors:t.hasErrors})}$provideTasks(t,e){let n=this._handlers.get(t);if(!n)return Promise.reject(new Error("no handler found"));let o=[],i=hn(()=>n.provider.provideTasks(ve.None)).then(s=>this.provideTasksInternal(e,o,n,s));return new Promise(s=>{i.then(a=>{Promise.all(o).then(()=>{s(a)})})})}async $resolveTask(t,e){let n=this._handlers.get(t);if(!n)return Promise.reject(new Error("no handler found"));if(e.definition.type!==n.type)throw new Error(`Unexpected: Task of type [${e.definition.type}] cannot be resolved by provider of type [${n.type}].`);let o=await Bs.to(e,this._workspaceProvider,this._providedCustomExecutions2);if(!o)throw new Error("Unexpected: Task cannot be resolved.");let i=await n.provider.resolveTask(o,ve.None);if(!i)return;this.checkDeprecation(i,n);let s=Bs.from(i,n.extension);if(!s)throw new Error("Unexpected: Task cannot be resolved.");if(i.definition!==o.definition)throw new Error("Unexpected: The resolved task definition must be the same object as the original task definition. The task definition cannot be changed.");return Vi.is(s.execution)&&await this.addCustomExecution(s,i,!0),await this.resolveTaskInternal(s)}nextHandle(){return this._handleCounter++}async addCustomExecution(t,e,n){let o=await this._proxy.$createTaskId(t);!n&&!this._providedCustomExecutions2.has(o)&&(this._notProvidedCustomExecutions.add(o),this._activeCustomExecutions2.set(o,e.execution)),this._providedCustomExecutions2.set(o,e.execution)}async getTaskExecution(t,e){if(typeof t=="string"){let i=this._taskExecutionPromises.get(t);if(!i)throw new ho("Unexpected: The specified task is missing an execution");return i}let n=this._taskExecutionPromises.get(t.id);if(n)return n;let o;return e?o=Promise.resolve(new Rb(this,t.id,e)):o=Bs.to(t.task,this._workspaceProvider,this._providedCustomExecutions2).then(i=>{if(!i)throw new ho("Unexpected: Task does not exist.");return new Rb(this,t.id,i)}),this._taskExecutionPromises.set(t.id,o),o.then(i=>(this._taskExecutions.set(t.id,i),i))}checkDeprecation(t,e){t._deprecated&&this._deprecationService.report("Task.constructor",e.extension,"Use the Task constructor that takes a `scope` instead.")}customExecutionComplete(t){this._activeCustomExecutions2.get(t.id)&&this._activeCustomExecutions2.delete(t.id),this._notProvidedCustomExecutions.has(t.id)&&this._lastStartedTask!==t.id&&(this._providedCustomExecutions2.delete(t.id),this._notProvidedCustomExecutions.delete(t.id));let n=this._notProvidedCustomExecutions.values(),o=n.next();for(;!o.done;)!this._activeCustomExecutions2.has(o.value)&&this._lastStartedTask!==o.value&&(this._providedCustomExecutions2.delete(o.value),this._notProvidedCustomExecutions.delete(o.value)),o=n.next()}};Cu=_([C(0,se),C(1,Ye),C(2,On),C(3,Hr),C(4,Sn),C(5,wo),C(6,oe),C(7,Wi)],Cu);var Vg=class extends Cu{constructor(t,e,n,o,i,s,a,l){super(t,e,n,o,i,s,a,l),this.registerTaskSystem(V.vscodeRemote,{scheme:V.vscodeRemote,authority:"",platform:BP(0)})}async executeTask(t,e){if(!e.execution)throw new Error("Tasks to execute must include an execution");let n=Bs.from(e,t);if(n===void 0)throw new Error("Task is not valid");if(Vi.is(n.execution))await this.addCustomExecution(n,e,!1);else throw new zd;let o=await this.getTaskExecution(await this._proxy.$getTaskExecution(n),e);return this._proxy.$executeTask(n).catch(i=>{throw new Error(i)}),o}provideTasksInternal(t,e,n,o){let i=[];if(o)for(let s of o){if(this.checkDeprecation(s,n),!s.definition||!t[s.definition.type]){let l=s.source?s.source:"No task source";this._logService.warn(`The task [${l}, ${s.name}] uses an undefined task type. The task will be ignored in the future.`)}let a=Bs.from(s,n.extension);a&&Vi.is(a.execution)?(i.push(a),e.push(this.addCustomExecution(a,s,!0))):this._logService.warn("Only custom execution tasks supported.")}return{tasks:i,extension:n.extension}}async resolveTaskInternal(t){if(Vi.is(t.execution))return t;this._logService.warn("Only custom execution tasks supported.")}async $resolveVariables(t,e){return{process:void 0,variables:Object.create(null)}}async $jsonTasksSupported(){return!1}async $findExecutable(t,e,n){}};Vg=_([C(0,se),C(1,Ye),C(2,On),C(3,Hr),C(4,Sn),C(5,wo),C(6,oe),C(7,Wi)],Vg);var Bg=R("IExtHostTask");var $g=class{constructor(){this.pendingRequests=new Map;this.queue=[];this._onError=new E;this._onExit=new E;this.sequence=1}get onError(){return this._onError.event}get onExit(){return this._onExit.event}onMessage(t){this.messageCallback&&this._onError.fire(new Error("attempt to set more than one 'Message' callback")),this.messageCallback=t}onEvent(t){this.eventCallback&&this._onError.fire(new Error("attempt to set more than one 'Event' callback")),this.eventCallback=t}onRequest(t){this.requestCallback&&this._onError.fire(new Error("attempt to set more than one 'Request' callback")),this.requestCallback=t}sendResponse(t){t.seq>0?this._onError.fire(new Error(`attempt to send more than one response for command ${t.command}`)):this.internalSend("response",t)}sendRequest(t,e,n,o){let i={command:t};if(e&&Object.keys(e).length>0&&(i.arguments=e),this.internalSend("request",i),typeof o=="number"){let s=setTimeout(()=>{clearTimeout(s);let a=this.pendingRequests.get(i.seq);if(a){this.pendingRequests.delete(i.seq);let l={type:"response",seq:0,request_seq:i.seq,success:!1,command:t,message:p(9840,null,o,t)};a(l)}},o)}return n&&this.pendingRequests.set(i.seq,n),i.seq}acceptMessage(t){this.messageCallback?this.messageCallback(t):(this.queue.push(t),this.queue.length===1&&this.processQueue())}needsTaskBoundaryBetween(t,e){return t.type!=="event"||e.type!=="event"}async processQueue(){let t;for(;this.queue.length;){if((!t||this.needsTaskBoundaryBetween(this.queue[0],t))&&await Ut(0),t=this.queue.shift(),!t)return;switch(t.type){case"event":this.eventCallback?.(t);break;case"request":this.requestCallback?.(t);break;case"response":{let e=t,n=this.pendingRequests.get(e.request_seq);n&&(this.pendingRequests.delete(e.request_seq),n(e));break}}}}internalSend(t,e){e.type=t,e.seq=this.sequence++,this.sendMessage(e)}async cancelPendingRequests(){if(this.pendingRequests.size===0)return Promise.resolve();let t=new Map;this.pendingRequests.forEach((e,n)=>t.set(n,e)),await Ut(500),t.forEach((e,n)=>{e({type:"response",seq:0,request_seq:n,success:!1,command:"canceled",message:"canceled"}),this.pendingRequests.delete(n)})}getPendingRequestIds(){return Array.from(this.pendingRequests.keys())}dispose(){this._onError.dispose(),this._onExit.dispose(),this.queue=[]}};function DV(r){return r.type&&(r.label||r.program||r.runtime)}var gK=/^[a-zA-Z][a-zA-Z0-9\+\-\.]+:/;function fK(r){return!!(r&&r.match(gK))}function RV(r){if(typeof r.path=="string"&&!(typeof r.sourceReference=="number"&&r.sourceReference>0)){if(fK(r.path))return b.parse(r.path);if(En(r.path))return b.file(r.path)}return r.path}function AV(r){if(typeof r.path=="object"){let t=b.revive(r.path);if(t)return t.scheme===V.file?t.fsPath:t.toString()}return r.path}function MV(r,t){let e=t?RV:AV,n=at(r);return OV(n,(o,i)=>{o&&i&&(i.path=e(i))}),n}function LV(r,t){let e=t?RV:AV,n=at(r);return OV(n,(o,i)=>{!o&&i&&(i.path=e(i))}),n}function OV(r,t){switch(r.type){case"event":{let e=r;switch(e.event){case"output":t(!1,e.body.source);break;case"loadedSource":t(!1,e.body.source);break;case"breakpoint":t(!1,e.body.breakpoint.source);break;default:break}break}case"request":{let e=r;switch(e.command){case"setBreakpoints":t(!0,e.arguments.source);break;case"breakpointLocations":t(!0,e.arguments.source);break;case"source":t(!0,e.arguments.source);break;case"gotoTargets":t(!0,e.arguments.source);break;case"launchVSCode":e.arguments.args.forEach(n=>t(!1,n));break;default:break}break}case"response":{let e=r;if(e.success&&e.body)switch(e.command){case"stackTrace":e.body.stackFrames.forEach(n=>t(!1,n.source));break;case"loadedSources":e.body.sources.forEach(n=>t(!1,n));break;case"scopes":e.body.scopes.forEach(n=>t(!1,n.source));break;case"setFunctionBreakpoints":e.body.breakpoints.forEach(n=>t(!1,n.source));break;case"setBreakpoints":e.body.breakpoints.forEach(n=>t(!1,n.source));break;case"disassemble":e.body?.instructions.forEach(o=>t(!1,o.location));break;case"locations":t(!1,e.body?.source);break;default:break}break}}}var Bi=R("IExtHostEditorTabs"),aE=class{constructor(t,e,n){this._activeTabIdGetter=n,this._parentGroup=e,this.acceptDtoUpdate(t)}get apiObject(){if(!this._apiObject){let t=this,e={get isActive(){return t._dto.id===t._activeTabIdGetter()},get label(){return t._dto.label},get input(){return t._input},get isDirty(){return t._dto.isDirty},get isPinned(){return t._dto.isPinned},get isPreview(){return t._dto.isPreview},get group(){return t._parentGroup.apiObject}};this._apiObject=Object.freeze(e)}return this._apiObject}get tabId(){return this._dto.id}acceptDtoUpdate(t){this._dto=t,this._input=this._initInput()}_initInput(){switch(this._dto.input.kind){case 1:return new ed(b.revive(this._dto.input.uri));case 2:return new wa(b.revive(this._dto.input.original),b.revive(this._dto.input.modified));case 3:return new bm(b.revive(this._dto.input.base),b.revive(this._dto.input.input1),b.revive(this._dto.input.input2),b.revive(this._dto.input.result));case 6:return new td(b.revive(this._dto.input.uri),this._dto.input.viewType);case 7:return new ym(this._dto.input.viewType);case 4:return new nd(b.revive(this._dto.input.uri),this._dto.input.notebookType);case 5:return new od(b.revive(this._dto.input.original),b.revive(this._dto.input.modified),this._dto.input.notebookType);case 8:return new Im;case 9:return new xm(b.revive(this._dto.input.uri),b.revive(this._dto.input.inputBoxUri));case 10:return new Sm;case 11:return new Cm(this._dto.input.diffEditors.map(t=>new wa(b.revive(t.original),b.revive(t.modified))));default:return}}},W0=class{constructor(t,e){this._tabs=[];this._activeTabId="";this._dto=t,this._activeGroupIdGetter=e;for(let n of t.tabs)n.isActive&&(this._activeTabId=n.id),this._tabs.push(new aE(n,this,()=>this.activeTabId()))}get apiObject(){if(!this._apiObject){let t=this,e={get isActive(){return t._dto.groupId===t._activeGroupIdGetter()},get viewColumn(){return Vt.to(t._dto.viewColumn)},get activeTab(){return t._tabs.find(n=>n.tabId===t._activeTabId)?.apiObject},get tabs(){return Object.freeze(t._tabs.map(n=>n.apiObject))}};this._apiObject=Object.freeze(e)}return this._apiObject}get groupId(){return this._dto.groupId}get tabs(){return this._tabs}acceptGroupDtoUpdate(t){this._dto=t}acceptTabOperation(t){if(t.kind===0){let n=new aE(t.tabDto,this,()=>this.activeTabId());return this._tabs.splice(t.index,0,n),t.tabDto.isActive&&(this._activeTabId=n.tabId),n}else if(t.kind===1){let n=this._tabs.splice(t.index,1)[0];if(!n)throw new Error(`Tab close updated received for index ${t.index} which does not exist`);return n.tabId===this._activeTabId&&(this._activeTabId=""),n}else if(t.kind===3){if(t.oldIndex===void 0)throw new Error("Invalid old index on move IPC");let n=this._tabs.splice(t.oldIndex,1)[0];if(!n)throw new Error(`Tab move updated received for index ${t.oldIndex} which does not exist`);return this._tabs.splice(t.index,0,n),n}let e=this._tabs.find(n=>n.tabId===t.tabDto.id);if(!e)throw new Error("INVALID tab");return t.tabDto.isActive?this._activeTabId=t.tabDto.id:this._activeTabId===t.tabDto.id&&!t.tabDto.isActive&&(this._activeTabId=""),e.acceptDtoUpdate(t.tabDto),e}activeTabId(){return this._activeTabId}},zg=class{constructor(t){this._onDidChangeTabs=new E;this._onDidChangeTabGroups=new E;this._extHostTabGroups=[];this._proxy=t.getProxy(F.MainThreadEditorTabs)}get tabGroups(){if(!this._apiObject){let t=this,e={onDidChangeTabGroups:t._onDidChangeTabGroups.event,onDidChangeTabs:t._onDidChangeTabs.event,get all(){return Object.freeze(t._extHostTabGroups.map(n=>n.apiObject))},get activeTabGroup(){let n=t._activeGroupId;return pi(t._extHostTabGroups.find(i=>i.groupId===n)?.apiObject)},close:async(n,o)=>{let i=Array.isArray(n)?n:[n];return i.length?hK(i[0])?this._closeGroups(i,o):this._closeTabs(i,o):!0}};this._apiObject=Object.freeze(e)}return this._apiObject}$acceptEditorTabModel(t){let e=new Set(this._extHostTabGroups.map(d=>d.groupId)),n=new Set(t.map(d=>d.groupId)),o=kP(e,n),i=this._extHostTabGroups.filter(d=>o.removed.includes(d.groupId)).map(d=>d.apiObject),s=[],a=[];this._extHostTabGroups=t.map(d=>{let c=new W0(d,()=>this._activeGroupId);return o.added.includes(c.groupId)?s.push(c.apiObject):a.push(c.apiObject),c});let l=pi(t.find(d=>d.isActive===!0)?.groupId);l!==void 0&&this._activeGroupId!==l&&(this._activeGroupId=l),this._onDidChangeTabGroups.fire(Object.freeze({opened:s,closed:i,changed:a}))}$acceptTabGroupUpdate(t){let e=this._extHostTabGroups.find(n=>n.groupId===t.groupId);if(!e)throw new Error("Update Group IPC call received before group creation.");e.acceptGroupDtoUpdate(t),t.isActive&&(this._activeGroupId=t.groupId),this._onDidChangeTabGroups.fire(Object.freeze({changed:[e.apiObject],opened:[],closed:[]}))}$acceptTabOperation(t){let e=this._extHostTabGroups.find(o=>o.groupId===t.groupId);if(!e)throw new Error("Update Tabs IPC call received before group creation.");let n=e.acceptTabOperation(t);switch(t.kind){case 0:this._onDidChangeTabs.fire(Object.freeze({opened:[n.apiObject],closed:[],changed:[]}));return;case 1:this._onDidChangeTabs.fire(Object.freeze({opened:[],closed:[n.apiObject],changed:[]}));return;case 3:case 2:this._onDidChangeTabs.fire(Object.freeze({opened:[],closed:[],changed:[n.apiObject]}));return}}_findExtHostTabFromApi(t){for(let e of this._extHostTabGroups)for(let n of e.tabs)if(n.apiObject===t)return n}_findExtHostTabGroupFromApi(t){return this._extHostTabGroups.find(e=>e.apiObject===t)}async _closeTabs(t,e){let n=[];for(let o of t){let i=this._findExtHostTabFromApi(o);if(!i)throw new Error("Tab close: Invalid tab not found!");n.push(i.tabId)}return this._proxy.$closeTab(n,e)}async _closeGroups(t,e){let n=[];for(let o of t){let i=this._findExtHostTabGroupFromApi(o);if(!i)throw new Error("Group close: Invalid group not found!");n.push(i.groupId)}return this._proxy.$closeGroup(n,e)}};zg=_([C(0,se)],zg);function hK(r){return r.tabs!==void 0}var f4e={6:p(16052,null),4:p(16053,null),3:p(16054,null),1:p(16055,null),2:p(16056,null),5:p(16057,null),0:p(16058,null)};var h4e={4:p(16049,null),2:p(16050,null),8:p(16048,null)};var bK=0,NV=new WeakMap,za=R("IExtHostTesting"),qg=class extends O{constructor(e,n,o,i){super();this.logService=n;this.commands=o;this.editors=i;this.resultsChangedEmitter=this._register(new E);this.controllers=new Map;this.defaultProfilesChangedEmitter=this._register(new E);this.followupProviders=new Set;this.testFollowups=new Map;this.onResultsChanged=this.resultsChangedEmitter.event;this.results=[];this.proxy=e.getProxy(F.MainThreadTesting),this.observer=new q0(this.proxy),this.runTracker=new B0(this.proxy,n),o.registerArgumentProcessor({processArgument:s=>{switch(s?.$mid){case 16:{let a=s,l=a.tests[a.tests.length-1].item.extId;return this.controllers.get(Ze.root(l))?.collection.tree.get(l)?.actual??KM(s)}case 18:{let{test:a,message:l}=s,d=a.item.extId;return{test:this.controllers.get(Ze.root(d))?.collection.tree.get(d)?.actual??KM({$mid:16,tests:[a]}),message:qm.to(l)}}default:return s}}}),o.registerCommand(!1,"testing.getExplorerSelection",async()=>{let s=await o.executeCommand("_testing.getExplorerSelection"),a=l=>{let d=this.controllers.get(Ze.root(l));if(d)return Ze.isRoot(l)?d.controller:d.collection.tree.get(l)?.actual};return{include:s?.include.map(a).filter(vo)||[],exclude:s?.exclude.map(a).filter(vo)||[]}})}createTestController(e,n,o,i){if(this.controllers.has(n))throw new Error(`Attempt to insert a duplicate controller with ID "${n}"`);let s=new $,a=s.add(new VT(n,o,this.editors));a.root.label=o;let l=new Map,d=new Set,c=this.proxy,u=()=>{let h=0;i&&(h|=2);let f=g.relatedCodeProvider;return f&&(f?.provideRelatedTests&&(h|=8),f?.provideRelatedCode&&(h|=4)),h},m={items:a.root.children,get label(){return o},set label(h){o=h,a.root.label=h,c.$updateController(n,{label:o})},get refreshHandler(){return i},set refreshHandler(h){i=h,c.$updateController(n,{capabilities:u()})},get id(){return n},get relatedCodeProvider(){return g.relatedCodeProvider},set relatedCodeProvider(h){A(e,"testRelatedCode"),g.relatedCodeProvider=h,c.$updateController(n,{capabilities:u()})},createRunProfile:(h,f,I,S,T,P)=>{let L=Gn(h);for(;l.has(L);)L++;return new dE(this.proxy,l,d,this.defaultProfilesChangedEmitter.event,n,L,h,f,I,S,T,P)},createTestItem(h,f,I){return new $a(n,h,f,I)},createTestRun:(h,f,I=!0)=>this.runTracker.createTestRun(e,n,a,h,f,I),invalidateTestResults:h=>{if(h===void 0)this.proxy.$markTestRetired(void 0);else{let f=h instanceof Array?h:[h];this.proxy.$markTestRetired(f.map(I=>Ze.fromExtHostTestItem(I,n).toString()))}},set resolveHandler(h){a.resolveHandler=h},get resolveHandler(){return a.resolveHandler},dispose:()=>{s.dispose()}},g={controller:m,collection:a,profiles:l,extension:e,activeProfiles:d};return c.$registerTestController(n,o,u()),s.add(K(()=>c.$unregisterTestController(n))),this.controllers.set(n,g),s.add(K(()=>this.controllers.delete(n))),s.add(a.onDidGenerateDiff(h=>c.$publishDiff(n,h.map(hS.serialize)))),m}createTestObserver(){return this.observer.checkout()}async runTests(e,n=ve.None){let o=UV(e);if(!o)throw new Error("The request passed to `vscode.test.runTests` must include a profile");let i=this.controllers.get(o.controllerId);if(!i)throw new Error("Controller not found");await this.proxy.$runTests({preserveFocus:e.preserveFocus??!0,group:Km.from(o.kind),targets:[{testIds:e.include?.map(s=>Ze.fromExtHostTestItem(s,i.collection.root.id).toString())??[i.collection.root.id],profileId:o.profileId,controllerId:o.controllerId}],exclude:e.exclude?.map(s=>s.id)},n)}registerTestFollowupProvider(e){return this.followupProviders.add(e),{dispose:()=>{this.followupProviders.delete(e)}}}async $getTestsRelatedToCode(e,n,o){let i=this.editors.getDocument(b.revive(e));if(!i)return[];let s=ct.to(n),a=[];return await Promise.all([...this.controllers.values()].map(async l=>{let d;try{d=await l.relatedCodeProvider?.provideRelatedTests?.(i.document,s,o)}catch(c){o.isCancellationRequested||this.logService.warn(`Error thrown while providing related tests for ${l.controller.label}`,c)}if(d){for(let c of d)a.push(Ze.fromExtHostTestItem(c,l.controller.id).toString());l.collection.flushDiff()}})),a}async $getCodeRelatedToTest(e,n){let o=this.controllers.get(Ze.root(e));if(!o)return[];let i=o.collection.tree.get(e);return i?(await o.relatedCodeProvider?.provideRelatedCode?.(i.actual,n))?.map(po.from)??[]:[]}$syncTests(){for(let{collection:e}of this.controllers.values())e.flushDiff();return Promise.resolve()}async $getCoverageDetails(e,n,o){return(await this.runTracker.getCoverageDetails(e,n,o))?.map(sb.fromDetails)}async $disposeRun(e){this.runTracker.disposeTestRun(e)}$configureRunProfile(e,n){this.controllers.get(e)?.profiles.get(n)?.configureHandler?.()}$setDefaultRunProfiles(e){let n=new Map;for(let[o,i]of Object.entries(e)){let s=this.controllers.get(o);if(!s)continue;let a=new Map,l=i.filter(c=>!s.activeProfiles.has(c)),d=[...s.activeProfiles].filter(c=>!i.includes(c));for(let c of l)a.set(c,!0),s.activeProfiles.add(c);for(let c of d)a.set(c,!1),s.activeProfiles.delete(c);a.size&&n.set(o,a)}this.defaultProfilesChangedEmitter.fire(n)}async $refreshTests(e,n){await this.controllers.get(e)?.controller.refreshHandler?.(n)}$publishTestResults(e){this.results=Object.freeze(e.map(n=>{let o=pM.to(n),i=n.tasks.findIndex(s=>s.hasCoverage);return i!==-1&&(o.getDetailedCoverage=(s,a=ve.None)=>this.proxy.$getCoverageDetails(n.id,i,s,a).then(l=>l.map(sb.to))),NV.set(o,n.id),o}).concat(this.results).sort((n,o)=>o.completedAt-n.completedAt).slice(0,32)),this.resultsChangedEmitter.fire()}async $expandTest(e,n){let o=this.controllers.get(Ze.fromString(e).controllerId)?.collection;o&&(await o.expand(e,n<0?1/0:n),o.flushDiff())}$acceptDiff(e){this.observer.applyDiff(e.map(n=>hS.deserialize({asCanonicalUri:o=>o},n)))}async $runControllerTests(e,n){return Promise.all(e.map(o=>this.runControllerTestRequest(o,!1,n)))}async $startContinuousRun(e,n){let o=new Ce(n),i=await Promise.all(e.map(s=>this.runControllerTestRequest(s,!0,o.token)));return!n.isCancellationRequested&&!i.some(s=>s.error)&&await new Promise(s=>n.onCancellationRequested(s)),o.dispose(!0),i}async $provideTestFollowups(e,n){let o=this.results.find(a=>NV.get(a)===e.resultId),i=o&&IK(Ze.fromString(e.extId),o?.results);if(!i)return[];let s=[];return await Promise.all([...this.followupProviders].map(async a=>{try{let l=await a.provideFollowup(o,i,e.taskIndex,e.messageIndex,n);l&&(s=s.concat(l))}catch(l){this.logService.error("Error thrown while providing followup for test message",l)}})),n.isCancellationRequested?[]:s.map(a=>{let l=bK++;return this.testFollowups.set(l,a),{title:a.title,id:l}})}$disposeTestFollowups(e){for(let n of e)this.testFollowups.delete(n)}$executeTestFollowup(e){let n=this.testFollowups.get(e);return n?this.commands.executeCommand(n.command,...n.arguments||[]):Promise.resolve()}$cancelExtensionTestRun(e,n){e===void 0?this.runTracker.cancelAllRuns():this.runTracker.cancelRunById(e,n)}getMetadataForRun(e){for(let n of this.runTracker.trackers){let o=n.getTaskIdForRun(e);if(o)return{taskId:o,runId:n.id}}}async runControllerTestRequest(e,n,o){let i=this.controllers.get(e.controllerId);if(!i)return{};let{collection:s,profiles:a,extension:l}=i,d=a.get(e.profileId);if(!d)return{};let c=e.testIds.map(h=>s.tree.get(h)).filter(vo),u=e.excludeExtIds.map(h=>i.collection.tree.get(h)).filter(vo).filter(h=>c.some(f=>f.fullId.compare(h.fullId)===2));if(!c.length)return{};let m=new Gl(c.some(h=>h.actual instanceof vg)?void 0:c.map(h=>h.actual),u.map(h=>h.actual),d,n),g=QW(e)&&this.runTracker.prepareForMainThreadTestRun(l,m,lE.fromInternal(e,i.collection),d,o);try{return await d.runHandler(m,o),{}}catch(h){return{error:String(h)}}finally{g&&g.hasRunningTasks&&!o.isCancellationRequested&&await he.toPromise(g.onEnd)}}};qg=_([C(0,se),C(1,oe),C(2,Nn),C(3,Hr)],qg);var yK=1e4;var V0=class extends O{constructor(e,n,o,i,s,a){super();this.dto=e;this.proxy=n;this.logService=o;this.profile=i;this.extension=s;this.state=0;this.running=0;this.tasks=new Map;this.sharedTestIds=new Set;this.endEmitter=this._register(new E);this.publishedCoverage=new Map;this.onEnd=this.endEmitter.event;this.cts=this._register(new Ce(a));let l=this._register(new jn(()=>this.forciblyEndTasks(),yK));this._register(this.cts.token.onCancellationRequested(()=>l.schedule()));let d=new E;this.onDidDispose=d.event,this._register(K(()=>{d.fire(),d.dispose()}))}get hasRunningTasks(){return this.running>0}get id(){return this.dto.id}getTaskIdForRun(e){for(let[n,{run:o}]of this.tasks)if(o===e)return n}cancel(e){e?this.tasks.get(e)?.cts.cancel():this.state===0?(this.cts.cancel(),this.state=1):this.state===1&&this.forciblyEndTasks()}async getCoverageDetails(e,n,o){let[,i]=Ze.fromString(e).path,s=this.publishedCoverage.get(e);if(!s)return[];let{report:a,extIds:l}=s,d=this.tasks.get(i);if(!d)throw new Error("unreachable: run task was not found");let c;if(n&&a instanceof Ea){let m=l.indexOf(n);if(m===-1)return[];c=a.includesTests[m]}return await(c?this.profile?.loadDetailedCoverageForTest?.(d.run,a,c,o):this.profile?.loadDetailedCoverage?.(d.run,a,o))??[]}createRun(e){let n=this.dto.id,o=this.dto.controllerId,i=Ae(),s=u=>(m,...g)=>{if(l){this.logService.warn(`Setting the state of test "${m.id}" is a no-op after the run ends.`);return}this.ensureTestIsKnown(m),u(m,...g)},a=(u,m)=>{let g=m instanceof Array?m.map(qm.from):[qm.from(m)];if(u.uri&&u.range){let h={range:j.from(u.range),uri:u.uri};for(let f of g)f.location=f.location||h}this.proxy.$appendTestMessagesInRun(n,i,Ze.fromExtHostTestItem(u,o).toString(),g)},l=!1,d=this._register(new Ce(this.cts.token)),c={isPersisted:this.dto.isPersisted,token:d.token,name:e,onDidDispose:this.onDidDispose,addCoverage:u=>{if(l)return;let m=u instanceof Ea?u.includesTests:[];if(m.length)for(let f of m)this.ensureTestIsKnown(f);let g=u.uri.toString(),h=new Ze([n,i,g]).toString();this.publishedCoverage.set(h,{report:u,extIds:m.map(f=>Ze.fromExtHostTestItem(f,o).toString())}),this.proxy.$appendCoverage(n,i,sb.fromFile(o,h,u))},enqueued:s(u=>{this.proxy.$updateTestStateInRun(n,i,Ze.fromExtHostTestItem(u,o).toString(),1)}),skipped:s(u=>{this.proxy.$updateTestStateInRun(n,i,Ze.fromExtHostTestItem(u,o).toString(),5)}),started:s(u=>{this.proxy.$updateTestStateInRun(n,i,Ze.fromExtHostTestItem(u,o).toString(),2)}),errored:s((u,m,g)=>{a(u,m),this.proxy.$updateTestStateInRun(n,i,Ze.fromExtHostTestItem(u,o).toString(),6,g)}),failed:s((u,m,g)=>{a(u,m),this.proxy.$updateTestStateInRun(n,i,Ze.fromExtHostTestItem(u,o).toString(),4,g)}),passed:s((u,m)=>{this.proxy.$updateTestStateInRun(n,i,Ze.fromExtHostTestItem(u,this.dto.controllerId).toString(),3,m)}),appendOutput:(u,m,g)=>{l||(g&&this.ensureTestIsKnown(g),this.proxy.$appendOutputToRun(n,i,H.fromString(u),m&&po.from(m),g&&Ze.fromExtHostTestItem(g,o).toString()))},end:()=>{l||(l=!0,this.proxy.$finishedTestRunTask(n,i),--this.running||this.markEnded())}};return this.running++,this.tasks.set(i,{run:c,cts:d}),this.proxy.$startedTestRunTask(n,{id:i,ctrlId:this.dto.controllerId,name:e||this.extension.displayName||this.extension.identifier.value,running:!0}),c}forciblyEndTasks(){for(let{run:e}of this.tasks.values())e.end()}markEnded(){this.state!==2&&(this.state=2,this.endEmitter.fire())}ensureTestIsKnown(e){if(!(e instanceof $a))throw new Ml(e.id);if(this.sharedTestIds.has(Ze.fromExtHostTestItem(e,this.dto.controllerId).toString()))return;let n=[],o=this.dto.colllection.root;for(;;){let i=Ns.from(e);if(n.unshift(i),this.sharedTestIds.has(i.extId)||(this.sharedTestIds.add(i.extId),e===o))break;e=e.parent||o}this.proxy.$addTestsToRun(this.dto.controllerId,this.dto.id,n)}dispose(){this.markEnded(),super.dispose()}},B0=class{constructor(t,e){this.proxy=t;this.logService=e;this.tracked=new Map;this.trackedById=new Map}get trackers(){return this.tracked.values()}getCoverageDetails(t,e,n){let o=Ze.root(t);return this.trackedById.get(o)?.getCoverageDetails(t,e,n)||[]}disposeTestRun(t){this.trackedById.get(t)?.dispose(),this.trackedById.delete(t);for(let[e,{id:n}]of this.tracked)n===t&&this.tracked.delete(e)}prepareForMainThreadTestRun(t,e,n,o,i){return this.getTracker(e,n,o,t,i)}cancelRunById(t,e){this.trackedById.get(t)?.cancel(e)}cancelAllRuns(){for(let t of this.tracked.values())t.cancel()}createTestRun(t,e,n,o,i,s){let a=this.tracked.get(o);if(a)return a.createRun(i);let l=lE.fromPublic(e,n,o,s),d=UV(o);this.proxy.$startedExtensionTestRun({controllerId:e,continuous:!!o.continuous,profile:d&&{group:Km.from(d.kind),id:d.profileId},exclude:o.exclude?.map(u=>Ze.fromExtHostTestItem(u,n.root.id).toString())??[],id:l.id,include:o.include?.map(u=>Ze.fromExtHostTestItem(u,n.root.id).toString())??[n.root.id],preserveFocus:o.preserveFocus??!0,persist:s});let c=this.getTracker(o,l,o.profile,t);return he.once(c.onEnd)(()=>{this.proxy.$finishedExtensionTestRun(l.id)}),c.createRun(i)}getTracker(t,e,n,o,i){let s=new V0(e,this.proxy,this.logService,n,o,i);return this.tracked.set(t,s),this.trackedById.set(s.id,s),s}},UV=r=>{if(r.profile){if(!(r.profile instanceof dE))throw new Error("TestRunRequest.profile is not an instance created from TestController.createRunProfile");return r.profile}},lE=class r{constructor(t,e,n,o){this.controllerId=t;this.id=e;this.isPersisted=n;this.colllection=o}static fromPublic(t,e,n,o){return new r(t,Ae(),o,e)}static fromInternal(t,e){return new r(t.controllerId,t.runId,!0,e)}},$0=class{constructor(t){this.emitter=t;this.added=new Set;this.updated=new Set;this.removed=new Set;this.alreadyRemoved=new Set}get isEmpty(){return this.added.size===0&&this.removed.size===0&&this.updated.size===0}add(t){this.added.add(t)}update(t){Object.assign(t.revived,Ns.toPlain(t.item)),this.added.has(t)||this.updated.add(t)}remove(t){if(this.added.delete(t))return;this.updated.delete(t);let e=Ze.parentId(t.item.extId);if(e&&this.alreadyRemoved.has(e.toString())){this.alreadyRemoved.add(t.item.extId);return}this.removed.add(t)}getChangeEvent(){let{added:t,updated:e,removed:n}=this;return{get added(){return[...t].map(o=>o.revived)},get updated(){return[...e].map(o=>o.revived)},get removed(){return[...n].map(o=>o.revived)}}}complete(){this.isEmpty||this.emitter.fire(this.getChangeEvent())}},z0=class extends mS{constructor(){super(...arguments);this.changeEmitter=new E;this.onDidChangeTests=this.changeEmitter.event}get rootTests(){return this.roots}getMirroredTestDataById(e){return this.items.get(e)}getMirroredTestDataByReference(e){return this.items.get(e.id)}createItem(e,n){return{...e,revived:Ns.toPlain(e.item),depth:n?n.depth+1:0,children:new Set}}createChangeCollector(){return new $0(this.changeEmitter)}},q0=class{constructor(t){this.proxy=t}checkout(){this.current||(this.current=this.createObserverData());let t=this.current;return t.observers++,{onDidChangeTest:t.tests.onDidChangeTests,get tests(){return[...t.tests.rootTests].map(e=>e.revived)},dispose:el(()=>{--t.observers===0&&(this.proxy.$unsubscribeFromDiffs(),this.current=void 0)})}}getMirroredTestDataByReference(t){return this.current?.tests.getMirroredTestDataByReference(t)}applyDiff(t){this.current?.tests.apply(t)}createObserverData(){let t=new z0({asCanonicalUri:e=>e});return this.proxy.$subscribeToDiffs(),{observers:0,tests:t}}},Ab=(r,t,e,n)=>{e?Object.assign(e,n):t.$updateTestRunConfig(r.controllerId,r.profileId,n)},dE=class extends gm{constructor(e,n,o,i,s,a,l,d,c,u=!1,m=void 0,g=!1){super(s,a,d);this._label=l;this.runHandler=c;this._tag=m;this._supportsContinuousRun=g;this.#e=e,this.#s=n,this.#t=o,this.#n=i,n.set(a,this);let h=Km.from(d);u&&o.add(a),this.#o={profileId:a,controllerId:s,tag:m?ii.namespace(this.controllerId,m.id):null,label:l,group:h,isDefault:u,hasConfigurationHandler:!1,supportsContinuousRun:g},queueMicrotask(()=>{this.#o&&(this.#e.$publishTestRunProfile(this.#o),this.#o=void 0)})}#e;#t;#n;#o;#s;get label(){return this._label}set label(e){e!==this._label&&(this._label=e,Ab(this,this.#e,this.#o,{label:e}))}get supportsContinuousRun(){return this._supportsContinuousRun}set supportsContinuousRun(e){e!==this._supportsContinuousRun&&(this._supportsContinuousRun=e,Ab(this,this.#e,this.#o,{supportsContinuousRun:e}))}get isDefault(){return this.#t.has(this.profileId)}set isDefault(e){e!==this.isDefault&&(e?this.#t.add(this.profileId):this.#t.delete(this.profileId),Ab(this,this.#e,this.#o,{isDefault:e}))}get tag(){return this._tag}set tag(e){e?.id!==this._tag?.id&&(this._tag=e,Ab(this,this.#e,this.#o,{tag:e?ii.namespace(this.controllerId,e.id):null}))}get configureHandler(){return this._configureHandler}set configureHandler(e){e!==this._configureHandler&&(this._configureHandler=e,Ab(this,this.#e,this.#o,{hasConfigurationHandler:!!e}))}get onDidChangeDefault(){return he.chain(this.#n,e=>e.map(n=>n.get(this.controllerId)?.get(this.profileId)).filter(vo))}dispose(){this.#s?.delete(this.profileId)&&(this.#s=void 0,this.#e.$removeTestProfile(this.controllerId,this.profileId)),this.#o=void 0}};function IK(r,t){for(let e=0;e<r.path.length;e++){let n=t.find(o=>o.id===r.path[e]);if(!n)return;if(e===r.path.length-1)return n;t=n.children}}var fVe=R("configurationResolverService"),K0=(Pe=>(Pe.Unknown="unknown",Pe.Env="env",Pe.Config="config",Pe.Command="command",Pe.Input="input",Pe.ExtensionInstallFolder="extensionInstallFolder",Pe.TaskVar="taskVar",Pe.WorkspaceFolder="workspaceFolder",Pe.Cwd="cwd",Pe.WorkspaceFolderBasename="workspaceFolderBasename",Pe.UserHome="userHome",Pe.LineNumber="lineNumber",Pe.ColumnNumber="columnNumber",Pe.SelectedText="selectedText",Pe.File="file",Pe.FileWorkspaceFolder="fileWorkspaceFolder",Pe.FileWorkspaceFolderBasename="fileWorkspaceFolderBasename",Pe.RelativeFile="relativeFile",Pe.RelativeFileDirname="relativeFileDirname",Pe.FileDirname="fileDirname",Pe.FileExtname="fileExtname",Pe.FileBasename="fileBasename",Pe.FileBasenameNoExtension="fileBasenameNoExtension",Pe.FileDirnameBasename="fileDirnameBasename",Pe.ExecPath="execPath",Pe.ExecInstallFolder="execInstallFolder",Pe.PathSeparator="pathSeparator",Pe.PathSeparatorAlias="/",Pe))(K0||{}),FV=Object.values(K0).filter(r=>typeof r=="string"),fo=class extends ho{constructor(e,n){super(n);this.variable=e}};var Mb=class r{constructor(t){this.locations=new Map;this.newReplacementNotifiers=new Set;typeof t=="string"?(this.stringRoot=!0,this.root={value:t}):(this.stringRoot=!1,this.root=structuredClone(t))}static{this.VARIABLE_LHS="${"}static parse(t){if(t instanceof r)return t;let e=new r(t);return e.applyPlatformSpecificKeys(),e.parseObject(e.root),e}applyPlatformSpecificKeys(){let t=this.root,e=Ie?"windows":pt?"osx":Qe?"linux":void 0;e&&t&&typeof t=="object"&&t.hasOwnProperty(e)&&Object.keys(t[e]).forEach(n=>t[n]=t[e][n]),delete t.windows,delete t.osx,delete t.linux}parseVariable(t,e){if(t[e]!=="$"||t[e+1]!=="{")return;let n=e+2,o=1;for(;n<t.length;){if(t[n]==="{")o++;else if(t[n]==="}"&&(o--,o===0))break;n++}if(o!==0)return;let i=t.slice(e,n+1),s=t.substring(e+2,n),a=s.indexOf(":");return a===-1?{replacement:{id:i,name:s,inner:s},end:n}:{replacement:{id:i,inner:s,name:s.slice(0,a),arg:s.slice(a+1)},end:n}}parseObject(t){if(!(typeof t!="object"||t===null)){if(Array.isArray(t)){for(let e=0;e<t.length;e++){let n=t[e];typeof n=="string"?this.parseString(t,e,n):this.parseObject(n)}return}for(let[e,n]of Object.entries(t))this.parseString(t,e,e,!0),typeof n=="string"?this.parseString(t,e,n):this.parseObject(n)}}parseString(t,e,n,o,i){let s=0;for(;s<n.length;){let a=n.indexOf("${",s);if(a===-1)break;let l=this.parseVariable(n,a);if(l){if(s=l.end+1,i?.includes(l.replacement.id))continue;let d=this.locations.get(l.replacement.id)||{locations:[],replacement:l.replacement},c={object:t,propertyName:e,replaceKeyName:o};d.locations.push(c),this.locations.set(l.replacement.id,d),d.resolved?this._resolveAtLocation(l.replacement,c,d.resolved,i):this.newReplacementNotifiers.forEach(u=>u(l.replacement))}else s=a+2}}*unresolved(){let t=new Map,e=n=>{t.set(n.id,n)};for(let n of this.locations.values())n.resolved===void 0&&t.set(n.replacement.id,n.replacement);for(this.newReplacementNotifiers.add(e);;){let n=Nt.first(t);if(!n)break;let[o,i]=n;yield i,t.delete(o)}this.newReplacementNotifiers.delete(e)}resolved(){return Nt.map(Nt.filter(this.locations.values(),t=>!!t.resolved),t=>[t.replacement,t.resolved])}resolve(t,e){typeof e!="object"&&(e={value:String(e)});let n=this.locations.get(t.id);if(n&&(n.resolved=e,e.value!==void 0))for(let o of n.locations||Nt.empty())this._resolveAtLocation(t,o,e)}_resolveAtLocation(t,{replaceKeyName:e,propertyName:n,object:o},i,s=[]){if(i.value!==void 0){if(s.push(t.id),e&&typeof n=="string"){let a=o[n],l=n.replaceAll(t.id,i.value);delete o[n],o[l]=a,this._renameKeyInLocations(o,n,l),this.parseString(o,l,i.value,!0,s)}else o[n]=o[n].replaceAll(t.id,i.value),this.parseString(o,n,i.value,!1,s);s.pop()}}_renameKeyInLocations(t,e,n){for(let o of this.locations.values())for(let i of o.locations)i.object===t&&i.propertyName===e&&(i.propertyName=n)}toObject(){return this.stringRoot?this.root.value:this.root}};var cE=class{constructor(t,e,n,o){this._contributedVariables=new Map;this.resolvableVariables=new Set(FV);this._context=t,this._labelService=e,this._userHomePromise=n,o&&(this._envVariablesPromise=o.then(i=>this.prepareEnv(i)))}prepareEnv(t){if(Ie){let e=Object.create(null);return Object.keys(t).forEach(n=>{e[n.toLowerCase()]=t[n]}),e}return t}async resolveWithEnvironment(t,e,n){let o=Mb.parse(n);for(let i of o.unresolved()){let s=await this.evaluateSingleVariable(i,e?.uri,t);s!==void 0&&o.resolve(i,String(s))}return o.toObject()}async resolveAsync(t,e){let n=Mb.parse(e);for(let o of n.unresolved()){let i=await this.evaluateSingleVariable(o,t?.uri);i!==void 0&&n.resolve(o,String(i))}return n.toObject()}resolveWithInteractionReplace(t,e){throw new Error("resolveWithInteractionReplace not implemented.")}resolveWithInteraction(t,e){throw new Error("resolveWithInteraction not implemented.")}contributeVariable(t,e){if(this._contributedVariables.has(t))throw new Error("Variable "+t+" is contributed twice.");this.resolvableVariables.add(t),this._contributedVariables.set(t,e)}fsPath(t){return this._labelService?this._labelService.getUriLabel(t,{noPrefix:!0}):t.fsPath}async evaluateSingleVariable(t,e,n,o){let i={env:n!==void 0?this.prepareEnv(n):await this._envVariablesPromise,userHome:n!==void 0?void 0:await this._userHomePromise},{name:s,arg:a}=t,l=u=>{let m=this._context.getFilePath();if(m)return Mp(m);throw new fo(u,p(17486,null,t.id))},d=u=>{let m=l(u);if(this._context.getWorkspaceFolderPathForFile){let g=this._context.getWorkspaceFolderPathForFile();if(g)return Mp(g)}throw new fo(u,p(17487,null,t.id,nt(m)))},c=u=>{if(a){let m=this._context.getFolderUri(a);if(m)return m;throw new fo(u,p(17484,null,u,a))}if(e)return e;throw this._context.getWorkspaceFolderCount()>1?new fo(u,p(17492,null,u)):new fo(u,p(17491,null,u))};switch(s){case"env":if(a){if(i.env){let u=i.env[Ie?a.toLowerCase():a];if(De(u))return u}return""}throw new fo("env",p(17497,null,t.id));case"config":if(a){let u=this._context.getConfigurationValue(e,a);if(Ot(u))throw new fo("config",p(17494,null,t.id,a));if(it(u))throw new fo("config",p(17493,null,t.id,a));return u}throw new fo("config",p(17496,null,t.id));case"command":return this.resolveFromMap("command",t.id,a,o,"command");case"input":return this.resolveFromMap("input",t.id,a,o,"input");case"extensionInstallFolder":if(a){let u=await this._context.getExtension(a);if(!u)throw new fo("extensionInstallFolder",p(17495,null,t.id,a));return this.fsPath(u.extensionLocation)}throw new fo("extensionInstallFolder",p(17498,null,t.id));default:switch(s){case"workspaceRoot":case"workspaceFolder":{let u=c("workspaceFolder");return u?Mp(this.fsPath(u)):void 0}case"cwd":{if(!e&&!a)return mi();let u=c("cwd");return u?Mp(this.fsPath(u)):void 0}case"workspaceRootFolderName":case"workspaceFolderBasename":{let u=c("workspaceFolderBasename");return u?Mp(nt(this.fsPath(u))):void 0}case"userHome":if(i.userHome)return i.userHome;throw new fo("userHome",p(17490,null,t.id));case"lineNumber":{let u=this._context.getLineNumber();if(u)return u;throw new fo("lineNumber",p(17488,null,t.id))}case"columnNumber":{let u=this._context.getColumnNumber();if(u)return u;throw new Error(p(17485,null,t.id))}case"selectedText":{let u=this._context.getSelectedText();if(u)return u;throw new fo("selectedText",p(17489,null,t.id))}case"file":return l("file");case"fileWorkspaceFolder":return d("fileWorkspaceFolder");case"fileWorkspaceFolderBasename":return nt(d("fileWorkspaceFolderBasename"));case"relativeFile":return e||a?gi(this.fsPath(c("relativeFile")),l("relativeFile")):l("relativeFile");case"relativeFileDirname":{let u=cn(l("relativeFileDirname"));if(e||a){let m=gi(this.fsPath(c("relativeFileDirname")),u);return m.length===0?".":m}return u}case"fileDirname":return cn(l("fileDirname"));case"fileExtname":return al(l("fileExtname"));case"fileBasename":return nt(l("fileBasename"));case"fileBasenameNoExtension":{let u=nt(l("fileBasenameNoExtension"));return u.slice(0,u.length-al(u).length)}case"fileDirnameBasename":return nt(cn(l("fileDirnameBasename")));case"execPath":{let u=this._context.getExecPath();return u||t.id}case"execInstallFolder":{let u=this._context.getAppRoot();return u||t.id}case"pathSeparator":case"/":return xt;default:try{return this.resolveFromMap("unknown",t.id,a,o,void 0)}catch{return t.id}}}}resolveFromMap(t,e,n,o,i){if(n&&o){let s=i===void 0?o[n]:o[i+":"+n];if(typeof s=="string")return s;throw new fo(t,p(17499,null,e))}return e}};var Wr=R("IExtHostVariableResolverProvider"),j0=class extends cE{constructor(t,e,n,o,i,s,a){function l(){if(n){let d=n.activeEditor();if(d)return d.document.uri;let c=o.tabGroups.all.find(u=>u.isActive)?.activeTab;if(c!==void 0){if(c.input instanceof wa||c.input instanceof od)return c.input.modified;if(c.input instanceof ed||c.input instanceof nd||c.input instanceof td)return c.input.uri}}}super({getFolderUri:d=>{let c=s.folders.filter(u=>u.name===d);if(c&&c.length>0)return c[0].uri},getWorkspaceFolderCount:()=>s.folders.length,getConfigurationValue:(d,c)=>i.getConfiguration(void 0,d).get(c),getAppRoot:()=>mi(),getExecPath:()=>Do.VSCODE_EXEC_PATH,getFilePath:()=>{let d=l();if(d)return bo(d.fsPath)},getWorkspaceFolderPathForFile:()=>{if(e){let d=l();if(d){let c=e.getWorkspaceFolder(d);if(c)return bo(c.uri.fsPath)}}},getSelectedText:()=>{if(n){let d=n.activeEditor();if(d&&!d.selection.isEmpty)return d.document.getText(d.selection)}},getLineNumber:()=>{if(n){let d=n.activeEditor();if(d)return String(d.selection.end.line+1)}},getColumnNumber:()=>{if(n){let d=n.activeEditor();if(d)return String(d.selection.end.character+1)}},getExtension:d=>t.getExtension(d)},void 0,a?Promise.resolve(a):void 0,Promise.resolve(Do))}},kd=class extends O{constructor(e,n,o,i,s){super();this.extensionService=e;this.workspaceService=n;this.editorService=o;this.configurationService=i;this.editorTabs=s;this._resolver=new mt(async()=>{let e=await this.configurationService.getConfigProvider(),o={folders:await this.workspaceService.getWorkspaceFolders2()||[]};return this._register(this.workspaceService.onDidChangeWorkspace(async i=>{o.folders=await this.workspaceService.getWorkspaceFolders2()||[]})),new j0(this.extensionService,this.workspaceService,this.editorService,this.editorTabs,e,o,this.homeDir())})}getResolver(){return this._resolver.value}homeDir(){}};kd=_([C(0,go),C(1,On),C(2,Hr),C(3,Sn),C(4,Bi)],kd);var jg=R("IExtHostDebugService"),Tu=class extends O{constructor(e,n,o,i,s,a,l,d){super();this._workspaceService=n;this._extensionService=o;this._configurationService=i;this._editorTabs=s;this._variableResolver=a;this._commands=l;this._testing=d;this._debugSessions=new Map;this._debugVisualizationTreeItemIdsCounter=0;this._debugVisualizationProviders=new Map;this._debugVisualizationTrees=new Map;this._debugVisualizationTreeItemIds=new WeakMap;this._debugVisualizationElements=new Map;this._visualizers=new Map;this._visualizerIdCounter=0;this._configProviderHandleCounter=0,this._configProviders=[],this._adapterFactoryHandleCounter=0,this._adapterFactories=[],this._trackerFactoryHandleCounter=0,this._trackerFactories=[],this._debugAdapters=new Map,this._debugAdaptersTrackers=new Map,this._onDidStartDebugSession=this._register(new E),this._onDidTerminateDebugSession=this._register(new E),this._onDidChangeActiveDebugSession=this._register(new E),this._onDidReceiveDebugSessionCustomEvent=this._register(new E),this._debugServiceProxy=e.getProxy(F.MainThreadDebugService),this._onDidChangeBreakpoints=this._register(new E),this._onDidChangeActiveStackItem=this._register(new E),this._activeDebugConsole=new Q0(this._debugServiceProxy),this._breakpoints=new Map,this._extensionService.getExtensionRegistry().then(c=>{this._register(c.onDidChange(u=>{this.registerAllDebugTypes(c)})),this.registerAllDebugTypes(c)}),this._telemetryProxy=e.getProxy(F.MainThreadTelemetry)}get onDidStartDebugSession(){return this._onDidStartDebugSession.event}get onDidTerminateDebugSession(){return this._onDidTerminateDebugSession.event}get onDidChangeActiveDebugSession(){return this._onDidChangeActiveDebugSession.event}get activeDebugSession(){return this._activeDebugSession?.api}get onDidReceiveDebugSessionCustomEvent(){return this._onDidReceiveDebugSessionCustomEvent.event}get activeDebugConsole(){return this._activeDebugConsole.value}async $getVisualizerTreeItem(e,n){let o=this.hydrateVisualizationContext(n);if(!o)return;let i=await this._debugVisualizationTrees.get(e)?.getTreeItem?.(o);return i?this.convertVisualizerTreeItem(e,i):void 0}registerDebugVisualizationTree(e,n,o){let i=Ee.toKey(e.identifier),s=this.extensionVisKey(i,n);if(this._debugVisualizationProviders.has(s))throw new Error(`A debug visualization provider with id '${n}' is already registered`);return this._debugVisualizationTrees.set(s,o),this._debugServiceProxy.$registerDebugVisualizerTree(s,!!o.editItem),K(()=>{this._debugServiceProxy.$unregisterDebugVisualizerTree(s),this._debugVisualizationTrees.delete(n)})}async $getVisualizerTreeItemChildren(e,n){let o=this._debugVisualizationElements.get(n)?.item;return o?(await this._debugVisualizationTrees.get(e)?.getChildren?.(o))?.map(s=>this.convertVisualizerTreeItem(e,s))||[]:[]}async $editVisualizerTreeItem(e,n){let o=this._debugVisualizationElements.get(e);if(!o)return;let i=await this._debugVisualizationTrees.get(o.provider)?.editItem?.(o.item,n);return this.convertVisualizerTreeItem(o.provider,i||o.item)}$disposeVisualizedTree(e){let n=this._debugVisualizationElements.get(e);if(!n)return;let o=[n.children];for(let i of o)if(i)for(let s of i)o.push(this._debugVisualizationElements.get(s)?.children),this._debugVisualizationElements.delete(s)}convertVisualizerTreeItem(e,n){let o=this._debugVisualizationTreeItemIds.get(n);return o||(o=this._debugVisualizationTreeItemIdsCounter++,this._debugVisualizationTreeItemIds.set(n,o),this._debugVisualizationElements.set(o,{provider:e,item:n})),SM.from(n,o)}asDebugSourceUri(e,n){let o=e;if(typeof o.sourceReference=="number"&&o.sourceReference>0){let i=`debug:${encodeURIComponent(o.path||"")}`,s="?";return n&&(i+=`${s}session=${encodeURIComponent(n.id)}`,s="&"),i+=`${s}ref=${o.sourceReference}`,b.parse(i)}else{if(o.path)return b.file(o.path);throw new Error("cannot create uri from DAP 'source' object; properties 'path' and 'sourceReference' are both missing.")}}registerAllDebugTypes(e){let n=[];for(let o of e.getAllExtensionDescriptions())if(o.contributes){let i=o.contributes.debuggers;if(i&&i.length>0)for(let s of i)DV(s)&&n.push(s.type)}this._debugServiceProxy.$registerDebugTypes(n)}get activeStackItem(){return this._activeStackItem}get onDidChangeActiveStackItem(){return this._onDidChangeActiveStackItem.event}get onDidChangeBreakpoints(){return this._onDidChangeBreakpoints.event}get breakpoints(){let e=[];return this._breakpoints.forEach(n=>e.push(n)),e}async $resolveDebugVisualizer(e,n){let o=this._visualizers.get(e);if(!o)throw new Error(`No debug visualizer found with id '${e}'`);let{v:i,provider:s,extensionId:a}=o;if(i.visualization||(i=await s.resolveDebugVisualization?.(i,n)||i,o.v=i),!i.visualization)throw new Error(`No visualization returned from resolveDebugVisualization in '${s}'`);return this.serializeVisualization(a,i.visualization)}async $executeDebugVisualizerCommand(e){let n=this._visualizers.get(e);if(!n)throw new Error(`No debug visualizer found with id '${e}'`);let o=n.v.visualization;o&&"command"in o&&this._commands.executeCommand(o.command,...o.arguments||[])}hydrateVisualizationContext(e){let n=this._debugSessions.get(e.sessionId);return n&&{session:n.api,variable:e.variable,containerId:e.containerId,frameId:e.frameId,threadId:e.threadId}}async $provideDebugVisualizers(e,n,o,i){let s=this.hydrateVisualizationContext(o),a=this.extensionVisKey(e,n),l=this._debugVisualizationProviders.get(a);if(!s||!l)return[];let d=await l.provideDebugVisualization(s,i);return d?d.map(c=>{let u=++this._visualizerIdCounter;this._visualizers.set(u,{v:c,provider:l,extensionId:e});let m=c.iconPath?this.getIconPathOrClass(c.iconPath):void 0;return{id:u,name:c.name,iconClass:m?.iconClass,iconPath:m?.iconPath,visualization:this.serializeVisualization(e,c.visualization)}}):[]}$disposeDebugVisualizers(e){for(let n of e)this._visualizers.delete(n)}registerDebugVisualizationProvider(e,n,o){if(!e.contributes?.debugVisualizers?.some(a=>a.id===n))throw new Error(`Extensions may only call registerDebugVisualizationProvider() for renderers they contribute (got ${n})`);let i=Ee.toKey(e.identifier),s=this.extensionVisKey(i,n);if(this._debugVisualizationProviders.has(s))throw new Error(`A debug visualization provider with id '${n}' is already registered`);return this._debugVisualizationProviders.set(s,o),this._debugServiceProxy.$registerDebugVisualizer(i,n),K(()=>{this._debugServiceProxy.$unregisterDebugVisualizer(i,n),this._debugVisualizationProviders.delete(n)})}addBreakpoints(e){let n=e.filter(s=>{let a=s.id;return this._breakpoints.has(a)?!1:(this._breakpoints.set(a,s),!0)});this.fireBreakpointChanges(n,[],[]);let o=[],i=new Map;for(let s of n)if(s instanceof Ri){let a=i.get(s.location.uri.toString());a||(a={type:"sourceMulti",uri:s.location.uri,lines:[]},i.set(s.location.uri.toString(),a),o.push(a)),a.lines.push({id:s.id,enabled:s.enabled,condition:s.condition,hitCondition:s.hitCondition,logMessage:s.logMessage,line:s.location.range.start.line,character:s.location.range.start.character,mode:s.mode})}else s instanceof Ai&&o.push({type:"function",id:s.id,enabled:s.enabled,hitCondition:s.hitCondition,logMessage:s.logMessage,condition:s.condition,functionName:s.functionName,mode:s.mode});return this._debugServiceProxy.$registerBreakpoints(o)}removeBreakpoints(e){let n=e.filter(a=>this._breakpoints.delete(a.id));this.fireBreakpointChanges([],n,[]);let o=n.filter(a=>a instanceof Ri).map(a=>a.id),i=n.filter(a=>a instanceof Ai).map(a=>a.id),s=n.filter(a=>a instanceof Hc).map(a=>a.id);return this._debugServiceProxy.$unregisterBreakpoints(o,i,s)}startDebugging(e,n,o){let i=o.testRun&&this._testing.getMetadataForRun(o.testRun);return this._debugServiceProxy.$startDebugging(e?e.uri:void 0,n,{parentSessionID:o.parentSession?o.parentSession.id:void 0,lifecycleManagedByParent:o.lifecycleManagedByParent,repl:o.consoleMode===1?"mergeWithParent":"separate",noDebug:o.noDebug,compact:o.compact,suppressSaveBeforeStart:o.suppressSaveBeforeStart,testRun:i&&{runId:i.runId,taskId:i.taskId},suppressDebugStatusbar:o.suppressDebugStatusbar??o.debugUI?.simple,suppressDebugToolbar:o.suppressDebugToolbar??o.debugUI?.simple,suppressDebugView:o.suppressDebugView??o.debugUI?.simple})}stopDebugging(e){return this._debugServiceProxy.$stopDebugging(e?e.id:void 0)}registerDebugConfigurationProvider(e,n,o){if(!n)return new be(()=>{});let i=this._configProviderHandleCounter++;return this._configProviders.push({type:e,handle:i,provider:n}),this._debugServiceProxy.$registerDebugConfigurationProvider(e,o,!!n.provideDebugConfigurations,!!n.resolveDebugConfiguration,!!n.resolveDebugConfigurationWithSubstitutedVariables,i),new be(()=>{this._configProviders=this._configProviders.filter(s=>s.provider!==n),this._debugServiceProxy.$unregisterDebugConfigurationProvider(i)})}registerDebugAdapterDescriptorFactory(e,n,o){if(!o)return new be(()=>{});if(!this.definesDebugType(e,n))throw new Error(`a DebugAdapterDescriptorFactory can only be registered from the extension that defines the '${n}' debugger.`);if(this.getAdapterDescriptorFactoryByType(n))throw new Error("a DebugAdapterDescriptorFactory can only be registered once per a type.");let i=this._adapterFactoryHandleCounter++;return this._adapterFactories.push({type:n,handle:i,factory:o}),this._debugServiceProxy.$registerDebugAdapterDescriptorFactory(n,i),new be(()=>{this._adapterFactories=this._adapterFactories.filter(s=>s.factory!==o),this._debugServiceProxy.$unregisterDebugAdapterDescriptorFactory(i)})}registerDebugAdapterTrackerFactory(e,n){if(!n)return new be(()=>{});let o=this._trackerFactoryHandleCounter++;return this._trackerFactories.push({type:e,handle:o,factory:n}),new be(()=>{this._trackerFactories=this._trackerFactories.filter(i=>i.factory!==n)})}async $runInTerminal(e,n){return Promise.resolve(void 0)}async $substituteVariables(e,n){let o,i=await this.getFolder(e);return i&&(o={uri:i.uri,name:i.name,index:i.index}),(await this._variableResolver.getResolver()).resolveAsync(o,n)}createDebugAdapter(e,n){if(e instanceof Ca)return new Y0(e.implementation)}createSignService(){}async $startDASession(e,n){let o=this,i=await this.getSession(n);return this.getAdapterDescriptor(this.getAdapterDescriptorFactoryByType(i.type),i).then(s=>{if(!s)throw new Error(`Couldn't find a debug adapter descriptor for debug type '${i.type}' (extension might have failed to activate)`);let a=this.createDebugAdapter(s,i);if(!a)throw new Error(`Couldn't create a debug adapter for type '${i.type}'.`);let l=a;return this._debugAdapters.set(e,l),this.getDebugAdapterTrackers(i).then(d=>(d&&this._debugAdaptersTrackers.set(e,d),l.onMessage(async c=>{if(c.type==="request"&&c.command==="handshake"){let u=c,m={type:"response",seq:0,command:u.command,request_seq:u.seq,success:!0};this._signService||(this._signService=this.createSignService());try{if(this._signService){let g=await this._signService.sign(u.arguments.value);m.body={signature:g},l.sendResponse(m)}else throw new Error("no signer")}catch(g){m.success=!1,m.message=g.message,l.sendResponse(m)}}else{d&&d.onDidSendMessage&&d.onDidSendMessage(c);try{c=LV(c,!0)}catch(u){let m=c.type+"_"+(c.command??c.event??"");throw this._telemetryProxy.$publicLog2("debugProtocolMessageError",{type:m,from:i.type}),u}o._debugServiceProxy.$acceptDAMessage(e,c)}}),l.onError(c=>{d&&d.onError&&d.onError(c),this._debugServiceProxy.$acceptDAError(e,c.name,c.message,c.stack)}),l.onExit(c=>{d&&d.onExit&&d.onExit(c??void 0,void 0),this._debugServiceProxy.$acceptDAExit(e,c??void 0,void 0)}),d&&d.onWillStartSession&&d.onWillStartSession(),l.startSession()))})}$sendDAMessage(e,n){n=MV(n,!1);let o=this._debugAdaptersTrackers.get(e);o&&o.onWillReceiveMessage&&o.onWillReceiveMessage(n),this._debugAdapters.get(e)?.sendMessage(n)}$stopDASession(e){let n=this._debugAdaptersTrackers.get(e);this._debugAdaptersTrackers.delete(e),n&&n.onWillStopSession&&n.onWillStopSession();let o=this._debugAdapters.get(e);return this._debugAdapters.delete(e),o?o.stopSession():Promise.resolve(void 0)}$acceptBreakpointsDelta(e){let n=[],o=[],i=[];if(e.added)for(let s of e.added){let a=s.id;if(a&&!this._breakpoints.has(a)){let l;if(s.type==="function")l=new Ai(s.functionName,s.enabled,s.condition,s.hitCondition,s.logMessage,s.mode);else if(s.type==="data")l=new Hc(s.label,s.dataId,s.canPersist,s.enabled,s.hitCondition,s.condition,s.logMessage,s.mode);else{let d=b.revive(s.uri);l=new Ri(new en(d,new we(s.line,s.character)),s.enabled,s.condition,s.hitCondition,s.logMessage,s.mode)}a4(l,a),this._breakpoints.set(a,l),n.push(l)}}if(e.removed)for(let s of e.removed){let a=this._breakpoints.get(s);a&&(this._breakpoints.delete(s),o.push(a))}if(e.changed){for(let s of e.changed)if(s.id){let a=this._breakpoints.get(s.id);if(a){if(a instanceof Ai&&s.type==="function"){let l=a;l.enabled=s.enabled,l.condition=s.condition,l.hitCondition=s.hitCondition,l.logMessage=s.logMessage,l.functionName=s.functionName}else if(a instanceof Ri&&s.type==="source"){let l=a;l.enabled=s.enabled,l.condition=s.condition,l.hitCondition=s.hitCondition,l.logMessage=s.logMessage,l.location=new en(b.revive(s.uri),new we(s.line,s.character))}i.push(a)}}}this.fireBreakpointChanges(n,o,i)}async $acceptStackFrameFocus(e){let n;if(e){let o=await this.getSession(e.sessionId);e.kind==="thread"?n=new um(o.api,e.threadId):n=new cm(o.api,e.threadId,e.frameId)}this._activeStackItem=n,this._onDidChangeActiveStackItem.fire(this._activeStackItem)}$provideDebugConfigurations(e,n,o){return hn(async()=>{let i=this.getConfigProviderByHandle(e);if(!i)throw new Error("no DebugConfigurationProvider found");if(!i.provideDebugConfigurations)throw new Error("DebugConfigurationProvider has no method provideDebugConfigurations");let s=await this.getFolder(n);return i.provideDebugConfigurations(s,o)}).then(i=>{if(!i)throw new Error("nothing returned from DebugConfigurationProvider.provideDebugConfigurations");return i})}$resolveDebugConfiguration(e,n,o,i){return hn(async()=>{let s=this.getConfigProviderByHandle(e);if(!s)throw new Error("no DebugConfigurationProvider found");if(!s.resolveDebugConfiguration)throw new Error("DebugConfigurationProvider has no method resolveDebugConfiguration");let a=await this.getFolder(n);return s.resolveDebugConfiguration(a,o,i)})}$resolveDebugConfigurationWithSubstitutedVariables(e,n,o,i){return hn(async()=>{let s=this.getConfigProviderByHandle(e);if(!s)throw new Error("no DebugConfigurationProvider found");if(!s.resolveDebugConfigurationWithSubstitutedVariables)throw new Error("DebugConfigurationProvider has no method resolveDebugConfigurationWithSubstitutedVariables");let a=await this.getFolder(n);return s.resolveDebugConfigurationWithSubstitutedVariables(a,o,i)})}async $provideDebugAdapter(e,n){let o=this.getAdapterDescriptorFactoryByHandle(e);if(!o)return Promise.reject(new Error("no adapter descriptor factory found for handle"));let i=await this.getSession(n);return this.getAdapterDescriptor(o,i).then(s=>{if(!s)throw new Error(`Couldn't find a debug adapter descriptor for debug type '${i.type}'`);return this.convertToDto(s)})}async $acceptDebugSessionStarted(e){let n=await this.getSession(e);this._onDidStartDebugSession.fire(n.api)}async $acceptDebugSessionTerminated(e){let n=await this.getSession(e);n&&(this._onDidTerminateDebugSession.fire(n.api),this._debugSessions.delete(n.id))}async $acceptDebugSessionActiveChanged(e){this._activeDebugSession=e?await this.getSession(e):void 0,this._onDidChangeActiveDebugSession.fire(this._activeDebugSession?.api)}async $acceptDebugSessionNameChanged(e,n){(await this.getSession(e))?._acceptNameChanged(n)}async $acceptDebugSessionCustomEvent(e,n){let i={session:(await this.getSession(e)).api,event:n.event,body:n.body};this._onDidReceiveDebugSessionCustomEvent.fire(i)}convertToDto(e){if(e instanceof Mi)return this.convertExecutableToDto(e);if(e instanceof Li)return this.convertServerToDto(e);if(e instanceof ws)return this.convertPipeServerToDto(e);if(e instanceof Ca)return this.convertImplementationToDto(e);throw new Error("convertToDto unexpected type")}convertExecutableToDto(e){return{type:"executable",command:e.command,args:e.args,options:e.options}}convertServerToDto(e){return{type:"server",port:e.port,host:e.host}}convertPipeServerToDto(e){return{type:"pipeServer",path:e.path}}convertImplementationToDto(e){return{type:"implementation"}}getAdapterDescriptorFactoryByType(e){let n=this._adapterFactories.filter(o=>o.type===e);if(n.length>0)return n[0].factory}getAdapterDescriptorFactoryByHandle(e){let n=this._adapterFactories.filter(o=>o.handle===e);if(n.length>0)return n[0].factory}getConfigProviderByHandle(e){let n=this._configProviders.filter(o=>o.handle===e);if(n.length>0)return n[0].provider}definesDebugType(e,n){if(e.contributes){let o=e.contributes.debuggers;if(o&&o.length>0){for(let i of o)if(i.label&&i.type&&i.type===n)return!0}}return!1}getDebugAdapterTrackers(e){let o=e.configuration.type,i=this._trackerFactories.filter(s=>s.type===o||s.type==="*").map(s=>hn(()=>s.factory.createDebugAdapterTracker(e.api)).then(a=>a,a=>null));return Promise.race([Promise.all(i).then(s=>{let a=tt(s);if(a.length>0)return new J0(a)}),new Promise(s=>setTimeout(()=>s(void 0),1e3))]).catch(s=>{})}async getAdapterDescriptor(e,n){let o=n.configuration.debugServer;if(typeof o=="number")return Promise.resolve(new Li(o));if(e){let s=await this._extensionService.getExtensionRegistry();return hn(()=>e.createDebugAdapterDescriptor(n.api,this.daExecutableFromPackage(n,s))).then(a=>{if(a)return a})}let i=await this._extensionService.getExtensionRegistry();return Promise.resolve(this.daExecutableFromPackage(n,i))}daExecutableFromPackage(e,n){}fireBreakpointChanges(e,n,o){(e.length>0||n.length>0||o.length>0)&&this._onDidChangeBreakpoints.fire(Object.freeze({added:e,removed:n,changed:o}))}async getSession(e){if(e)if(typeof e=="string"){let n=this._debugSessions.get(e);if(n)return n}else{let n=this._debugSessions.get(e.id);if(!n){let o=await this.getFolder(e.folderUri),i=e.parent?this._debugSessions.get(e.parent):void 0;n=new G0(this._debugServiceProxy,e.id,e.type,e.name,o,e.configuration,i?.api),this._debugSessions.set(n.id,n),this._debugServiceProxy.$sessionCached(n.id)}return n}throw new Error("cannot find session")}getFolder(e){if(e){let n=b.revive(e);return this._workspaceService.resolveWorkspaceFolder(n)}return Promise.resolve(void 0)}extensionVisKey(e,n){return`${e}\0${n}`}serializeVisualization(e,n){if(n){if("title"in n&&"command"in n)return{type:0};if("treeId"in n)return{type:1,id:`${e}\0${n.treeId}`};throw new Error("Unsupported debug visualization type")}}getIconPathOrClass(e){let n=this.getIconUris(e),o,i;return"id"in n?i=ut.asClassName(n):o=n,{iconPath:o,iconClass:i}}getIconUris(e){if(e instanceof un)return{id:e.id};let n=typeof e=="object"&&"dark"in e?e.dark:e,o=typeof e=="object"&&"light"in e?e.light:e;return{dark:typeof n=="string"?b.file(n):n,light:typeof o=="string"?b.file(o):o}}};Tu=_([C(0,se),C(1,On),C(2,go),C(3,Sn),C(4,Bi),C(5,Wr),C(6,Nn),C(7,za)],Tu);var G0=class{constructor(t,e,n,o,i,s,a){this._debugServiceProxy=t;this._id=e;this._type=n;this._name=o;this._workspaceFolder=i;this._configuration=s;this._parentSession=a}get api(){let t=this;return this.apiSession??=Object.freeze({id:t._id,type:t._type,get name(){return t._name},set name(e){t._name=e,t._debugServiceProxy.$setDebugSessionName(t._id,e)},parentSession:t._parentSession,workspaceFolder:t._workspaceFolder,configuration:t._configuration,customRequest(e,n){return t._debugServiceProxy.$customDebugAdapterRequest(t._id,e,n)},getDebugProtocolBreakpoint(e){return t._debugServiceProxy.$getDebugProtocolBreakpoint(t._id,e.id)}})}get id(){return this._id}get type(){return this._type}_acceptNameChanged(t){this._name=t}get configuration(){return this._configuration}},Q0=class{constructor(t){this.value=Object.freeze({append(e){t.$appendDebugConsole(e)},appendLine(e){this.append(e+`
`)}})}},J0=class{constructor(t){this.trackers=t}onWillStartSession(){this.trackers.forEach(t=>t.onWillStartSession?t.onWillStartSession():void 0)}onWillReceiveMessage(t){this.trackers.forEach(e=>e.onWillReceiveMessage?e.onWillReceiveMessage(t):void 0)}onDidSendMessage(t){this.trackers.forEach(e=>e.onDidSendMessage?e.onDidSendMessage(t):void 0)}onWillStopSession(){this.trackers.forEach(t=>t.onWillStopSession?t.onWillStopSession():void 0)}onError(t){this.trackers.forEach(e=>e.onError?e.onError(t):void 0)}onExit(t,e){this.trackers.forEach(n=>n.onExit?n.onExit(t,e):void 0)}},Y0=class extends $g{constructor(e){super();this.implementation=e;e.onDidSendMessage(n=>{this.acceptMessage(n)})}startSession(){return Promise.resolve(void 0)}sendMessage(e){this.implementation.handleMessage(e)}stopSession(){return this.implementation.dispose(),Promise.resolve(void 0)}},Kg=class extends Tu{constructor(t,e,n,o,i,s,a,l){super(t,e,n,o,i,s,a,l)}};Kg=_([C(0,se),C(1,On),C(2,go),C(3,Sn),C(4,Bi),C(5,Wr),C(6,Nn),C(7,za)],Kg);function xK(r){return"uri"in r&&"ranges"in r&&"preview"in r}function SK(r){return r.folderOptions.map(t=>({folder:t.folder,excludes:t.excludes.map(e=>typeof e=="string"?e:e.pattern),includes:t.includes,useGlobalIgnoreFiles:t.useIgnoreFiles.global,useIgnoreFiles:t.useIgnoreFiles.local,useParentIgnoreFiles:t.useIgnoreFiles.parent,followSymlinks:t.followSymlinks,maxResults:r.maxResults,session:r.session}))}var Gg=class{constructor(t){this.provider=t}provideFileSearchResults(t,e,n){return(async()=>{let i=SK(e);return Promise.all(i.map(s=>this.provider.provideFileSearchResults({pattern:t},s,n)))})().then(i=>tt(i).flat())}};function CK(r){return r.folderOptions.map(t=>({folder:t.folder,excludes:t.excludes.map(e=>typeof e=="string"?e:e.pattern),includes:t.includes,useGlobalIgnoreFiles:t.useIgnoreFiles.global,useIgnoreFiles:t.useIgnoreFiles.local,useParentIgnoreFiles:t.useIgnoreFiles.parent,followSymlinks:t.followSymlinks,maxResults:r.maxResults,previewOptions:X0(r.previewOptions),maxFileSize:r.maxFileSize,encoding:t.encoding,afterContext:r.surroundingContext,beforeContext:r.surroundingContext}))}function X0(r){return{matchLines:r?.matchLines??fb.matchLines,charsPerLine:r?.charsPerLine??fb.charsPerLine}}function TK(r){if(xK(r)){let t=Dn(r.ranges).map((e,n)=>{let i=Dn(r.preview.matches)[n];return{sourceRange:e,previewRange:i}});return new zo(r.uri,t,r.preview.text)}else return new Us(r.uri,r.text,r.lineNumber)}var uE=class{constructor(t){this.provider=t}provideTextSearchResults(t,e,n,o){let i=l=>{EK(l)&&n.report(TK(l))};return(async()=>tt(await Promise.all(CK(e).map(l=>this.provider.provideTextSearchResults(t,l,{report:d=>i(d)},o)))).reduce((l,d)=>({limitHit:l.limitHit||d.limitHit}),{limitHit:!1}))().then(l=>({limitHit:l.limitHit,message:tt(Dn(l.message))}))}};function EK(r){if(wK(r)){if(Array.isArray(r.ranges)){if(!Array.isArray(r.preview.matches))return console.warn("INVALID - A text search provider match's`ranges` and`matches` properties must have the same type."),!1;if(r.preview.matches.length!==r.ranges.length)return console.warn("INVALID - A text search provider match's`ranges` and`matches` properties must have the same length."),!1}else if(Array.isArray(r.preview.matches))return console.warn("INVALID - A text search provider match's`ranges` and`matches` properties must have the same length."),!1}return!0}function wK(r){return!!r.preview}var Qg=class extends er{constructor(t,e,n=()=>!1){let o=new Gh(n,()=>!1);super(o);let i=new Ke;t.forEach((s,a)=>{let l=s.folder.with({query:"",fragment:""});i.has(l)?i.get(l).push({fq:s,i:a}):i.set(l,[{fq:s,i:a}])}),i.forEach((s,a)=>{let l=new Map;for(let d of s){let c=e(d.fq,d.i);l.set(this.encodeKey(d.fq.folder),c)}super.set(a,l)})}findQueryFragmentAwareSubstr(t){let e=super.findSubstr(t.with({query:"",fragment:""}));if(!e)return;let n=this.encodeKey(t);return e.get(n)}forEachFolderQueryInfo(t){return this.forEach(e=>e.forEach(n=>t(n)))}encodeKey(t){let e="";return t.query&&(e+=t.query),t.fragment&&(e+="#"+t.fragment),e}};var Z0=class{constructor(t,e,n){this.config=t;this.provider=e;this.sessionLifecycle=n;this.isLimitHit=!1;this.resultCount=0;this.isCanceled=!1;this.filePattern=t.filePattern;let o=t.ignoreGlobCase?{ignoreCase:!0}:void 0;this.includePattern=t.includePattern&&Co(t.includePattern,o),this.maxResults=t.maxResults||void 0,this.exists=t.exists,this.activeCancellationTokens=new Set,this.globalExcludePattern=t.excludePattern&&Co(t.excludePattern,o)}cancel(){this.isCanceled=!0,this.activeCancellationTokens.forEach(t=>t.cancel()),this.activeCancellationTokens=new Set}search(t){let e=this.config.folderQueries||[];return new Promise((n,o)=>{let i=s=>{this.resultCount++,t(s)};if(this.isCanceled)return n({limitHit:this.isLimitHit});this.config.extraFileResources&&this.config.extraFileResources.forEach(s=>{let a=s.toString(),l=nt(a);this.globalExcludePattern&&this.globalExcludePattern(a,l)||this.matchFile(i,{base:s,basename:l})}),this.doSearch(e,i).then(s=>{n({limitHit:this.isLimitHit,stats:s||void 0})},s=>{o(new Error(Io(s)))})})}async doSearch(t,e){let n=new Ce,o=t.map(c=>this.getSearchOptionsForFolder(c)),i=this.provider instanceof Gg?this.sessionLifecycle?.tokenSource.token:this.sessionLifecycle?.obj,s={folderOptions:o,maxResults:this.config.maxResults??md,session:i},a=c=>{let u=new tg(this.config,c),m=!u.hasSiblingExcludeClauses();return{queryTester:u,noSiblingsClauses:m,folder:c.folder,tree:this.initDirectoryTree()}},l=new Qg(t,a),d;try{this.activeCancellationTokens.add(n),d=an.create();let c=await this.provider.provideFileSearchResults(this.config.filePattern||"",s,n.token),u=d.elapsed(),m=an.create();return this.isCanceled&&!this.isLimitHit||(c&&c.forEach(g=>{let h=l.findQueryFragmentAwareSubstr(g),f=Ge.relative(h.folder.path,g.path);if(h.noSiblingsClauses){let I=nt(g.path);this.matchFile(e,{base:h.folder,relativePath:f,basename:I});return}this.addDirectoryEntries(h.tree,h.folder,f,e)}),this.isCanceled&&!this.isLimitHit)?null:(l.forEachFolderQueryInfo(g=>{this.matchDirectoryTree(g.tree,g.queryTester,e)}),{providerTime:u,postProcessTime:m.elapsed()})}finally{n.dispose(),this.activeCancellationTokens.delete(n)}}getSearchOptionsForFolder(t){let e=gd(this.config.includePattern,t.includePattern),n=t.excludePattern?.map(i=>({folder:i.folder,patterns:gd(this.config.excludePattern,i.pattern)}));n?.length||(n=[{folder:void 0,patterns:gd(this.config.excludePattern,void 0)}]);let o=wT(n);return{folder:t.folder,excludes:o,includes:e,useIgnoreFiles:{local:!t.disregardIgnoreFiles,parent:!t.disregardParentIgnoreFiles,global:!t.disregardGlobalIgnoreFiles},followSymlinks:!t.ignoreSymlinks}}initDirectoryTree(){let t={rootEntries:[],pathToEntries:Object.create(null)};return t.pathToEntries["."]=t.rootEntries,t}addDirectoryEntries({pathToEntries:t},e,n,o){if(this.filePattern&&is(n,this.filePattern,this.config.ignoreGlobCase)){let s=nt(this.filePattern);this.matchFile(o,{base:e,relativePath:this.filePattern,basename:s})}function i(s){let a=nt(s),l=cn(s),d=t[l];d||(d=t[l]=[],i(l)),d.push({base:e,relativePath:s,basename:a})}i(n)}matchDirectoryTree({rootEntries:t,pathToEntries:e},n,o){let i=this,s=this.filePattern,a=this.config.ignoreGlobCase;function l(d){let c=gb(()=>d.map(u=>u.basename));for(let u=0,m=d.length;u<m;u++){let g=d[u],{relativePath:h,basename:f}=g;if(n.matchesExcludesSync(h,f,is(s,f,a)?void 0:c))continue;let I=e[h];if(I)l(I);else{if(is(h,s,a))continue;i.matchFile(o,g)}if(i.isLimitHit)break}}l(t)}matchFile(t,e){(!this.includePattern||e.relativePath&&this.includePattern(e.relativePath,e.basename))&&((this.exists||this.maxResults&&this.resultCount>=this.maxResults)&&(this.isLimitHit=!0,this.cancel()),this.isLimitHit||t(e))}},eL=class{constructor(){this._obj=new Object,this.tokenSource=new Ce}get obj(){if(this._obj)return this._obj;throw new Error("Session object has been dereferenced.")}cancel(){this.tokenSource.cancel(),this._obj=void 0}},pE=class r{constructor(){this.sessions=new Map}static{this.BATCH_SIZE=512}fileSearch(t,e,n,o){let i=this.getSessionTokenSource(t.cacheKey),s=new Z0(t,e,i),a=0,l=d=>{a+=d.length,n(d.map(c=>this.rawMatchToSearchItem(c)))};return this.doSearch(s,r.BATCH_SIZE,l,o).then(d=>({limitHit:d.limitHit,stats:d.stats?{fromCache:!1,type:"fileSearchProvider",resultCount:a,detailStats:d.stats}:void 0,messages:[]}))}clearCache(t){this.sessions.get(t)?.cancel(),this.sessions.delete(t)}getSessionTokenSource(t){if(t)return this.sessions.has(t)||this.sessions.set(t,new eL),this.sessions.get(t)}rawMatchToSearchItem(t){return t.relativePath?{resource:Et(t.base,t.relativePath)}:{resource:t.base}}doSearch(t,e,n,o){let i=o.onCancellationRequested(()=>{t.cancel()}),s=l=>{l&&(a.push(l),e>0&&a.length>=e&&(n(a),a=[]))},a=[];return t.search(s).then(l=>(a.length&&n(a),i.dispose(),l),l=>(a.length&&n(a),i.dispose(),Promise.reject(l)))}};var Eu=class{constructor(t,e,n){this.queryProviderPair=t;this.fileUtils=e;this.processType=n;this.collector=null;this.isLimitHit=!1;this.resultCount=0}get query(){return this.queryProviderPair.query}search(t,e,n){let o=this.query.folderQueries||[],i=new Ce(e);return new Promise((s,a)=>{this.collector=new tL(t);let l=!1,d=(c,u)=>{if(!(c instanceof pu)&&!l&&!this.isLimitHit){let m=this.resultSize(c);c instanceof zo&&typeof this.query.maxResults=="number"&&this.resultCount+m>this.query.maxResults&&(this.isLimitHit=!0,l=!0,i.cancel(),c=this.trimResultToSize(c,this.query.maxResults-this.resultCount));let g=this.resultSize(c);this.resultCount+=g;let h=c instanceof zo;(g>0||!h)&&this.collector.add(c,u)}};this.doSearch(o,d,i.token,n).then(c=>{i.dispose(),this.collector.flush(),s({limitHit:this.isLimitHit||c?.limitHit,messages:this.getMessagesFromResults(c),stats:{type:this.processType}})},c=>{i.dispose();let u=Io(c);a(new Error(u))})})}getMessagesFromResults(t){return t?.message?Array.isArray(t.message)?t.message:[t.message]:[]}resultSize(t){return t instanceof zo?Array.isArray(t.ranges)?t.ranges.length:1:0}trimResultToSize(t,e){return new zo(t.uri,t.ranges.slice(0,e),t.previewText)}async doSearch(t,e,n,o){let i=new Qg(t,(u,m)=>({queryTester:new tg(this.query,u),folder:u.folder,folderIdx:m}),()=>!0),s=[],a={report:u=>{if(u instanceof pu)o?.(u);else{if(u.uri===void 0)throw Error("Text search result URI is undefined. Please check provider implementation.");let m=i.findQueryFragmentAwareSubstr(u.uri);if(m?.folder?.scheme){let g=m.folder.scheme===V.file?k4(()=>this.fileUtils.readdir(Go(u.uri))):void 0,h=bh(m.folder,u.uri);if(h){let f=m.queryTester.includedInQuery(h,nt(h),g);qr(f)?s.push(f.then(I=>{I&&e(u,m.folderIdx)})):f&&e(u,m.folderIdx)}}}}},d={folderOptions:t.map(u=>this.getSearchOptionsForFolder(u)),maxFileSize:this.query.maxFileSize,maxResults:this.query.maxResults??md,previewOptions:this.query.previewOptions??fb,surroundingContext:this.query.surroundingContext??0};"usePCRE2"in this.query&&(d.usePCRE2=this.query.usePCRE2);let c;return this.queryProviderPair.query.type===3?c=await this.queryProviderPair.provider.provideAITextSearchResults(this.queryProviderPair.query.contentPattern,d,a,n):c=await this.queryProviderPair.provider.provideTextSearchResults(kK(this.queryProviderPair.query.contentPattern),d,a,n),s.length&&await Promise.all(s),c}getSearchOptionsForFolder(t){let e=gd(this.query.includePattern,t.includePattern),n=t.excludePattern?.map(s=>({folder:s.folder,patterns:gd(this.query.excludePattern,s.pattern)}));(!n||n.length===0)&&(n=[{folder:void 0,patterns:gd(this.query.excludePattern,void 0)}]);let o=wT(n);return{folder:b.from(t.folder),excludes:o,includes:e,useIgnoreFiles:{local:!t.disregardIgnoreFiles,parent:!t.disregardParentIgnoreFiles,global:!t.disregardGlobalIgnoreFiles},followSymlinks:!t.ignoreSymlinks,encoding:(t.fileEncoding&&this.fileUtils.toCanonicalName(t.fileEncoding))??"",ignoreGlobCase:this.query.ignoreGlobCase||t.ignoreGlobCase}}};function kK(r){return{isCaseSensitive:r.isCaseSensitive||!1,isRegExp:r.isRegExp||!1,isWordMatch:r.isWordMatch||!1,isMultiline:r.isMultiline||!1,pattern:r.pattern}}var tL=class{constructor(t){this._onResult=t;this._currentFolderIdx=-1;this._currentFileMatch=null;this._batchedCollector=new nL(512,e=>this.sendItems(e))}add(t,e){this._currentFileMatch&&(this._currentFolderIdx!==e||!Ro(this._currentUri,t.uri))&&(this.pushToCollector(),this._currentFileMatch=null),this._currentFileMatch||(this._currentFolderIdx=e,this._currentUri=t.uri,this._currentFileMatch={resource:t.uri,results:[]}),this._currentFileMatch.results.push(PK(t))}pushToCollector(){let t=this._currentFileMatch&&this._currentFileMatch.results?this._currentFileMatch.results.length:0;this._batchedCollector.addItem(this._currentFileMatch,t)}flush(){this.pushToCollector(),this._batchedCollector.flush()}sendItems(t){this._onResult(t)}};function PK(r){return r instanceof zo?{previewText:r.previewText,rangeLocations:r.ranges.map(t=>({preview:{startLineNumber:t.previewRange.start.line,startColumn:t.previewRange.start.character,endLineNumber:t.previewRange.end.line,endColumn:t.previewRange.end.character},source:{startLineNumber:t.sourceRange.start.line,startColumn:t.sourceRange.start.character,endLineNumber:t.sourceRange.end.line,endColumn:t.sourceRange.end.character}}))}:{text:r.text,lineNumber:r.lineNumber}}var nL=class r{constructor(t,e){this.maxBatchSize=t;this.cb=e;this.totalNumberCompleted=0;this.batch=[];this.batchSize=0}static{this.TIMEOUT=4e3}static{this.START_BATCH_AFTER_COUNT=50}addItem(t,e){t&&this.addItemToBatch(t,e)}addItems(t,e){t&&this.addItemsToBatch(t,e)}addItemToBatch(t,e){this.batch.push(t),this.batchSize+=e,this.onUpdate()}addItemsToBatch(t,e){this.batch=this.batch.concat(t),this.batchSize+=e,this.onUpdate()}onUpdate(){this.totalNumberCompleted<r.START_BATCH_AFTER_COUNT?this.flush():this.batchSize>=this.maxBatchSize?this.flush():this.timeoutHandle||(this.timeoutHandle=setTimeout(()=>{this.flush()},r.TIMEOUT))}flush(){this.batchSize&&(this.totalNumberCompleted+=this.batchSize,this.cb(this.batch),this.batch=[],this.batchSize=0,this.timeoutHandle&&(clearTimeout(this.timeoutHandle),this.timeoutHandle=void 0))}};var Jg=R("IExtHostSearch"),Pd=class{constructor(t,e,n){this.extHostRpc=t;this._uriTransformer=e;this._logService=n;this._proxy=this.extHostRpc.getProxy(F.MainThreadSearch),this._handlePool=0,this._textSearchProvider=new Map,this._textSearchUsedSchemes=new Set,this._aiTextSearchProvider=new Map,this._aiTextSearchUsedSchemes=new Set,this._fileSearchProvider=new Map,this._fileSearchUsedSchemes=new Set,this._fileSearchManager=new pE}_transformScheme(t){return this._uriTransformer.transformOutgoingScheme(t)}registerTextSearchProviderOld(t,e){if(this._textSearchUsedSchemes.has(t))throw new Error(`a text search provider for the scheme '${t}' is already registered`);this._textSearchUsedSchemes.add(t);let n=this._handlePool++;return this._textSearchProvider.set(n,new uE(e)),this._proxy.$registerTextSearchProvider(n,this._transformScheme(t)),K(()=>{this._textSearchUsedSchemes.delete(t),this._textSearchProvider.delete(n),this._proxy.$unregisterProvider(n)})}registerTextSearchProvider(t,e){if(this._textSearchUsedSchemes.has(t))throw new Error(`a text search provider for the scheme '${t}' is already registered`);this._textSearchUsedSchemes.add(t);let n=this._handlePool++;return this._textSearchProvider.set(n,e),this._proxy.$registerTextSearchProvider(n,this._transformScheme(t)),K(()=>{this._textSearchUsedSchemes.delete(t),this._textSearchProvider.delete(n),this._proxy.$unregisterProvider(n)})}registerAITextSearchProvider(t,e){if(this._aiTextSearchUsedSchemes.has(t))throw new Error(`an AI text search provider for the scheme '${t}'is already registered`);this._aiTextSearchUsedSchemes.add(t);let n=this._handlePool++;return this._aiTextSearchProvider.set(n,e),this._proxy.$registerAITextSearchProvider(n,this._transformScheme(t)),K(()=>{this._aiTextSearchUsedSchemes.delete(t),this._aiTextSearchProvider.delete(n),this._proxy.$unregisterProvider(n)})}registerFileSearchProviderOld(t,e){if(this._fileSearchUsedSchemes.has(t))throw new Error(`a file search provider for the scheme '${t}' is already registered`);this._fileSearchUsedSchemes.add(t);let n=this._handlePool++;return this._fileSearchProvider.set(n,new Gg(e)),this._proxy.$registerFileSearchProvider(n,this._transformScheme(t)),K(()=>{this._fileSearchUsedSchemes.delete(t),this._fileSearchProvider.delete(n),this._proxy.$unregisterProvider(n)})}registerFileSearchProvider(t,e){if(this._fileSearchUsedSchemes.has(t))throw new Error(`a file search provider for the scheme '${t}' is already registered`);this._fileSearchUsedSchemes.add(t);let n=this._handlePool++;return this._fileSearchProvider.set(n,e),this._proxy.$registerFileSearchProvider(n,this._transformScheme(t)),K(()=>{this._fileSearchUsedSchemes.delete(t),this._fileSearchProvider.delete(n),this._proxy.$unregisterProvider(n)})}$provideFileSearchResults(t,e,n,o){let i=Lb(n),s=this._fileSearchProvider.get(t);if(s)return this._fileSearchManager.fileSearch(i,s,a=>{this._proxy.$handleFileMatch(t,e,a.map(l=>l.resource))},o);throw new Error("unknown provider: "+t)}async doInternalFileSearchWithCustomCallback(t,e,n){return{messages:[]}}$clearCache(t){return this._fileSearchManager.clearCache(t),Promise.resolve(void 0)}$provideTextSearchResults(t,e,n,o){let i=this._textSearchProvider.get(t);if(!i||!i.provideTextSearchResults)throw new Error(`Unknown Text Search Provider ${t}`);let s=Lb(n);return this.createTextSearchManager(s,i).search(l=>this._proxy.$handleTextMatch(t,e,l),o)}$provideAITextSearchResults(t,e,n,o){let i=this._aiTextSearchProvider.get(t);if(!i||!i.provideAITextSearchResults)throw new Error(`Unknown AI Text Search Provider ${t}`);let s=Lb(n);return this.createAITextSearchManager(s,i).search(l=>this._proxy.$handleTextMatch(t,e,l),o,l=>this._proxy.$handleKeywordResult(t,e,l))}$enableExtensionHostSearch(){}async $getAIName(t){let e=this._aiTextSearchProvider.get(t);if(!(!e||!e.provideAITextSearchResults))return e.name??"AI"}createTextSearchManager(t,e){return new Eu({query:t,provider:e},{readdir:n=>Promise.resolve([]),toCanonicalName:n=>n},"textSearchProvider")}createAITextSearchManager(t,e){return new Eu({query:t,provider:e},{readdir:n=>Promise.resolve([]),toCanonicalName:n=>n},"aiTextSearchProvider")}};Pd=_([C(0,se),C(1,ds),C(2,oe)],Pd);function Lb(r){return{...r,folderQueries:r.folderQueries&&r.folderQueries.map(_K),extraFileResources:r.extraFileResources&&r.extraFileResources.map(t=>b.revive(t))}}function _K(r){return ht(r)}var Yg=class extends O{constructor(e){super();this._onDidSuspend=this._register(new E);this.onDidSuspend=this._onDidSuspend.event;this._onDidResume=this._register(new E);this.onDidResume=this._onDidResume.event;this._onDidChangeOnBatteryPower=this._register(new E);this.onDidChangeOnBatteryPower=this._onDidChangeOnBatteryPower.event;this._onDidChangeThermalState=this._register(new E);this.onDidChangeThermalState=this._onDidChangeThermalState.event;this._onDidChangeSpeedLimit=this._register(new E);this.onDidChangeSpeedLimit=this._onDidChangeSpeedLimit.event;this._onWillShutdown=this._register(new E);this.onWillShutdown=this._onWillShutdown.event;this._onDidLockScreen=this._register(new E);this.onDidLockScreen=this._onDidLockScreen.event;this._onDidUnlockScreen=this._register(new E);this.onDidUnlockScreen=this._onDidUnlockScreen.event;this._proxy=e.getProxy(F.MainThreadPower)}$onDidSuspend(){this._onDidSuspend.fire()}$onDidResume(){this._onDidResume.fire()}$onDidChangeOnBatteryPower(e){this._onDidChangeOnBatteryPower.fire(e)}$onDidChangeThermalState(e){this._onDidChangeThermalState.fire(e)}$onDidChangeSpeedLimit(e){this._onDidChangeSpeedLimit.fire(e)}$onWillShutdown(){this._onWillShutdown.fire()}$onDidLockScreen(){this._onDidLockScreen.fire()}$onDidUnlockScreen(){this._onDidUnlockScreen.fire()}getSystemIdleState(e){return this._proxy.$getSystemIdleState(e)}getSystemIdleTime(){return this._proxy.$getSystemIdleTime()}getCurrentThermalState(){return this._proxy.$getCurrentThermalState()}isOnBatteryPower(){return this._proxy.$isOnBatteryPower()}async startPowerSaveBlocker(e){let n=await this._proxy.$startPowerSaveBlocker(e),o=this._proxy,i=n>=0,s=!1;return{id:n,get isStarted(){return i&&!s},dispose:()=>{i&&!s&&(s=!0,o.$stopPowerSaveBlocker(n))}}}};Yg=_([C(0,se)],Yg);var mE=R("IExtHostPower");var _d=class extends JI{constructor(t,e){super(e.logLevel,e.logsLocation,e.loggers.map(n=>ht(n))),this._proxy=t.getProxy(F.MainThreadLogger)}$setLogLevel(t,e){e?this.setLogLevel(b.revive(e),t):this.setLogLevel(t)}setVisibility(t,e){super.setVisibility(t,e),this._proxy.$setVisibility(t,e)}doCreateLogger(t,e,n){return new oL(this._proxy,t,e,n)}};_d=_([C(0,se),C(1,Ye)],_d);var oL=class extends Il{constructor(e,n,o,i){super(i?.logLevel==="always");this.proxy=e;this.file=n;this.isLoggerCreated=!1;this.buffer=[];this.setLevel(o),this.proxy.$createLogger(n,i).then(()=>{this.doLog(this.buffer),this.isLoggerCreated=!0})}log(e,n){let o=[[e,n]];this.isLoggerCreated?this.doLog(o):this.buffer.push(...o)}doLog(e){this.proxy.$log(this.file,e)}flush(){this.proxy.$flush(this.file)}};var Zg=R("IExtHostTerminalShellIntegration"),Xg=class extends O{constructor(e,n){super();this._extHostTerminalService=n;this._activeShellIntegrations=new Map;this._onDidChangeTerminalShellIntegration=this._register(new E);this.onDidChangeTerminalShellIntegration=this._onDidChangeTerminalShellIntegration.event;this._onDidStartTerminalShellExecution=this._register(new E);this.onDidStartTerminalShellExecution=this._onDidStartTerminalShellExecution.event;this._onDidEndTerminalShellExecution=this._register(new E);this.onDidEndTerminalShellExecution=this._onDidEndTerminalShellExecution.event;this._proxy=e.getProxy(F.MainThreadTerminalShellIntegration),this._register(K(()=>{for(let[o,i]of this._activeShellIntegrations)i.dispose();this._activeShellIntegrations.clear()}))}$shellIntegrationChange(e,n){let o=this._extHostTerminalService.getTerminalById(e);if(!o)return;let i=o.value,s=this._activeShellIntegrations.get(e);s||(s=new rL(o.value,n,this._onDidStartTerminalShellExecution),this._activeShellIntegrations.set(e,s),s.store.add(o.onWillDispose(()=>this._activeShellIntegrations.get(e)?.dispose())),s.store.add(s.onDidRequestShellExecution(a=>this._proxy.$executeCommand(e,a))),s.store.add(s.onDidRequestEndExecution(a=>this._onDidEndTerminalShellExecution.fire(a))),s.store.add(s.onDidRequestChangeShellIntegration(a=>this._onDidChangeTerminalShellIntegration.fire(a))),o.shellIntegration=s.value),this._onDidChangeTerminalShellIntegration.fire({terminal:i,shellIntegration:s.value})}$shellExecutionStart(e,n,o,i,s,a){this._activeShellIntegrations.has(e)||this.$shellIntegrationChange(e,n);let l={value:o,confidence:i,isTrusted:s};this._activeShellIntegrations.get(e)?.startShellExecution(l,this._convertCwdToUri(a))}$shellExecutionEnd(e,n,o,i,s){let a={value:n,confidence:o,isTrusted:i};this._activeShellIntegrations.get(e)?.endShellExecution(a,s)}$shellExecutionData(e,n){this._activeShellIntegrations.get(e)?.emitData(n)}$shellEnvChange(e,n,o,i){this._activeShellIntegrations.get(e)?.setEnv(n,o,i)}$cwdChange(e,n){this._activeShellIntegrations.get(e)?.setCwd(this._convertCwdToUri(n))}$closeTerminal(e){this._activeShellIntegrations.get(e)?.dispose(),this._activeShellIntegrations.delete(e)}_convertCwdToUri(e){return e?b.file(e):void 0}};Xg=_([C(0,se),C(1,wo)],Xg);var rL=class extends O{constructor(e,n,o){super();this._terminal=e;this._onDidStartTerminalShellExecution=o;this._pendingExecutions=[];this.store=this._register(new $);this._onDidRequestChangeShellIntegration=this._register(new E);this.onDidRequestChangeShellIntegration=this._onDidRequestChangeShellIntegration.event;this._onDidRequestShellExecution=this._register(new E);this.onDidRequestShellExecution=this._onDidRequestShellExecution.event;this._onDidRequestEndExecution=this._register(new E);this.onDidRequestEndExecution=this._onDidRequestEndExecution.event;this._onDidRequestNewExecution=this._register(new E);this.onDidRequestNewExecution=this._onDidRequestNewExecution.event;let i=this;this.value={get cwd(){return i._cwd},get env(){if(i._env)return Object.freeze({isTrusted:i._env.isTrusted,value:Object.freeze({...i._env.value})})},executeCommand(s,a){if(!n)throw new Error("This terminal does not support the executeCommand API.");let l=s;if(a)for(let u of a)!u.match(/["'`]/)&&u.match(/\s/)?l+=` "${u}"`:l+=` ${u}`;i._onDidRequestShellExecution.fire(l);let d={value:l,confidence:2,isTrusted:!0};return i.requestNewShellExecution(d,i._cwd).value}}}get currentExecution(){return this._currentExecution}requestNewShellExecution(e,n){let o=new fE(e,n??this._cwd);return gE(e.value).length>1&&(this._currentExecutionProperties={isMultiLine:!0,unresolvedCommandLines:gE(e.value)}),this._pendingExecutions.push(o),this._onDidRequestNewExecution.fire(e.value),o}startShellExecution(e,n){if(this._pendingEndingExecution&&(this._onDidRequestEndExecution.fire({terminal:this._terminal,shellIntegration:this.value,execution:this._pendingEndingExecution.value,exitCode:void 0}),this._pendingEndingExecution=void 0),this._currentExecution){if(this._currentExecutionProperties?.isMultiLine&&this._currentExecutionProperties.unresolvedCommandLines){let i=HV(this._currentExecutionProperties.unresolvedCommandLines,e);if(i){this._currentExecutionProperties.unresolvedCommandLines=i.unresolvedCommandLines;return}}this._currentExecution.endExecution(void 0),this._currentExecution.flush(),this._onDidRequestEndExecution.fire({terminal:this._terminal,shellIntegration:this.value,execution:this._currentExecution.value,exitCode:void 0})}let o;if(e.confidence===2)for(let[i,s]of this._pendingExecutions.entries())if(s.value.commandLine.value===e.value){o=s,this._currentExecutionProperties={isMultiLine:!1,unresolvedCommandLines:void 0},o=s,this._pendingExecutions.splice(i,1);break}else{let a=HV(gE(s.value.commandLine.value),e);if(a){this._currentExecutionProperties={isMultiLine:!0,unresolvedCommandLines:a.unresolvedCommandLines},o=s,this._pendingExecutions.splice(i,1);break}}else o=this._pendingExecutions.shift();o||(o=new fE(e,n??this._cwd)),this._currentExecution=o,this._onDidStartTerminalShellExecution.fire({terminal:this._terminal,shellIntegration:this.value,execution:this._currentExecution.value})}emitData(e){this.currentExecution?.emitData(e)}endShellExecution(e,n){if(!(this._currentExecutionProperties?.isMultiLine&&this._currentExecutionProperties.unresolvedCommandLines&&this._currentExecutionProperties.unresolvedCommandLines.length>0)&&this._currentExecution){let o=this._currentExecutionProperties?.isMultiLine?this._currentExecution.value.commandLine:e;this._currentExecution.endExecution(o);let i=this._currentExecution;this._pendingEndingExecution=i,this._currentExecution=void 0,i.flush().then(()=>{this._pendingEndingExecution===i&&(this._onDidRequestEndExecution.fire({terminal:this._terminal,shellIntegration:this.value,execution:i.value,exitCode:n}),this._pendingEndingExecution=void 0)})}}setEnv(e,n,o){let i={};for(let s=0;s<e.length;s++)i[e[s]]=n[s];this._env={value:i,isTrusted:o},this._fireChangeEvent()}setCwd(e){let n=!1;b.isUri(this._cwd)?n=!b.isUri(e)||this._cwd.toString()!==e.toString():this._cwd!==e&&(n=!0),n&&(this._cwd=e,this._fireChangeEvent())}_fireChangeEvent(){this._onDidRequestChangeShellIntegration.fire({terminal:this._terminal,shellIntegration:this.value})}},fE=class{constructor(t,e){this._commandLine=t;this.cwd=e;this._isEnded=!1;let n=this;this.value={get commandLine(){return n._commandLine},get cwd(){return n.cwd},read(){return n._createDataStream()}}}_createDataStream(){if(!this._dataStream){if(this._isEnded)return pp.EMPTY;this._dataStream=new iL}return this._dataStream.createIterable()}emitData(t){this._isEnded||this._dataStream?.emitData(t)}endExecution(t){t&&(this._commandLine=t),this._dataStream?.endExecution(),this._isEnded=!0}async flush(){this._dataStream&&(await this._dataStream.flush(),this._dataStream.dispose(),this._dataStream=void 0)}},iL=class extends O{constructor(){super(...arguments);this._iterables=[];this._emitters=[]}createIterable(){this._barrier||(this._barrier=new In);let e=this._barrier,n=new pp(async o=>{this._emitters.push(o),await e.wait()});return this._iterables.push(n),n}emitData(e){for(let n of this._emitters)n.emitOne(e)}endExecution(){this._barrier?.open()}async flush(){await Promise.all(this._iterables.map(e=>e.toPromise()))}};function gE(r){return r.split(`
`).map(t=>t.trim()).filter(t=>t.length>0)}function HV(r,t){if(r.length===0)return!1;let e=[...r],n=gE(t.value);if(e&&e.length>0){for(;e.length>0&&e[0]===n[0];)e.shift(),n.shift();if(n.length===0)return{unresolvedCommandLines:e}}return!1}var ef=class{constructor(t){this.dataBuffer="";this.eventTypeBuffer="";this.buffer=[];this.endedOnCR=!1;this.onEventHandler=t,this.decoder=new TextDecoder("utf-8")}getLastEventId(){return this.lastEventIdBuffer}getReconnectionTime(){return this.reconnectionTime}feed(t){if(t.length===0)return;let e=0;for(this.endedOnCR&&t[0]===10&&e++,this.endedOnCR=!1;e<t.length;){let n=t.indexOf(13,e),o=t.indexOf(10,e),i=n===-1?o:o===-1?n:Math.min(n,o);if(i===-1)break;let s="";for(let a of this.buffer)s+=this.decoder.decode(a,{stream:!0});s+=this.decoder.decode(t.subarray(e,i)),this.processLine(s),this.buffer.length=0,e=i+(t[i]===13&&t[i+1]===10?2:1)}e<t.length?this.buffer.push(t.subarray(e)):this.endedOnCR=t[t.length-1]===13}processLine(t){if(!t.length){this.dispatchEvent();return}if(t.startsWith(":"))return;let e,n,o=t.indexOf(":");o===-1?(e=t,n=""):(e=t.substring(0,o),n=t.substring(o+1),n.startsWith(" ")&&(n=n.substring(1))),this.processField(e,n)}processField(t,e){switch(t){case"event":this.eventTypeBuffer=e;break;case"data":this.dataBuffer+=e,this.dataBuffer+=`
`;break;case"id":e.includes("\0")?this.currentEventId=void 0:this.currentEventId=this.lastEventIdBuffer=e;break;case"retry":/^\d+$/.test(e)&&(this.reconnectionTime=parseInt(e,10));break}}dispatchEvent(){if(this.dataBuffer===""){this.dataBuffer="",this.eventTypeBuffer="";return}this.dataBuffer.endsWith(`
`)&&(this.dataBuffer=this.dataBuffer.substring(0,this.dataBuffer.length-1));let t={type:this.eventTypeBuffer||"message",data:this.dataBuffer};this.currentEventId!==void 0&&(t.id=this.currentEventId),this.reconnectionTime!==void 0&&(t.retry=this.reconnectionTime),this.onEventHandler(t),this.reset()}reset(){this.dataBuffer="",this.eventTypeBuffer="",this.currentEventId=void 0}};var Ob=class{validateOrThrow(t){let e=this.validate(t);if(e.error)throw new Error(e.error.message);return e.content}},tf=class extends Ob{constructor(e){super();this.type=e}validate(e){return typeof e!==this.type?{content:void 0,error:{message:`Expected ${this.type}, but got ${typeof e}`}}:{content:e,error:void 0}}getJSONSchema(){return{type:this.type}}},DK=new tf("string");function Ub(){return DK}var RK=new tf("number");function WV(){return RK}var Q$e=new tf("boolean");var AK=new tf("object");function hE(){return AK}var Nb=class{constructor(t){this.validator=t}};function wu(r){return new Nb(r)}var sL=class extends Ob{constructor(e){super();this.properties=e}validate(e){if(typeof e!="object"||e===null)return{content:void 0,error:{message:"Expected object"}};let n={};for(let o in this.properties){let i=this.properties[o],s=e[o],a=i instanceof Nb,l=a?i.validator:i;if(a&&s===void 0)continue;let{content:d,error:c}=l.validate(s);if(c)return{content:void 0,error:{message:`Error in property '${o}': ${c.message}`}};n[o]=d}return{content:n,error:void 0}}getJSONSchema(){let e=[],n={};for(let[i,s]of Object.entries(this.properties)){let a=s instanceof Nb,l=a?s.validator:s;n[i]=l.getJSONSchema(),a||e.push(i)}return{type:"object",properties:n,...e.length>0?{required:e}:{}}}};function Fb(r){return new sL(r)}var aL=class extends Ob{constructor(e){super();this.validator=e}validate(e){if(!Array.isArray(e))return{content:void 0,error:{message:"Expected array"}};let n=[];for(let o=0;o<e.length;o++){let{content:i,error:s}=this.validator.validate(e[o]);if(s)return{content:void 0,error:{message:`Error in element ${o}: ${s.message}`}};n.push(i)}return{content:n,error:void 0}}getJSONSchema(){return{type:"array",items:this.validator.getJSONSchema()}}};function lL(r){return new aL(r)}var ku=R("IExtHostMpcService"),MK=Fb({label:Ub(),version:wu(Ub()),metadata:wu(Fb({capabilities:wu(hE()),serverInfo:wu(hE()),tools:wu(lL(Fb({availability:WV(),definition:hE()})))})),authentication:wu(Fb({providerId:Ub(),scopes:lL(Ub())}))}),Dd=class extends O{constructor(e,n,o,i,s){super();this._logService=n;this._extHostInitData=o;this._workspaceService=i;this._variableResolver=s;this._initialProviderPromises=new Set;this._sseEventSources=this._register(new Fn);this._unresolvedMcpServers=new Map;this._onDidChangeMcpServerDefinitions=this._register(new E);this.onDidChangeMcpServerDefinitions=this._onDidChangeMcpServerDefinitions.event;this._mcpServerDefinitions=[];this._activeGateways=new Map;this._proxy=e.getProxy(F.MainThreadMcp)}get mcpServerDefinitions(){return this._mcpServerDefinitions}$onDidChangeMcpServerDefinitions(e){this._mcpServerDefinitions=e.map(n=>Ym.to(n)),this._onDidChangeMcpServerDefinitions.fire()}$startMcp(e,n){this._startMcp(e,Rc.fromSerialized(n.launch),n.defaultCwd&&b.revive(n.defaultCwd),n.errorOnUserInteraction)}_startMcp(e,n,o,i){if(n.type===2){this._sseEventSources.set(e,new Hb(e,n,this._proxy,this._logService,i));return}throw new Error("not implemented")}async $substituteVariables(e,n){let o=b.revive(e),i=o&&await this._workspaceService.resolveWorkspaceFolder(o);return(await this._variableResolver.getResolver()).resolveAsync(i&&{uri:i.uri,name:i.name,index:i.index},n)}$stopMcp(e){this._sseEventSources.get(e)?.close().then(()=>this._didClose(e))}_didClose(e){this._sseEventSources.deleteAndDispose(e)}$sendMessage(e,n){this._sseEventSources.get(e)?.send(n)}async $waitForInitialCollectionProviders(){await Promise.all(this._initialProviderPromises)}async $resolveMcpLaunch(e,n){let o=this._unresolvedMcpServers.get(e);if(!o)return;let i=o.servers.find(a=>a.label===n);if(!i)return;if(!o.provider.resolveMcpServerDefinition)return Ym.from(i);let s=await o.provider.resolveMcpServerDefinition(i,ve.None);return s?Ym.from(s):void 0}registerMcpConfigurationProvider(e,n,o){let i=new $,s=e.contributes?.mcpServerDefinitionProviders?.find(c=>c.id===n);if(!s)throw new Error(`MCP configuration providers must be registered in the contributes.mcpServerDefinitionProviders array within your package.json, but "${n}" was not`);let a={id:AW(e.identifier,n),isTrustedByDefault:!0,label:s?.label??e.displayName??e.name,scope:1,canResolveLaunch:typeof o.resolveMcpServerDefinition=="function",extensionId:e.identifier.value,configTarget:this._extHostInitData.remote.isRemote?4:2},l=async()=>{let c=await o.provideMcpServerDefinitions(ve.None);this._unresolvedMcpServers.set(a.id,{servers:c??[],provider:o});let u=[];for(let m of c??[]){let g=Ee.toKey(e.identifier)+"/"+m.label;if(u.some(I=>I.id===g)){let I=2;for(;u.some(S=>S.id===g+I);)I++;g=g+I}MK.validateOrThrow(m),m.authentication&&A(e,"mcpToolDefinitions");let h,f=m;He(e,"mcpToolDefinitions")&&f.metadata&&(h={capabilities:f.metadata.capabilities,instructions:f.metadata.instructions,serverInfo:f.metadata.serverInfo,tools:f.metadata.tools?.map(I=>({availability:I.availability===1?1:0,definition:I.definition}))}),u.push({id:g,label:m.label,cacheNonce:m.version||"$$NONE",staticMetadata:h,launch:Ym.from(m)})}this._proxy.$upsertMcpCollection(a,u)};i.add(K(()=>{this._unresolvedMcpServers.delete(a.id),this._proxy.$deleteMcpCollection(a.id)})),o.onDidChangeMcpServerDefinitions&&i.add(o.onDidChangeMcpServerDefinitions(l)),o.onDidChangeServerDefinitions&&i.add(o.onDidChangeServerDefinitions(l)),o.onDidChange&&i.add(o.onDidChange(l));let d=new Promise(c=>{setTimeout(()=>l().finally(()=>{this._initialProviderPromises.delete(d),c()}),0)});return this._initialProviderPromises.add(d),i}async startMcpGateway(){let e=await this._proxy.$startMcpGateway();if(!e)return;let n=e.gatewayId,o=e.servers.map(s=>({label:s.label,address:b.revive(s.address)})),i=new E;return this._activeGateways.set(n,{servers:o,onDidChangeServers:i}),{get servers(){return o},onDidChangeServers:i.event,dispose:()=>{this._activeGateways.delete(n),i.dispose(),this._proxy.$disposeMcpGateway(n)}}}$onDidChangeGatewayServers(e,n){let o=this._activeGateways.get(e);if(!o)return;let i=n.map(s=>({label:s.label,address:b.revive(s.address)}));o.servers.length=0,o.servers.push(...i),o.onDidChangeServers.fire(i)}};Dd=_([C(0,se),C(1,oe),C(2,Ye),C(3,On),C(4,Wr)],Dd);var LK=5,OK=[301,302,303,307,308],Hb=class extends O{constructor(e,n,o,i,s){super();this._id=e;this._launch=n;this._proxy=o;this._logService=i;this._errorOnUserInteraction=s;this._requestSequencer=new CI;this._postEndpoint=new Jt;this._mode={value:0};this._cts=new Ce;this._abortCtrl=new AbortController;this._didSendClose=!1;this._register(K(()=>{this._abortCtrl.abort(),this._cts.dispose(!0)})),this._proxy.$onDidChangeState(this._id,{state:So.Kind.Running})}async send(e){try{this._mode.value===0?await this._requestSequencer.queue(()=>this._send(e)):await this._send(e)}catch(n){let o=`Error sending message to ${this._launch.uri}: ${String(n)}`;this._proxy.$onDidChangeState(this._id,{state:So.Kind.Error,message:o})}}async close(){if(this._mode.value===1&&this._mode.sessionId&&!this._didSendClose){this._didSendClose=!0;try{await this._closeSession(this._mode.sessionId)}catch{}}this._proxy.$onDidChangeState(this._id,{state:So.Kind.Stopped})}async _closeSession(e){let n={...Object.fromEntries(this._launch.headers),"Mcp-Session-Id":e};try{await this._addAuthHeader(n,{errorOnUserInteraction:!0})}catch{this._log(2,"Skipping session close: authentication no longer available");return}await this._fetch(this._launch.uri.toString(!0),{method:"DELETE",headers:n})}_send(e){return this._mode.value===2?this._sendLegacySSE(this._mode.endpoint,e):this._sendStreamableHttp(e,this._mode.value===1?this._mode.sessionId:void 0)}async _sendStreamableHttp(e,n){let o=new TextEncoder().encode(e),i={...Object.fromEntries(this._launch.headers),"Content-Type":"application/json","Content-Length":String(o.length),Accept:"text/event-stream, application/json"};n&&(i["Mcp-Session-Id"]=n),await this._addAuthHeader(i);let s=await this._fetchWithAuthRetry(this._launch.uri.toString(!0),{method:"POST",headers:i,body:o},i),a=this._mode.value===0,l=s.headers.get("Mcp-Session-Id");if(l&&(this._mode={value:1,sessionId:l}),this._mode.value===0&&s.status>=400&&s.status<500&&!dL(s.status)){this._log(3,`${s.status} status sending message to ${this._launch.uri}, will attempt to fall back to legacy SSE`),this._sseFallbackWithMessage(e);return}if(s.status>=300){let d=this._mode.value===1&&!!this._mode.sessionId&&(s.status===400||s.status===404);this._proxy.$onDidChangeState(this._id,{state:So.Kind.Error,message:`${s.status} status sending message to ${this._launch.uri}: ${await this._getErrText(s)}`+(d?"; will retry with new session ID":""),shouldRetry:d});return}this._mode.value===0&&(this._mode={value:1,sessionId:void 0}),a&&this._attachStreamableBackchannel(),await this._handleSuccessfulStreamableHttp(s,e)}async _sseFallbackWithMessage(e){let n=await this._attachSSE();n&&(this._mode={value:2,endpoint:n},await this._sendLegacySSE(n,e))}async _handleSuccessfulStreamableHttp(e,n){if(e.status===202)return;let o=e.headers.get("Content-Type")?.toLowerCase()||"";if(o.startsWith("text/event-stream")){let i=new ef(s=>{if(s.type==="message")this._proxy.$onDidReceiveMessage(this._id,s.data);else if(s.type==="endpoint")throw this._log(4,`Received SSE endpoint from a POST to ${this._launch.uri}, will fall back to legacy SSE`),this._sseFallbackWithMessage(n),new Be});try{await this._doSSE(i,e)}catch(s){this._log(4,`Error reading SSE stream: ${String(s)}`)}}else if(o.startsWith("application/json"))this._proxy.$onDidReceiveMessage(this._id,await e.text());else{let i=await e.text();NK(i)?this._proxy.$onDidReceiveMessage(this._id,i):this._log(4,`Unexpected ${e.status} response for request: ${i}`)}}async _attachStreamableBackchannel(){let e,n;for(let o=0;!this._store.isDisposed;o++){n!==void 0?(await Ut(Math.max(0,n-Date.now()),this._cts.token),n=void 0):await Ut(Math.min(o*1e3,3e4),this._cts.token);let i;try{let a={...Object.fromEntries(this._launch.headers),Accept:"text/event-stream"};await this._addAuthHeader(a),this._mode.value===1&&this._mode.sessionId!==void 0&&(a["Mcp-Session-Id"]=this._mode.sessionId),e&&(a["Last-Event-ID"]=e),i=await this._fetchWithAuthRetry(this._launch.uri.toString(!0),{method:"GET",headers:a},a)}catch{this._log(3,`Error connecting to ${this._launch.uri} for async notifications, will retry`);continue}if(i.status>=400){this._log(2,`${i.status} status connecting to ${this._launch.uri} for async notifications; they will be disabled: ${await this._getErrText(i)}`);return}i.headers.get("content-type")?.toLowerCase().includes("text/event-stream")&&(o=0);let s=new ef(a=>{a.retry&&(n=Date.now()+a.retry),a.type==="message"&&a.data&&this._proxy.$onDidReceiveMessage(this._id,a.data),a.id&&(e=a.id)});try{await this._doSSE(s,i)}catch(a){this._log(3,`Error reading from async stream, we will reconnect: ${a}`)}}}async _attachSSE(){let e=new Jt,n={...Object.fromEntries(this._launch.headers),Accept:"text/event-stream"};await this._addAuthHeader(n);let o;try{if(o=await this._fetchWithAuthRetry(this._launch.uri.toString(!0),{method:"GET",headers:n},n),o.status>=300){this._proxy.$onDidChangeState(this._id,{state:So.Kind.Error,message:`${o.status} status connecting to ${this._launch.uri} as SSE: ${await this._getErrText(o)}`});return}}catch(s){this._proxy.$onDidChangeState(this._id,{state:So.Kind.Error,message:`Error connecting to ${this._launch.uri} as SSE: ${s}`});return}let i=new ef(s=>{s.type==="message"?this._proxy.$onDidReceiveMessage(this._id,s.data):s.type==="endpoint"&&e.complete(new URL(s.data,this._launch.uri.toString(!0)).toString())});return this._register(K(()=>e.cancel())),this._doSSE(i,o).catch(s=>{this._proxy.$onDidChangeState(this._id,{state:So.Kind.Error,message:`Error reading SSE stream: ${String(s)}`})}),e.p}async _sendLegacySSE(e,n){let o=new TextEncoder().encode(n),i={...Object.fromEntries(this._launch.headers),"Content-Type":"application/json","Content-Length":String(o.length)};await this._addAuthHeader(i);let s=await this._fetch(e,{method:"POST",headers:i,body:o});s.status>=300&&this._log(4,`${s.status} status sending message to ${this._postEndpoint}: ${await this._getErrText(s)}`)}async _doSSE(e,n){if(!n.body)return;let o=n.body.getReader(),i;do{try{i=await ml(o.read(),this._cts.token)}catch(s){if(o.cancel(),this._store.isDisposed)return;throw s}i.value&&e.feed(i.value)}while(!i.done)}async _addAuthHeader(e,n){let o=n?.errorOnUserInteraction??this._errorOnUserInteraction;if(this._authMetadata)try{let i={authorizationServer:this._authMetadata.authorizationServer.toJSON(),authorizationServerMetadata:this._authMetadata.serverMetadata,resourceMetadata:this._authMetadata.resourceMetadata,scopes:this._authMetadata.scopes},s=await this._proxy.$getTokenFromServerMetadata(this._id,i,{errorOnUserInteraction:o,forceNewRegistration:n?.forceNewRegistration});s&&(e.Authorization=`Bearer ${s}`)}catch(i){if(Av.is(i))throw this._proxy.$onDidChangeState(this._id,{state:So.Kind.Stopped,reason:"needs-user-interaction"}),new Be;this._log(4,`Error getting token from server metadata: ${String(i)}`)}if(this._launch.authentication)try{this._log(2,`Using provided authentication config: providerId=${this._launch.authentication.providerId}, scopes=${this._launch.authentication.scopes.join(", ")}`);let i=await this._proxy.$getTokenForProviderId(this._id,this._launch.authentication.providerId,this._launch.authentication.scopes,{errorOnUserInteraction:o,forceNewRegistration:n?.forceNewRegistration});i&&(e.Authorization=`Bearer ${i}`,this._log(3,"Successfully obtained token from provided authentication config"))}catch(i){if(Av.is(i))throw this._proxy.$onDidChangeState(this._id,{state:So.Kind.Stopped,reason:"needs-user-interaction"}),new Be;this._log(4,`Error getting token from provided authentication config: ${String(i)}`)}return e}_log(e,n){this._store.isDisposed||this._proxy.$onDidPublishLog(this._id,e,n)}async _getErrText(e){try{return await e.text()}catch{return e.statusText}}async _fetchWithAuthRetry(e,n,o){let i=()=>this._fetch(e,n),s=await i();if(dL(s.status)&&(this._authMetadata?this._authMetadata.update(s.headers)&&(await this._addAuthHeader(o),o.Authorization&&(n.headers=o,s=await i())):(this._authMetadata=await UK(e,s.headers,{sameOriginHeaders:{...Object.fromEntries(this._launch.headers),"MCP-Protocol-Version":Rv.LATEST_PROTOCOL_VERSION},fetch:(a,l)=>this._fetch(a,l),log:(a,l)=>this._log(a,l)}),this._proxy.$logMcpAuthSetup(this._authMetadata.telemetry),await this._addAuthHeader(o),o.Authorization&&(n.headers=o,s=await i()))),o.Authorization&&dL(s.status)){let a=await this._getErrText(s);this._log(3,`Received ${s.status} status with Authorization header, retrying with new auth registration. Error details: ${a||"no additional details"}`),await this._addAuthHeader(o,{forceNewRegistration:!0}),s=await i()}return s}async _fetch(e,n){if(n.headers["user-agent"]=`${Yo.nameLong}/${Yo.version}`,YI(this._logService.getLevel(),1)){let s={...n,headers:{...n.headers}};s.body&&(s.body=new TextDecoder().decode(s.body)),s.headers?.Authorization&&(s.headers.Authorization="***"),this._log(1,`Fetching ${e} with options: ${JSON.stringify(s)}`)}let o=e,i;for(let s=0;s<LK&&(i=await this._fetchInternal(o,{...n,signal:this._abortCtrl.signal,redirect:"manual"}),!!OK.includes(i.status));s++){let a=i.headers.get("location");if(!a)break;let l=new URL(a,o).toString();this._log(1,`Redirect (${i.status}) from ${o} to ${l}`),o=l,(i.status===303||(i.status===301||i.status===302)&&n.method==="POST")&&(n.method="GET",delete n.body)}if(YI(this._logService.getLevel(),1)){let s={};i.headers.forEach((a,l)=>{s[l]=a}),this._log(1,`Fetched ${o}: ${JSON.stringify({status:i.status,headers:s})}`)}return i}_fetchInternal(e,n){return fetch(e,n)}};function NK(r){try{return JSON.parse(r),!0}catch{return!1}}function dL(r){return r===401||r===403}var vE=class{constructor(t,e,n,o,i,s){this.authorizationServer=t;this.serverMetadata=e;this.resourceMetadata=n;this.telemetry=i;this._log=s;this._scopes=o}get scopes(){return this._scopes}update(t){let e=this._parseScopesFromResponse(t);return nV(e,this._scopes)?!1:(this._log(3,`Scopes changed from ${JSON.stringify(this._scopes)} to ${JSON.stringify(e)}, updating`),this._scopes=e,!0)}_parseScopesFromResponse(t){let e=t.get("WWW-Authenticate");if(!e)return;let n=n0(e);for(let o of n)if(o.scheme==="Bearer"&&o.params.scope){let i=o.params.scope.split(zT).filter(s=>s.trim().length);if(i.length)return this._log(3,`Found scope challenge in WWW-Authenticate header: ${o.params.scope}`),i}}};async function UK(r,t,e){let{sameOriginHeaders:n,fetch:o,log:i}=e,s="none",a,{resourceMetadataChallenge:l,scopesChallenge:d}=FK(t.get("WWW-Authenticate")??void 0,i),c,u,m=d;try{let{metadata:I,discoveryUrl:S,errors:T}=await oV(r,l,{sameOriginHeaders:n,fetch:(P,L)=>o(P,L)});for(let P of T)i(4,`Error fetching resource metadata: ${P}`);i(3,`Discovered resource metadata at ${S}`),s=l?"header":"wellKnown",c=I.authorization_servers?.[0],c?(i(3,`Using auth server metadata url: ${c}`),a="resourceMetadata"):i(4,`No authorization_servers found in resource metadata ${S} - Is this resource metadata configured correctly?`),m??=I.scopes_supported,u=I}catch(I){i(4,`Could not fetch resource metadata: ${String(I)}`)}let g=new URL(r).origin,h={};c||(c=g,n&&(h=n));try{i(2,`Fetching auth server metadata for: ${c} ...`);let{metadata:I,discoveryUrl:S,errors:T}=await rV(c,{additionalHeaders:h,fetch:(P,L)=>o(P,L)});for(let P of T)i(4,`Error fetching authorization server metadata: ${P}`);return i(3,`Discovered authorization server metadata at ${S}`),a??="wellKnown",new vE(b.parse(c),I,u,m,{resourceMetadataSource:s,serverMetadataSource:a},i)}catch(I){i(4,`Error populating auth server metadata for ${c}: ${String(I)}`)}let f=tV(new URL(g));return i(3,"Using default auth metadata"),new vE(b.parse(g),f,u,m,{resourceMetadataSource:s,serverMetadataSource:"default"},i)}function FK(r,t){if(!r)return{};let e,n,o=n0(r);for(let i of o)if(i.scheme==="Bearer"){if(!e&&i.params.resource_metadata&&(e=i.params.resource_metadata,t(2,`Found resource_metadata challenge in WWW-Authenticate header: ${e}`)),!n&&i.params.scope){let s=i.params.scope.split(zT).filter(a=>a.trim().length);s.length&&(t(2,`Found scope challenge in WWW-Authenticate header: ${i.params.scope}`),n=s)}if(e&&n)break}return{resourceMetadataChallenge:e,scopesChallenge:n}}var yE=R("IExtHostDataChannels"),bE=class{constructor(){this._channels=new Map}createDataChannel(t,e){A(t,"dataChannels");let n=this._channels.get(e);return n||(n=new cL(e),this._channels.set(e,n)),n}$onDidReceiveData(t,e){let n=this._channels.get(t);n&&n._fireDidReceiveData(e)}},cL=class extends O{constructor(e){super();this.channelId=e;this._onDidReceiveData=new E;this.onDidReceiveData=this._onDidReceiveData.event;this._register(this._onDidReceiveData)}_fireDidReceiveData(e){this._onDidReceiveData.fire({data:e})}toString(){return`DataChannel(${this.channelId})`}};var xE=R("IExtHostMeteredConnection"),IE=class extends O{constructor(){super();this._isConnectionMetered=!1;this._onDidChangeIsConnectionMetered=this._register(new E);this.onDidChangeIsConnectionMetered=this._onDidChangeIsConnectionMetered.event}get isConnectionMetered(){return this._isConnectionMetered}$initializeIsConnectionMetered(e){this._isConnectionMetered=e}$onDidChangeIsConnectionMetered(e){this._isConnectionMetered!==e&&(this._isConnectionMetered=e,this._onDidChangeIsConnectionMetered.fire(e))}};var SE="vscode.git";function VV(r){switch(r){case 0:return 0;case 1:return 1;case 2:return 2;default:throw new Error(`Unknown GitRefType: ${r}`)}}function HK(r){return{name:r.name,commit:r.commit,type:VV(r.type),remote:r.remote,base:r.base,upstream:r.upstream?WK(r.upstream):void 0,ahead:r.ahead,behind:r.behind}}function WK(r){return{remote:r.remote,name:r.name,commit:r.commit}}function nf(r){switch(r.status){case 1:case 7:case 9:return{uri:r.uri,originalUri:void 0,modifiedUri:r.uri};case 2:case 6:return{uri:r.uri,originalUri:r.uri,modifiedUri:void 0};case 3:case 10:return{uri:r.uri,originalUri:r.originalUri,modifiedUri:r.renameUri};default:return{uri:r.uri,originalUri:r.originalUri,modifiedUri:r.uri}}}var CE=R("IExtHostGitExtensionService"),Rd=class extends O{constructor(e,n){super();this._extHostExtensionService=n;this._repositories=new Map;this._repositoryByUri=new Ke;this._disposables=this._register(new $);this._proxy=e.getProxy(F.MainThreadGitExtension)}static{this._handlePool=0}async $isGitExtensionAvailable(){return!!(await this._extHostExtensionService.getExtensionRegistry()).getExtensionDescription(SE)}async $openRepository(e){let n=await this._ensureGitApi();if(!n)return;let o=await n.openRepository(b.revive(e));if(!o)return;let i=this._repositoryByUri.get(o.rootUri);if(i!==void 0){let d=await this._getRepositoryState(o);return{handle:i,rootUri:o.rootUri,state:d}}let s=o.state;s.HEAD===void 0&&(await he.toPromise(s.onDidChange,this._disposables),s=o.state);let a=Rd._handlePool++;this._repositories.set(a,o),this._repositoryByUri.set(o.rootUri,a),this._disposables.add(o.state.onDidChange(()=>{this._proxy.$onDidChangeRepository(a)}));let l=await this._getRepositoryState(o);return{handle:a,rootUri:o.rootUri,state:l}}async $getRefs(e,n,o){let i=this._repositories.get(e);if(!i)return[];try{return(await i.getRefs(n,o)).map(l=>!l.name||!l.commit?void 0:{id:l.type===0?`refs/heads/${l.name}`:l.type===1?`refs/remotes/${l.remote}/${l.name}`:`refs/tags/${l.name}`,name:l.name,type:VV(l.type),revision:l.commit}).filter(l=>!!l)}catch{return[]}}async $getRepositoryState(e){let n=this._repositories.get(e);if(n)return this._getRepositoryState(n)}async _getRepositoryState(e){let n=e.state,o=await this._getBranchBase(e);return{HEAD:n.HEAD?HK({...n.HEAD,base:o}):void 0,mergeChanges:n.mergeChanges.map(nf),indexChanges:n.indexChanges.map(nf),workingTreeChanges:n.workingTreeChanges.map(nf),untrackedChanges:n.untrackedChanges.map(nf)}}async _getBranchBase(e){let n=e.state;if(!n.HEAD?.name)return;let o=await e.getBranchBase(n.HEAD.name);if(!o?.name)return;let i=e.isBranchProtected(o);return{name:o.name,isProtected:i}}async $diffBetweenWithStats(e,n,o,i){let s=this._repositories.get(e);if(!s)return[];try{return(await s.diffBetweenWithStats(n,o,i)).map(l=>({...nf(l),insertions:l.insertions,deletions:l.deletions}))}catch{return[]}}async $diffBetweenWithStats2(e,n,o){let i=this._repositories.get(e);if(!i)return[];try{return(await i.diffBetweenWithStats2(n,o)).map(a=>({...nf(a),insertions:a.insertions,deletions:a.deletions}))}catch{return[]}}async _ensureGitApi(){if(this._gitApi)return this._gitApi;try{await this._extHostExtensionService.activateByIdWithErrors(new Ee(SE),{startup:!1,extensionId:new Ee(SE),activationEvent:"api"});let e=this._extHostExtensionService.getExtensionExports(new Ee(SE));e&&typeof e.getAPI=="function"&&(this._gitApi=e.getAPI(1))}catch{}return this._gitApi}dispose(){this._disposables.dispose(),super.dispose()}};Rd=_([C(0,se),C(1,go)],Rd);qe(Ag,Rg,1);qe(Xo,_d,1);qe(Wi,Ng,1);qe(Nn,yg,0);qe(Iu,xg,0);qe(Tg,Cd,0);qe(Sn,ig,0);qe(Hs,or,0);qe(za,qg,0);qe(jg,Kg,0);qe(ZT,Vs,0);qe(Hr,Hg,0);qe(Lg,Mg,0);qe(Gr,lx,0);qe(XT,Fg,1);qe(Jg,Pd,0);qe(cg,dg,0);qe(Bg,Vg,0);qe(wo,Ig,0);qe(Zg,Xg,0);qe(bd,vd,0);qe(bu,xd,0);qe(mE,Yg,0);qe(yu,Sd,0);qe(On,ng,0);qe(Dg,_g,0);qe(Bi,zg,0);qe(Wr,kd,0);qe(ku,Dd,0);qe(yE,bE,0);qe(xE,IE,0);qe(CE,Rd,1);var of=class extends hu{constructor(t,e){super(!0,t,e)}createTerminal(t,e,n){return this.createTerminalFromOptions({name:t,shellPath:e,shellArgs:n})}createTerminalFromOptions(t,e){let n=new vu(this._proxy,Ae(),t,t.name);return this._terminals.push(n),n.create(t,this._serializeParentTerminal(t,e)),n.value}};of=_([C(0,Nn),C(1,se)],of);import*as uL from"child_process";import{promises as zV}from"fs";function BV(r,...t){let e=t.reduce((i,s)=>(i[s]=!0,i),{}),n=[/^ELECTRON_.+$/,/^VSCODE_(?!(PORTABLE|SHELL_LOGIN|ENV_REPLACE|ENV_APPEND|ENV_PREPEND)).+$/,/^SNAP(|_.*)$/,/^GDK_PIXBUF_.+$/];Object.keys(r).filter(i=>!e[i]).forEach(i=>{for(let s=0;s<n.length;s++)if(i.search(n[s])!==-1){delete r[i];break}})}function $V(r){r&&(delete r.DEBUG,Qe&&delete r.LD_PRELOAD)}function TE(r=Do){return r.comspec||"cmd.exe"}function qV(r){let t=[],e=!1,n=function(o){if(e){t.push(o);return}(!r.send(o,s=>{if(s&&console.error(s),e=!1,t.length>0){let a=t.slice(0);t=[],a.forEach(l=>n(l))}})||Ie)&&(e=!0)};return{send:n}}async function VK(r){if(await st.exists(r)){let t;try{t=await zV.stat(r)}catch(e){e.message.startsWith("EACCES")&&(t=await zV.lstat(r))}return t?!t.isDirectory():!1}return!1}async function Pu(r,t,e,n=Do,o=VK){if(En(r))return await o(r)?r:void 0;if(t===void 0&&(t=mi()),cn(r)!=="."){let l=Ne(t,r);return await o(l)?l:void 0}let s=X_(n,"PATH");if(e===void 0&&De(s)&&(e=s.split(sp)),e===void 0||e.length===0){let l=Ne(t,r);return await o(l)?l:void 0}for(let l of e){let d;if(En(l)?d=Ne(l,r):d=Ne(t,l,r),Ie){let u=(X_(n,"PATHEXT")||".COM;.EXE;.BAT;.CMD").split(";").map(async m=>{let g=d+m;return await o(g)?g:void 0});for(let m of u){let g=await m;if(g)return g}}if(await o(d))return d}let a=Ne(t,r);return await o(a)?a:void 0}async function Wb(r,t=!1){let e;if(Ie){let n=process.env.WINDIR||"C:\\Windows",o=Ne(n,"System32","taskkill.exe"),i=["/T"];t&&i.push("/F"),i.push("/PID",String(r)),e=uL.spawn(o,i,{stdio:["ignore","pipe","pipe"]})}else{let n=ul.asFileUri("vs/base/node/terminateProcess.sh").fsPath;e=uL.spawn("/bin/sh",[n,String(r),t?"9":"15"],{stdio:["ignore","pipe","pipe"]})}return new Promise((n,o)=>{let i=[];e.stdout.on("data",s=>i.push(s)),e.stderr.on("data",s=>i.push(s)),e.on("error",o),e.on("exit",s=>{s===0?n():o(new Error(`taskkill exited with code ${s}: ${Buffer.concat(i).toString()}`))})})}import{homedir as BK}from"os";var rf=class extends Cu{constructor(e,n,o,i,s,a,l,d,c){super(e,n,o,i,s,a,l,d);this.workspaceService=o;this.variableResolver=c;n.remote.isRemote&&n.remote.authority?this.registerTaskSystem(V.vscodeRemote,{scheme:V.vscodeRemote,authority:n.remote.authority,platform:process.platform}):this.registerTaskSystem(V.file,{scheme:V.file,authority:"",platform:process.platform}),this._proxy.$registerSupportedExecutions(!0,!0,!0)}async executeTask(e,n){let o=n;if(!n.execution&&o._id===void 0)throw new Error("Tasks to execute must include an execution");if(o._id!==void 0){let i=H0.from(o,this.workspaceService),s=await this._proxy.$getTaskExecution(i);if(s.task===void 0)throw new Error("Task from execution DTO is undefined");let a=await this.getTaskExecution(s,n);return this._proxy.$executeTask(i).catch(()=>{}),a}else{let i=Bs.from(n,e);if(i===void 0)return Promise.reject(new Error("Task is not valid"));Vi.is(i.execution)&&await this.addCustomExecution(i,n,!1);let s=await this.getTaskExecution(await this._proxy.$getTaskExecution(i),n);return this._proxy.$executeTask(i).catch(()=>{}),s}}provideTasksInternal(e,n,o,i){let s=[];if(i)for(let a of i){this.checkDeprecation(a,o),(!a.definition||!e[a.definition.type])&&this._logService.warn(`The task [${a.source}, ${a.name}] uses an undefined task type. The task will be ignored in the future.`);let l=Bs.from(a,o.extension);l&&(s.push(l),Vi.is(l.execution)&&n.push(this.addCustomExecution(l,a,!0)))}return{tasks:s,extension:o.extension}}async resolveTaskInternal(e){return e}async getAFolder(e){let n=e&&e.length>0?e[0]:void 0;if(!n){let o=b.file(BK());n=new hc({uri:o,name:Tt(o),index:0})}return{uri:n.uri,name:n.name,index:n.index,toResource:()=>{throw new Error("Not implemented")}}}async $resolveVariables(e,n){let o=b.revive(e),i={process:void 0,variables:Object.create(null)},s=await this._workspaceProvider.resolveWorkspaceFolder(o),a=await this._workspaceProvider.getWorkspaceFolders2()??[],l=await this.variableResolver.getResolver(),d=s?{uri:s.uri,name:s.name,index:s.index,toResource:()=>{throw new Error("Not implemented")}}:await this.getAFolder(a);for(let c of n.variables)i.variables[c]=await l.resolveAsync(d,c);if(n.process!==void 0){let c;if(n.process.path!==void 0){c=n.process.path.split(sp);for(let h=0;h<c.length;h++)c[h]=await l.resolveAsync(d,c[h])}let u=await l.resolveAsync(d,n.process.name),m=n.process.cwd!==void 0?await l.resolveAsync(d,n.process.cwd):void 0,g=await Pu(u,m,c);g?i.process=g:En(u)?i.process=u:i.process=Ne(m??"",u)}return i}async $jsonTasksSupported(){return!0}async $findExecutable(e,n,o){return Pu(e,n,o)}};rf=_([C(0,se),C(1,Ye),C(2,On),C(3,Hr),C(4,Sn),C(5,wo),C(6,oe),C(7,Wi),C(8,Wr)],rf);import*as Ad from"child_process";var q9e=R("externalTerminal"),sf="Terminal.app";var jV=p(2118,null),Vb=class{async getDefaultTerminalForPlatforms(){return{windows:Bb.getDefaultTerminalWindows(),linux:await $b.getDefaultTerminalLinuxReady(),osx:sf}}},$i=class $i extends Vb{static{this.CMD="cmd.exe"}openTerminal(t,e){return this.spawnTerminal(Ad,t,TE(),e)}spawnTerminal(t,e,n,o){let i=e.windowsExec||$i.getDefaultTerminalWindows();o&&o[1]===":"&&(o=o[0].toUpperCase()+o.substr(1));let s=nt(i,".exe").toLowerCase();if(s==="cmder")return t.spawn(i,o?[o]:void 0),Promise.resolve(void 0);let a=["/c","start","/wait"];return i.indexOf(" ")>=0&&a.push(i),a.push(i),s==="wt"&&a.push("-d ."),new Promise((l,d)=>{let c=_u(process),u=t.spawn(n,a,{cwd:o,env:c,detached:!0});u.on("error",d),u.on("exit",()=>l())})}async runInTerminal(t,e,n,o,i){let s=i.windowsExec||$i.getDefaultTerminalWindows(),a=await $i.getWtExePath();return new Promise((l,d)=>{let c=`"${e} - ${jV}"`,u=`"${n.join('" "')}" & pause`,m=Object.assign({},_u(process),o);Object.keys(m).filter(S=>m[S]===null).forEach(S=>delete m[S]);let g={cwd:e,env:m,windowsVerbatimArguments:!0},h,f;nt(s,".exe")==="wt"?(h=s,f=["-d",".",$i.CMD,"/c",u]):a?(h=a,f=["-d",".",s,"/c",u]):(h=$i.CMD,f=["/c","start",c,"/wait",s,"/c",`"${u}"`]),Ad.spawn(h,f,g).on("error",S=>{d(GV(S))}),l(void 0)})}static getDefaultTerminalWindows(){if(!$i._DEFAULT_TERMINAL_WINDOWS){let t=!!process.env.hasOwnProperty("PROCESSOR_ARCHITEW6432");$i._DEFAULT_TERMINAL_WINDOWS=`${process.env.windir?process.env.windir:"C:\\Windows"}\\${t?"Sysnative":"System32"}\\cmd.exe`}return $i._DEFAULT_TERMINAL_WINDOWS}static async getWtExePath(){try{return await Pu("wt")}catch{return}}};_([RI],$i,"getWtExePath",1);var Bb=$i,EE=class r extends Vb{static{this.OSASCRIPT="/usr/bin/osascript"}openTerminal(t,e){return this.spawnTerminal(Ad,t,e)}runInTerminal(t,e,n,o,i){let s=i.osxExec||sf;return new Promise((a,l)=>{if(s===sf||s==="iTerm.app"){let d=s===sf?"TerminalHelper":"iTermHelper",u=[ul.asFileUri(`vs/workbench/contrib/externalTerminal/node/${d}.scpt`).fsPath,"-t",t||jV,"-w",e];for(let g of n)u.push("-a"),u.push(g);if(o){let g=Object.assign({},_u(process),o);for(let h in g){let f=g[h];f===null?(u.push("-u"),u.push(h)):(u.push("-e"),u.push(`${h}=${f}`))}}let m=Ad.spawn(r.OSASCRIPT,u);pL(m,a,l,s)}else if(s==="Ghostty.app"){let d=Object.assign({},_u(process),o),c=["-na","Ghostty.app","--args"];c.push("--working-directory="+e),c.push("--wait-after-command=true"),c.push("-e",...n);let u=Ad.spawn("/usr/bin/open",c,{env:d});pL(u,a,l,s)}else l(new Error(p(2120,null,s)))})}spawnTerminal(t,e,n){let o=e.osxExec||sf;return new Promise((i,s)=>{let a=["-a",o];n&&a.push(n);let l=_u(process),d=t.spawn("/usr/bin/open",a,{cwd:n,env:l});d.on("error",s),d.on("exit",()=>i())})}},$b=class r extends Vb{static{this.WAIT_MESSAGE=p(2121,null)}openTerminal(t,e){return this.spawnTerminal(Ad,t,e)}runInTerminal(t,e,n,o,i){let s=i.linuxExec?Promise.resolve(i.linuxExec):r.getDefaultTerminalLinuxReady();return new Promise((a,l)=>{s.then(d=>{if(nt(d).toLowerCase()==="ghostty"){let g=[];e&&g.push(`--working-directory=${e}`),g.push("--wait-after-command=true"),n.length&&g.push("-e",...n),r.spawnTerminalWithEnv(d,g,e,o,a,l);return}let u=[];d.indexOf("gnome-terminal")>=0?u.push("-x"):u.push("-e"),u.push("bash"),u.push("-c");let m=`${$K(n)}; echo; read -p "${r.WAIT_MESSAGE}" -n1;`;u.push(`''${m}''`),r.spawnTerminalWithEnv(d,u,e,o,a,l)})})}static spawnTerminalWithEnv(t,e,n,o,i,s){let a=Object.assign({},_u(process),o);Object.keys(a).filter(d=>a[d]===null).forEach(d=>delete a[d]);let l=Ad.spawn(t,e,{cwd:n,env:a});pL(l,i,s,t)}static async getDefaultTerminalLinuxReady(){if(!r._DEFAULT_TERMINAL_LINUX_READY)if(!Qe)r._DEFAULT_TERMINAL_LINUX_READY=Promise.resolve("xterm");else{let t=await st.exists("/etc/debian_version");r._DEFAULT_TERMINAL_LINUX_READY=new Promise(e=>{t?e("x-terminal-emulator"):process.env.DESKTOP_SESSION==="gnome"||process.env.DESKTOP_SESSION==="gnome-classic"?e("gnome-terminal"):process.env.DESKTOP_SESSION==="kde-plasma"?e("konsole"):process.env.COLORTERM?e(process.env.COLORTERM):process.env.TERM?e(process.env.TERM):e("xterm")})}return r._DEFAULT_TERMINAL_LINUX_READY}spawnTerminal(t,e,n){let o=e.linuxExec?Promise.resolve(e.linuxExec):r.getDefaultTerminalLinuxReady();return new Promise((i,s)=>{o.then(a=>{let l=_u(process),c=nt(a).toLowerCase()==="ghostty"&&n?[`--working-directory=${n}`]:[],u=t.spawn(a,c,{cwd:n,env:l});u.on("error",s),u.on("exit",()=>i())})})}};function _u(r){let t={...r.env};return BV(t),t}function GV(r){return r.errno==="ENOENT"&&r.path?new Error(p(2119,null,r.path)):r}function pL(r,t,e,n){let o="";r.on("error",i=>{e(GV(i))}),r.stderr?.on("data",i=>{o+=i.toString()}),r.on("exit",i=>{if(i===0)t(void 0);else if(o){let s=o.split(`
`,1);e(new Error(s[0]))}else e(new Error(p(2122,null,n,i)))})}function $K(r){let t="";for(let e of r)e.indexOf(" ")>=0?t+='"'+e+'"':t+=e,t+=" ";return t}var wE=class r{constructor(){this.validators=new Map}static{this._nextId=1}async createNewMessage(t){try{let e=await this.getValidator();if(e){let n=String(r._nextId++);return this.validators.set(n,e),{id:n,data:e.createNewMessage(t)}}}catch{}return{id:"",data:t}}async validate(t,e){if(!t.id)return!0;let n=this.validators.get(t.id);if(!n)return!1;this.validators.delete(t.id);try{return n.validate(e)==="ok"}catch{return!1}finally{n.dispose?.()}}async sign(t){try{return await this.signValue(t)}catch{}return t}};var af=class extends wE{getValidator(){return this.vsda().then(t=>new t.validator)}signValue(t){return this.vsda().then(e=>new e.signer().sign(t))}async vsda(){let t="vsda",{default:e}=await import(t);return e}};import*as RE from"child_process";import*as mL from"net";var kE=class r extends $g{constructor(){super();this.rawData=Buffer.allocUnsafe(0);this.contentLength=-1}static{this.TWO_CRLF=`\r
\r
`}static{this.HEADER_LINESEPARATOR=/\r?\n/}static{this.HEADER_FIELDSEPARATOR=/: */}connect(e,n){this.outputStream=n,this.rawData=Buffer.allocUnsafe(0),this.contentLength=-1,e.on("data",o=>this.handleData(o))}sendMessage(e){if(this.outputStream){let n=JSON.stringify(e);this.outputStream.write(`Content-Length: ${Buffer.byteLength(n,"utf8")}${r.TWO_CRLF}${n}`,"utf8")}}handleData(e){for(this.rawData=Buffer.concat([this.rawData,e]);;){if(this.contentLength>=0){if(this.rawData.length>=this.contentLength){let n=this.rawData.toString("utf8",0,this.contentLength);if(this.rawData=this.rawData.slice(this.contentLength),this.contentLength=-1,n.length>0)try{this.acceptMessage(JSON.parse(n))}catch(o){this._onError.fire(new Error((o.message||o)+`
`+n))}continue}}else{let n=this.rawData.indexOf(r.TWO_CRLF);if(n!==-1){let i=this.rawData.toString("utf8",0,n).split(r.HEADER_LINESEPARATOR);for(let s of i){let a=s.split(r.HEADER_FIELDSEPARATOR);a[0]==="Content-Length"&&(this.contentLength=Number(a[1]))}this.rawData=this.rawData.slice(n+r.TWO_CRLF.length);continue}}break}}},PE=class extends kE{startSession(){return new Promise((t,e)=>{let n=!1;this.socket=this.createConnection(()=>{this.connect(this.socket,this.socket),t(),n=!0}),this.socket.on("close",()=>{n?this._onError.fire(new Error("connection closed")):e(new Error("connection closed"))}),this.socket.on("error",o=>{o instanceof AggregateError&&(o=o.errors[0]),n?this._onError.fire(o):e(o)})})}async stopSession(){await this.cancelPendingRequests(),this.socket&&(this.socket.end(),this.socket=void 0)}},_E=class extends PE{constructor(e){super();this.adapterServer=e}createConnection(e){return mL.createConnection(this.adapterServer.port,this.adapterServer.host||"127.0.0.1",e)}},DE=class extends PE{constructor(e){super();this.adapterServer=e}createConnection(e){return mL.createConnection(this.adapterServer.path,e)}},zb=class r extends kE{constructor(e,n){super();this.adapterExecutable=e;this.debugType=n}async startSession(){let e=this.adapterExecutable.command,n=this.adapterExecutable.args,o=this.adapterExecutable.options||{};try{if(e)if(En(e)){if(!await st.exists(e))throw new Error(p(9978,null,e))}else e.indexOf("/")<0&&e.indexOf("\\")<0;else throw new Error(p(9979,null,this.debugType));let i=process.env;if(o.env&&Object.keys(o.env).length>0&&(i=Qo(at(process.env),o.env)),e==="node")if(Array.isArray(n)&&n.length>0){let s=!!process.env.ELECTRON_RUN_AS_NODE||!!process.versions.electron,a={env:i,execArgv:s?["-e","delete process.env.ELECTRON_RUN_AS_NODE;require(process.argv[1])"]:[],silent:!0};o.cwd&&(a.cwd=o.cwd);let l=RE.fork(n[0],n.slice(1),a);if(!l.pid)throw new Error(p(9980,null,n[0]));this.serverProcess=l}else throw new Error(p(9981,null));else{let s=e,a=n,l={env:i};o.cwd&&(l.cwd=o.cwd),Ie&&(e.endsWith(".bat")||e.endsWith(".cmd"))&&(l.shell=!0,s=`"${e}"`,a=n.map(d=>(d=d.replace(/"/g,'\\"'),`"${d}"`))),this.serverProcess=RE.spawn(s,a,l)}this.serverProcess.on("error",s=>{this._onError.fire(s)}),this.serverProcess.on("exit",(s,a)=>{this._onExit.fire(s)}),this.serverProcess.stdout.on("close",()=>{this._onError.fire(new Error("read error"))}),this.serverProcess.stdout.on("error",s=>{this._onError.fire(s)}),this.serverProcess.stdin.on("error",s=>{this._onError.fire(s)}),this.serverProcess.stderr.resume(),this.connect(this.serverProcess.stdout,this.serverProcess.stdin)}catch(i){this._onError.fire(i)}}async stopSession(){return this.serverProcess?(await this.cancelPendingRequests(),Ie?Wb(this.serverProcess.pid,!0).catch(()=>{this.serverProcess?.kill()}):(this.serverProcess.kill("SIGTERM"),Promise.resolve(void 0))):Promise.resolve(void 0)}static extract(e,n){if(!e)return;let o=Object.create(null);e.runtime&&(e.runtime.indexOf("./")===0?o.runtime=Ne(n,e.runtime):o.runtime=e.runtime),e.runtimeArgs&&(o.runtimeArgs=e.runtimeArgs),e.program&&(En(e.program)?o.program=e.program:o.program=Ne(n,e.program)),e.args&&(o.args=e.args);let i=e;return i.win&&(o.win=r.extract(i.win,n)),i.winx86&&(o.winx86=r.extract(i.winx86,n)),i.windows&&(o.windows=r.extract(i.windows,n)),i.osx&&(o.osx=r.extract(i.osx,n)),i.linux&&(o.linux=r.extract(i.linux,n)),o}static platformAdapterExecutable(e,n){let o=Object.create(null);n=n.toLowerCase();for(let c of e)if(c.contributes){let u=c.contributes.debuggers;u&&u.length>0&&u.filter(m=>typeof m.type=="string"&&wn(m.type,n)).forEach(m=>{let g=r.extract(m,c.extensionLocation.fsPath);o=Qo(o,g,c.isBuiltin)})}let i;Ie&&!process.env.hasOwnProperty("PROCESSOR_ARCHITEW6432")?i=o.winx86||o.win||o.windows:Ie?i=o.win||o.windows:pt?i=o.osx:Qe&&(i=o.linux),i=i||o;let s=i.program||o.program,a=i.args||o.args,l=i.runtime||o.runtime,d=i.runtimeArgs||o.runtimeArgs;if(l)return{type:"executable",command:l,args:(d||[]).concat(typeof s=="string"?[s]:[]).concat(a||[])};if(s)return{type:"executable",command:s,args:a||[]}}};import*as QV from"child_process";function zK(r,t){return new Promise((e,n)=>{let o="",i=QV.spawn(r,t);i.pid&&i.stdout.on("data",s=>{o+=s.toString()}),i.on("error",s=>{n(s)}),i.on("close",s=>{e(o)})})}async function JV(r){if(r)if(Ie){let t=await import("@vscode/windows-process-tree");return new Promise(e=>{t.getProcessTree(r,n=>{e(!!n&&n.children.length>0)})})}else return zK("/usr/bin/pgrep",["-lP",String(r)]).then(t=>{let e=t.trim();return!(e.length===0||e.indexOf(" tmux")>=0)},t=>!0);return Promise.resolve(!0)}function YV(r,t,e,n,o){r=r.trim().toLowerCase();let i;r.indexOf("powershell")>=0||r.indexOf("pwsh")>=0?i=1:r.indexOf("cmd.exe")>=0?i=0:r.indexOf("bash")>=0?i=2:Ie?i=0:i=2;let s,a=" ";switch(i){case 1:if(s=l=>(l=l.replace(/\'/g,"''"),l.length>0&&l.charAt(l.length-1)==="\\"?`'${l}\\'`:`'${l}'`),n){let l=c_(n);l&&(a+=`${l}:; `),a+=`cd ${s(n)}; `}if(o)for(let l in o){let d=o[l];d===null?a+=`Remove-Item env:${l}; `:a+=`\${env:${l}}='${d}'; `}if(t.length>0){let l=t.shift(),d=e?l:s(l);a+=d[0]==="'"?`& ${d} `:`${d} `;for(let c of t)a+=c==="<"||c===">"||e?c:s(c),a+=" "}break;case 0:if(s=l=>(l=l.replace(/\"/g,'""'),l=l.replace(/([><!^&|])/g,"^$1"),' "'.split("").some(d=>l.includes(d))||l.length===0?`"${l}"`:l),n){let l=c_(n);l&&(a+=`${l}: && `),a+=`cd ${s(n)} && `}if(o){a+='cmd /C "';for(let l in o){let d=o[l];d===null?a+=`set "${l}=" && `:(d=d.replace(/[&^|<>]/g,c=>`^${c}`),a+=`set "${l}=${d}" && `)}}for(let l of t)a+=l==="<"||l===">"||e?l:s(l),a+=" ";o&&(a+='"');break;case 2:{s=d=>(d=d.replace(/(["'\\\$!><#()\[\]*&^| ;{}?`])/g,"\\$1"),d.length===0?'""':d);let l=d=>/[^\w@%\/+=,.:^-]/.test(d)?`'${d.replace(/'/g,"'\\''")}'`:d;if(n&&(a+=`cd ${s(n)} ; `),o){a+="/usr/bin/env";for(let d in o){let c=o[d];c===null?a+=` -u ${l(d)}`:a+=` ${l(`${d}=${c}`)}`}a+=" "}for(let d of t)a+=d==="<"||d===">"||e?d:s(d),a+=" ";break}}return a}var lf=class extends Tu{constructor(e,n,o,i,s,a,l,d,c,u){super(e,n,o,i,l,d,c,u);this._terminalService=s;this._terminalShellIntegrationService=a;this._integratedTerminalInstances=new gL}createDebugAdapter(e,n){return e instanceof Mi?new zb(this.convertExecutableToDto(e),n.type):e instanceof Li?new _E(this.convertServerToDto(e)):e instanceof ws?new DE(this.convertPipeServerToDto(e)):super.createDebugAdapter(e,n)}daExecutableFromPackage(e,n){let o=zb.platformAdapterExecutable(n.getAllExtensionDescriptions(),e.type);if(o)return new Mi(o.command,o.args,o.options)}createSignService(){return new af}async $runInTerminal(e,n){if(e.kind==="integrated"){this._terminalDisposedListener||(this._terminalDisposedListener=this._register(this._terminalService.onDidCloseTerminal(f=>{this._integratedTerminalInstances.onTerminalClosed(f)})));let o=await this._configurationService.getConfigProvider(),i=this._terminalService.getDefaultShell(!0),s=this._terminalService.getDefaultShellArgs(!0),a=e.title||p(3521,null),l=JSON.stringify({shell:i,shellArgs:s}),d=await this._integratedTerminalInstances.checkout(l,a),c,u=!1;if(d)c=e.cwd;else{let f={shellPath:i,shellArgs:s,cwd:e.cwd,name:a,iconPath:new un("debug")};u=!0,d=this._terminalService.createTerminalFromOptions(f,{isFeatureTerminal:!0,forceShellIntegration:!0,useShellEnvironment:!0}),this._integratedTerminalInstances.insert(d,l)}d.show(!0);let m=await d.processId;if(u){let f;(P=>(P[P.DataDebounce=500]="DataDebounce",P[P.MaxDelay=5e3]="MaxDelay"))(f||={});let I=new $;await new Promise(S=>{let T=I.add(new jn(S,500));I.add(this._terminalService.onDidWriteTerminalData(P=>{P.terminal===d&&T.schedule()})),I.add(this._terminalShellIntegrationService.onDidChangeTerminalShellIntegration(P=>{P.terminal===d&&S()})),I.add(Ch(S,5e3))}),I.dispose()}else if(d.state.isInteractedWith&&!d.shellIntegration&&(d.sendText(""),await Ut(200)),o.getConfiguration("debug.terminal").get("clearBeforeReusing")){let f;if(i.indexOf("powershell")>=0||i.indexOf("pwsh")>=0||i.indexOf("cmd.exe")>=0?f="cls":i.indexOf("bash")>=0?f="clear":Ie?f="cls":f="clear",d.shellIntegration){let I=new $,S=d.shellIntegration.executeCommand(f);await new Promise(T=>{I.add(this._terminalShellIntegrationService.onDidEndTerminalShellExecution(P=>{P.execution===S&&T()})),I.add(Ch(T,500))}),I.dispose()}else d.sendText(f),await Ut(200)}let g=YV(i,e.args,!!e.argsCanBeInterpretedByShell,c,e.env);d.shellIntegration?d.shellIntegration.executeCommand(g):d.sendText(g);let h=this.onDidTerminateDebugSession(f=>{f.id===n&&(this._integratedTerminalInstances.free(d),h.dispose())});return m}else if(e.kind==="external")return qK(e,await this._configurationService.getConfigProvider());return super.$runInTerminal(e,n)}};lf=_([C(0,se),C(1,On),C(2,go),C(3,Sn),C(4,wo),C(5,Zg),C(6,Bi),C(7,Wr),C(8,Nn),C(9,za)],lf);var qb;function qK(r,t){if(!qb)if(Ie)qb=new Bb;else if(pt)qb=new EE;else if(Qe)qb=new $b;else throw new Error("external terminals not supported on this platform");let e=t.getConfiguration("terminal");return qb.runInTerminal(r.title,r.cwd,r.args,r.env||{},e.external||{})}var gL=class r{constructor(){this._terminalInstances=new Map}static{this.minUseDelay=1e3}async checkout(t,e,n=!1){let i=[...this._terminalInstances.entries()].map(([s,a])=>fr(async l=>{if(s.name!==e||a.lastUsedAt!==-1&&await JV(await s.processId))return null;let d=Date.now();return a.lastUsedAt+r.minUseDelay>d||l.isCancellationRequested?null:a.config!==t?(n&&s.dispose(),null):(a.lastUsedAt=d,s)}));return await ZU(i,s=>!!s)}insert(t,e){this._terminalInstances.set(t,{lastUsedAt:Date.now(),config:e})}free(t){let e=this._terminalInstances.get(t);e&&(e.lastUsedAt=-1)}onTerminalClosed(t){this._terminalInstances.delete(t)}};var XV=new mt(()=>{let r=Eg.Collator(void 0,{numeric:!0,sensitivity:"base"}).value;return{collator:r,collatorIsNumeric:r.resolvedOptions().numeric}}),F7e=new mt(()=>({collator:Eg.Collator(void 0,{numeric:!0}).value})),H7e=new mt(()=>({collator:Eg.Collator(void 0,{numeric:!0,sensitivity:"accent"}).value}));function ZV(r,t,e=!1){let n=r||"",o=t||"",i=XV.value.collator.compare(n,o);return XV.value.collatorIsNumeric&&i===0&&n!==o?n<o?-1:1:i}function KK(r,t,e=!1){return e||(r=r&&r.toLowerCase(),t=t&&t.toLowerCase()),r===t?0:r<t?-1:1}function Kb(r,t,e=!1){let n=r.split(xt),o=t.split(xt),i=n.length-1,s=o.length-1,a,l;for(let d=0;;d++){if(a=i===d,l=s===d,a&&l)return ZV(n[d],o[d],e);if(a)return-1;if(l)return 1;let c=KK(n[d],o[d],e);if(c!==0)return c}}function AE(r,t,e){let n=r.toLowerCase(),o=t.toLowerCase(),i=jK(r,t,e);if(i)return i;let s=n.endsWith(e),a=o.endsWith(e);if(s!==a)return s?-1:1;let l=ZV(n,o);return l!==0?l:n.localeCompare(o)}function jK(r,t,e){let n=r.toLowerCase(),o=t.toLowerCase(),i=n.startsWith(e),s=o.startsWith(e);if(i!==s)return i?-1:1;if(i&&s){if(n.length<o.length)return-1;if(n.length>o.length)return 1}return 0}var LE=0,eB=[LE,[]];function tB(r,t,e,n){if(!r||!t)return eB;let o=r.length,i=t.length;if(o<i)return eB;let s=r.toLowerCase();return GK(t,e,i,r,s,o,n)}function GK(r,t,e,n,o,i,s){let a=[],l=[];for(let m=0;m<e;m++){let g=m*i,h=g-i,f=m>0,I=r[m],S=t[m];for(let T=0;T<i;T++){let P=T>0,L=g+T,q=L-1,N=h+T-1,B=P?a[q]:0,G=f&&P?a[N]:0,J=f&&P?l[N]:0,Y;!G&&f?Y=0:Y=QK(I,S,n,o,T,J),Y&&G+Y>=B&&(s||f||o.startsWith(t,T))?(l[L]=J+1,a[L]=G+Y):(l[L]=LE,a[L]=B)}}let d=[],c=e-1,u=i-1;for(;c>=0&&u>=0;){let m=c*i+u;l[m]===LE||(d.push(u),c--),u--}return[a[e*i-1],d.reverse()]}function QK(r,t,e,n,o,i){let s=0;if(!JK(t,n[o]))return s;if(s+=1,i>0&&(s+=Math.min(i,3)*6+Math.max(0,i-3)*3),r===e[o]&&(s+=1),o===0)s+=8;else{let a=YK(e.charCodeAt(o-1));a?s+=a:wp(e.charCodeAt(o))&&i===0&&(s+=2)}return s}function JK(r,t){return r===t?!0:r==="/"||r==="\\"?t==="/"||t==="\\":!1}function YK(r){switch(r){case 47:case 92:return 5;case 95:case 45:case 46:case 32:case 39:case 34:case 58:return 4;default:return 0}}var OE=Object.freeze({score:0}),ME=1<<18,fL=1<<17,hL=65536;function XK(r,t,e,n){let o=n.values?n.values:[n];return Gn({[n.normalized]:{values:o.map(s=>({value:s.normalized,expectContiguousMatch:s.expectContiguousMatch})),label:r,description:t,allowNonContiguousMatches:e}})}function nB(r,t,e,n,o){if(!r||!t.normalized)return OE;let i=n.getItemLabel(r);if(!i)return OE;let s=n.getItemDescription(r),a=XK(i,s,e,t),l=o[a];if(l)return l;let d=ZK(i,s,n.getItemPath(r),t,e);return o[a]=d,d}function ZK(r,t,e,n,o){let i=!e||!n.containsPathSeparator;return e&&(Qe?n.pathNormalized===e:wn(n.pathNormalized,e))?{score:ME,labelMatch:[{start:0,end:r.length}],descriptionMatch:t?[{start:0,end:t.length}]:void 0}:n.values&&n.values.length>1?ej(r,t,e,n.values,i,o):lB(r,t,e,n,i,o)}function ej(r,t,e,n,o,i){let s=0,a=[],l=[];for(let d of n){let{score:c,labelMatch:u,descriptionMatch:m}=lB(r,t,e,d,o,i);if(c===LE)return OE;s+=c,u&&a.push(...u),m&&l.push(...m)}return{score:s,labelMatch:rB(a),descriptionMatch:rB(l)}}function lB(r,t,e,n,o,i){if(o||!t){let[s,a]=tB(r,n.normalized,n.normalizedLowercase,i&&!n.expectContiguousMatch);if(s){let l=ux(n.normalized,r),d;if(l){d=fL;let c=Math.round(n.normalized.length/r.length*100);d+=c}else d=hL;return{score:d+s,labelMatch:l||oB(a)}}}if(t){let s=t;e&&(s=`${t}${xt}`);let a=s.length,l=`${s}${r}`,[d,c]=tB(l,n.normalized,n.normalizedLowercase,i&&!n.expectContiguousMatch);if(d){let u=oB(c),m=[],g=[];return u.forEach(h=>{h.start<a&&h.end>a?(m.push({start:0,end:h.end-a}),g.push({start:h.start,end:a})):h.start>=a?m.push({start:h.start-a,end:h.end-a}):g.push(h)}),{score:d,labelMatch:m,descriptionMatch:g}}}return OE}function oB(r){let t=[];if(!r)return t;let e;for(let n of r)e&&e.end===n?e.end+=1:(e={start:n,end:n+1},t.push(e));return t}function rB(r){let t=r.sort((o,i)=>o.start-i.start),e=[],n;for(let o of t)!n||!tj(n,o)?(n=o,e.push(o)):(n.start=Math.min(n.start,o.start),n.end=Math.max(n.end,o.end));return e}function tj(r,t){return!(r.end<t.start||t.end<r.start)}function dB(r,t,e,n,o,i){let s=nB(r,e,n,o,i),a=nB(t,e,n,o,i),l=s.score,d=a.score;if((l===ME||d===ME)&&l!==d)return l===ME?-1:1;if(l>hL||d>hL){if(l!==d)return l>d?-1:1;if(l<fL&&d<fL){let I=nj(s.labelMatch,a.labelMatch);if(I!==0)return I}let h=o.getItemLabel(r)||"",f=o.getItemLabel(t)||"";if(h.length!==f.length)return h.length-f.length}if(l!==d)return l>d?-1:1;let c=Array.isArray(s.labelMatch)&&s.labelMatch.length>0,u=Array.isArray(a.labelMatch)&&a.labelMatch.length>0;if(c&&!u)return-1;if(u&&!c)return 1;let m=iB(r,s,o),g=iB(t,a,o);return m&&g&&m!==g?g>m?-1:1:oj(r,t,e,o)}function iB(r,t,e){let n=-1,o=-1;if(t.descriptionMatch?.length?n=t.descriptionMatch[0].start:t.labelMatch?.length&&(n=t.labelMatch[0].start),t.labelMatch?.length){if(o=t.labelMatch[t.labelMatch.length-1].end,t.descriptionMatch?.length){let i=e.getItemDescription(r);i&&(o+=i.length)}}else t.descriptionMatch?.length&&(o=t.descriptionMatch[t.descriptionMatch.length-1].end);return o-n}function nj(r,t){if(!r&&!t||!r?.length&&!t?.length)return 0;if(!t?.length)return-1;if(!r?.length)return 1;let e=r[0].start,o=r[r.length-1].end-e,i=t[0].start,a=t[t.length-1].end-i;return o===a?0:a<o?1:-1}function oj(r,t,e,n){let o=n.getItemLabel(r)||"",i=n.getItemLabel(t)||"",s=n.getItemDescription(r),a=n.getItemDescription(t),l=o.length+(s?s.length:0),d=i.length+(a?a.length:0);if(l!==d)return l-d;let c=n.getItemPath(r),u=n.getItemPath(t);return c&&u&&c.length!==u.length?c.length-u.length:o!==i?AE(o,i,e.normalized):s&&a&&s!==a?AE(s,a,e.normalized):c&&u&&c!==u?AE(c,u,e.normalized):0}function sB(r){return r.startsWith('"')&&r.endsWith('"')}var rj=" ";function jb(r){typeof r!="string"&&(r="");let t=r.toLowerCase(),{pathNormalized:e,normalized:n,normalizedLowercase:o}=aB(r),i=e.indexOf(xt)>=0,s=sB(r),a,l=r.split(rj);if(l.length>1)for(let d of l){let c=sB(d),{pathNormalized:u,normalized:m,normalizedLowercase:g}=aB(d);m&&(a||(a=[]),a.push({original:d,originalLowercase:d.toLowerCase(),pathNormalized:u,normalized:m,normalizedLowercase:g,expectContiguousMatch:c}))}return{original:r,originalLowercase:t,pathNormalized:e,normalized:n,normalizedLowercase:o,values:a,containsPathSeparator:i,expectContiguousMatch:s}}function aB(r){let t;Ie?t=r.replace(/\//g,xt):t=r.replace(/\\/g,xt);let e=t.replace(/[\*\u2026\s"]/g,"").replace(/(?<=.)#$/,"");return{pathNormalized:t,normalized:e,normalizedLowercase:e.toLowerCase()}}import*as hB from"child_process";import*as cf from"fs";import{StringDecoder as fB}from"string_decoder";import*as pB from"child_process";function df(r){return r.startsWith("**")||r.startsWith("/")?r:`/${r}`}function cB(r){return new eg(r.start.line,r.start.character,r.end.line,r.end.character)}function vL(r){return new Xm(r.startLineNumber,r.startColumn,r.endLineNumber,r.endColumn)}var Du=class{constructor(t,e){this.prefix=t;this.logService=e}appendLine(t){this.logService.debug(`${this.prefix}#search`,t)}};Du=_([C(1,oe)],Du);import{rgPath as ij}from"@vscode/ripgrep";var uB=ij.replace(/\bnode_modules\.asar\b/,"node_modules.asar.unpacked");function mB(r,t,e,n,o){let i=sj(r,t,e,n,o),s=t.folder.fsPath;return{cmd:pB.spawn(uB,i.args,{cwd:s}),rgDiskPath:uB,siblingClauses:i.siblingClauses,rgArgs:i,cwd:s}}function sj(r,t,e,n,o){let i=["--files","--hidden","--case-sensitive","--no-require-git"];(r.ignoreGlobCase||t.ignoreGlobCase)&&(i.push("--glob-case-insensitive"),i.push("--ignore-file-case-insensitive")),lj([t],e,!1).forEach(a=>{let l=df(a);if(i.push("-g",l),pt){let d=_I(l);d!==l&&i.push("-g",d)}});let s=aj([t],n,void 0,!1);return s.globArgs.forEach(a=>{let l=`!${df(a)}`;if(i.push("-g",l),pt){let d=_I(l);d!==l&&i.push("-g",d)}}),t.disregardIgnoreFiles!==!1?i.push("--no-ignore"):t.disregardParentIgnoreFiles!==!1&&i.push("--no-ignore-parent"),t.ignoreSymlinks||i.push("--follow"),r.exists&&i.push("--quiet"),o&&i.push("--threads",`${o}`),i.push("--no-config"),t.disregardGlobalIgnoreFiles&&i.push("--no-ignore-global"),{args:i,siblingClauses:s.siblingClauses}}function aj(r,t,e,n=!0){let o=[],i={};return r.forEach(s=>{let a=Object.assign({},s.excludePattern||{},t||{}),l=gB(a,n?s.folder.fsPath:void 0,e);o.push(...l.globArgs),l.siblingClauses&&(i=Object.assign(i,l.siblingClauses))}),{globArgs:o,siblingClauses:i}}function lj(r,t,e=!0){let n=[];return r.forEach(o=>{let i=Object.assign({},t||{},o.includePattern||{}),s=gB(i,e?o.folder.fsPath:void 0);n.push(...s.globArgs)}),n}function gB(r,t,e){let n=[],o={};return Object.keys(r).forEach(i=>{if(e&&e.has(i)||!i)return;let s=r[i];i=cj(t?dj(t,i):i),i.startsWith("\\\\")?i="\\\\"+i.substr(2).replace(/\\/g,"/"):i=i.replace(/\\/g,"/"),typeof s=="boolean"&&s?(i.startsWith("\\\\")&&(i+="**"),n.push(uj(i))):s&&s.when&&(o[i]=s)}),{globArgs:n,siblingClauses:o}}function dj(r,t){return En(t)?t:Ne(r,t)}function cj(r){return r=mr(r,"\\"),mr(r,"/")}function uj(r){return fh(r).toLowerCase()==="c:/"?r.replace(/^c:[/\\]/i,"/"):r}var NE=new Set;process.on("exit",()=>{NE.forEach(r=>r())});var bL=class{constructor(t){this.normalizedFilePatternLowercase=null;this.maxFilesize=null;this.isCanceled=!1;this.fileWalkSW=null;this.cmdSW=null;this.cmdResultCount=0;this.config=t,this.filePattern=t.filePattern||"";let e=t.ignoreGlobCase?{ignoreCase:!0}:void 0;this.includePattern=t.includePattern&&Co(t.includePattern,e),this.maxResults=t.maxResults||null,this.exists=!!t.exists,this.walkedPaths=Object.create(null),this.resultCount=0,this.isLimitHit=!1,this.directoriesWalked=0,this.filesWalked=0,this.errors=[],this.filePattern&&(this.normalizedFilePatternLowercase=t.shouldGlobMatchFilePattern?null:jb(this.filePattern).normalizedLowercase),this.globalExcludePattern=t.excludePattern&&Co(t.excludePattern,e),this.folderExcludePatterns=new Map,t.folderQueries.forEach(n=>{let o={};n.excludePattern?.forEach(s=>{Object.assign(o,s.pattern||{},this.config.excludePattern||{})}),n.excludePattern?.length||Object.assign(o,this.config.excludePattern||{});let i=n.folder.fsPath;t.folderQueries.map(s=>s.folder.fsPath).filter(s=>s!==i).forEach(s=>{_r(s,i,t.ignoreGlobCase)&&(o[gi(i,s)]=!0)}),this.folderExcludePatterns.set(i,new yL(o,i,t.ignoreGlobCase))})}cancel(){this.isCanceled=!0,NE.forEach(t=>t())}walk(t,e,n,o,i,s){if(this.fileWalkSW=an.create(!1),this.isCanceled)return s(null,this.isLimitHit);e.forEach(a=>{let l=nt(a.fsPath);this.globalExcludePattern&&this.globalExcludePattern(a.fsPath,l)||this.matchFile(o,{relativePath:a.fsPath,searchPath:void 0})}),this.cmdSW=an.create(!1),this.parallel(t,(a,l)=>{this.call(this.cmdTraversal,this,a,n,o,i,d=>{if(d){let c=Io(d);console.error(c),this.errors.push(c),l(d,void 0)}else l(null,void 0)})},(a,l)=>{this.fileWalkSW.stop();let d=a?tt(a)[0]:null;s(d,this.isLimitHit)})}parallel(t,e,n){let o=new Array(t.length),i=new Array(t.length),s=!1,a=0;if(t.length===0)return n(null,[]);t.forEach((l,d)=>{e(l,(c,u)=>{if(c?(s=!0,o[d]=null,i[d]=c):(o[d]=u,i[d]=null),++a===t.length)return n(s?i:null,o)})})}call(t,e,...n){try{t.apply(e,n)}catch(o){n[n.length-1](o)}}cmdTraversal(t,e,n,o,i){let s=t.folder.fsPath,a=pt,l=()=>g&&g.kill();NE.add(l);let d=S=>{NE.delete(l),d=()=>{},i(S)},c="",u=this.initDirectoryTree(),m=mB(this.config,t,this.config.includePattern,this.folderExcludePatterns.get(t.folder.fsPath).expression,e),g=m.cmd,h=!Object.keys(m.siblingClauses).length,f=m.rgArgs.args.map(S=>S.match(/^-/)?S:`'${S}'`).join(" "),I=`${m.rgDiskPath} ${f}
 - cwd: ${m.cwd}`;m.rgArgs.siblingClauses&&(I+=`
 - Sibling clauses: ${JSON.stringify(m.rgArgs.siblingClauses)}`),o({message:I}),this.cmdResultCount=0,this.collectStdout(g,"utf8",o,(S,T,P)=>{if(S){d(S);return}if(this.isLimitHit){d();return}let q=(c+(a?oc(T||""):T)).split(`
`);if(P){let N=q.length;q[N-1]=q[N-1].trim(),q[N-1]||q.pop()}else c=q.pop()||"";if(q.length&&q[0].indexOf(`
`)!==-1){d(new Error("Splitting up files failed"));return}if(this.cmdResultCount+=q.length,h){for(let N of q)if(this.matchFile(n,{base:s,relativePath:N,searchPath:this.getSearchPath(t,N)}),this.isLimitHit){l();break}(P||this.isLimitHit)&&d();return}this.addDirectoryEntries(t,u,s,q,n),P&&(this.matchDirectoryTree(u,s,n),d())})}spawnFindCmd(t){let e=this.folderExcludePatterns.get(t.folder.fsPath),n=e.getBasenameTerms(),o=e.getPathTerms(),i=["-L","."];if(n.length||o.length){i.push("-not","(","(");for(let s of n)i.push("-name",s),i.push("-o");for(let s of o)i.push("-path",s),i.push("-o");i.pop(),i.push(")","-prune",")")}return i.push("-type","f"),hB.spawn("find",i,{cwd:t.folder.fsPath})}readStdout(t,e,n){let o="";this.collectStdout(t,e,()=>{},(i,s,a)=>{if(i){n(i);return}o+=s,a&&n(null,o)})}collectStdout(t,e,n,o){let i=(l,d,c)=>{(l||c)&&(i=()=>{},this.cmdSW?.stop()),o(l,d,c)},s=!1;t.stdout?(this.forwardData(t.stdout,e,i),t.stdout.once("data",()=>s=!0)):n({message:"stdout is null"});let a;t.stderr?a=this.collectData(t.stderr):n({message:"stderr is null"}),t.on("error",l=>{i(l)}),t.on("close",l=>{let d;!s&&(d=this.decodeData(a,e))&&pj(d)?i(new Error(`command failed with error code ${l}: ${this.decodeData(a,e)}`)):(this.exists&&l===0&&(this.isLimitHit=!0),i(null,"",!0))})}forwardData(t,e,n){let o=new fB(e);return t.on("data",i=>{n(null,o.write(i))}),o}collectData(t){let e=[];return t.on("data",n=>{e.push(n)}),e}decodeData(t,e){let n=new fB(e);return t.map(o=>n.write(o)).join("")}initDirectoryTree(){let t={rootEntries:[],pathToEntries:Object.create(null)};return t.pathToEntries["."]=t.rootEntries,t}addDirectoryEntries(t,{pathToEntries:e},n,o,i){let s=this.filePattern&&o.find(l=>is(l,this.filePattern,this.config.ignoreGlobCase));s&&this.matchFile(i,{base:n,relativePath:s,searchPath:this.getSearchPath(t,s)});let a=l=>{let d=nt(l),c=cn(l),u=e[c];u||(u=e[c]=[],a(c)),u.push({base:n,relativePath:l,basename:d,searchPath:this.getSearchPath(t,l)})};o.forEach(a)}matchDirectoryTree({rootEntries:t,pathToEntries:e},n,o){let i=this,s=this.folderExcludePatterns.get(n),a=this.filePattern,l=this.config.ignoreGlobCase;function d(c){i.directoriesWalked++;let u=gb(()=>c.map(m=>m.basename));for(let m=0,g=c.length;m<g;m++){let h=c[m],{relativePath:f,basename:I}=h;if(s.test(f,I,is(a,I,l)?void 0:u))continue;let S=e[f];if(S)d(S);else{if(i.filesWalked++,is(f,a,l))continue;i.matchFile(o,h)}if(i.isLimitHit)break}}d(t)}getStats(){return{cmdTime:this.cmdSW.elapsed(),fileWalkTime:this.fileWalkSW.elapsed(),directoriesWalked:this.directoriesWalked,filesWalked:this.filesWalked,cmdResultCount:this.cmdResultCount}}doWalk(t,e,n,o,i){let s=t.folder,a=gb(()=>n);this.parallel(n,(l,d)=>{if(this.isCanceled||this.isLimitHit)return d(null);let c=e?[e,l].join(xt):l;if(this.folderExcludePatterns.get(t.folder.fsPath).test(c,l,is(this.config.filePattern,l,this.config.ignoreGlobCase)?void 0:a))return d(null);let u=[s.fsPath,c].join(xt);cf.lstat(u,(m,g)=>{if(m||this.isCanceled||this.isLimitHit)return d(null);this.statLinkIfNeeded(u,g,(h,f)=>h||this.isCanceled||this.isLimitHit?d(null):f.isDirectory()?(this.directoriesWalked++,this.realPathIfNeeded(u,g,(I,S)=>I||this.isCanceled||this.isLimitHit||(S=S||"",this.walkedPaths[S])?d(null):(this.walkedPaths[S]=!0,st.readdir(u).then(T=>{if(this.isCanceled||this.isLimitHit)return d(null);this.doWalk(t,c,T,o,P=>d(P||null))},T=>{d(null)})))):(this.filesWalked++,is(c,this.filePattern,this.config.ignoreGlobCase)||this.maxFilesize&&Un(f.size)&&f.size>this.maxFilesize||this.matchFile(o,{base:s.fsPath,relativePath:c,searchPath:this.getSearchPath(t,c)}),d(null,void 0)))})},l=>{let d=l&&tt(l);return i(d&&d.length>0?d[0]:void 0)})}matchFile(t,e){this.isFileMatch(e)&&(!this.includePattern||this.includePattern(e.relativePath,nt(e.relativePath)))&&(this.resultCount++,(this.exists||this.maxResults&&this.resultCount>this.maxResults)&&(this.isLimitHit=!0),this.isLimitHit||t(e))}isFileMatch(t){if(this.filePattern){if(this.filePattern==="*")return!0;if(this.normalizedFilePatternLowercase)return mb(t,this.normalizedFilePatternLowercase);if(this.filePattern)return mb(t,this.filePattern,!1,this.config.ignoreGlobCase)}return!0}statLinkIfNeeded(t,e,n){return e.isSymbolicLink()?cf.stat(t,n):n(null,e)}realPathIfNeeded(t,e,n){return e.isSymbolicLink()?cf.realpath(t,(o,i)=>o?n(o):n(null,i)):n(null,t)}getSearchPath(t,e){return t.folderName?Ne(t.folderName,e):e}},Gb=class{constructor(t,e){this.folderQueries=t.folderQueries,this.extraFiles=t.extraFileResources||[],this.numThreads=e,this.walker=new bL(t)}search(t,e,n){this.walker.walk(this.folderQueries,this.extraFiles,this.numThreads,t,e,(o,i)=>{n(o,{limitHit:i,stats:this.walker.getStats(),messages:[]})})}cancel(){this.walker.cancel()}},yL=class{constructor(t,e,n){this.expression=t;this.root=e;this.ignoreCase=n;this.init(t)}init(t){let e,n;Object.keys(t).filter(i=>t[i]).forEach(i=>{En(i)?(e=e||RA(),e[i]=t[i]):(n=n||RA(),n[i]=t[i])});let o={trimForExclusions:!0,ignoreCase:this.ignoreCase};this.absoluteParsedExpr=e&&Co(e,o),this.relativeParsedExpr=n&&Co(n,o)}test(t,e,n){return this.relativeParsedExpr&&this.relativeParsedExpr(t,e,n)||this.absoluteParsedExpr&&this.absoluteParsedExpr(Ne(this.root,t),e,n)}getBasenameTerms(){let t=[];return this.absoluteParsedExpr&&t.push(...MA(this.absoluteParsedExpr)),this.relativeParsedExpr&&t.push(...MA(this.relativeParsedExpr)),t}getPathTerms(){let t=[];return this.absoluteParsedExpr&&t.push(...LA(this.absoluteParsedExpr)),this.relativeParsedExpr&&t.push(...LA(this.relativeParsedExpr)),t}};function pj(r){let t=r.trim().split(`
`),e=t[0].trim();if(e.startsWith("Error parsing regex"))return e;if(e.startsWith("regex parse error"))return LU(t[t.length-1].trim());if(e.startsWith("error parsing glob")||e.startsWith("unsupported encoding"))return e.charAt(0).toUpperCase()+e.substr(1);if(e==="Literal '\\n' not allowed.")return"Literal '\\n' currently not supported";if(e.startsWith("Literal "))return e}import*as IB from"child_process";import{EventEmitter as mj}from"events";import{StringDecoder as gj}from"string_decoder";import{RegExpParser as fj,RegExpVisitor as hj}from"vscode-regexpp";import{rgPath as vj}from"@vscode/ripgrep";var vB=vj.replace(/\bnode_modules\.asar\b/,"node_modules.asar.unpacked"),uf=class{constructor(t,e){this.outputChannel=t;this._numThreads=e}provideTextSearchResults(t,e,n,o){return Promise.all(e.folderOptions.map(i=>{let s={folderOptions:i,numThreads:this._numThreads,maxResults:e.maxResults,previewOptions:e.previewOptions,maxFileSize:e.maxFileSize,surroundingContext:e.surroundingContext};return this.provideTextSearchResultsWithRgOptions(t,s,n,o)})).then((i=>({limitHit:i.some(a=>!!a&&a.limitHit)})))}provideTextSearchResultsWithRgOptions(t,e,n,o){return this.outputChannel.appendLine(`provideTextSearchResults ${t.pattern}, ${JSON.stringify({...e,folder:e.folderOptions.folder.toString()})}`),t.pattern?new Promise((i,s)=>{o.onCancellationRequested(()=>f());let a={...e,numThreads:this._numThreads},l=Ij(t,a),d=e.folderOptions.folder.fsPath,c=l.map(L=>L.match(/^-/)?L:`'${L}'`).join(" ");this.outputChannel.appendLine(`${vB} ${c}
 - cwd: ${d}`);let u=IB.spawn(vB,l,{cwd:d});u.on("error",L=>{console.error(L),this.outputChannel.appendLine("Error: "+(L&&L.message)),s(PM(new Fs(L&&L.message,5)))});let m=!1,g=new IL(e.maxResults??md,e.folderOptions.folder,X0(e.previewOptions));g.on("result",L=>{m=!0,S="",n.report(L)});let h=!1,f=()=>{h=!0,u?.kill(),g?.cancel()},I=!1;g.on("hitLimit",()=>{I=!0,f()});let S="";u.stdout.on("data",L=>{g.handleData(L),m||(S+=L)});let T=!1;u.stdout.once("data",()=>T=!0);let P="";u.stderr.on("data",L=>{let q=L.toString();this.outputChannel.appendLine(q),P.length+q.length<1e6&&(P+=q)}),u.on("close",()=>{if(this.outputChannel.appendLine(T?"Got data from stdout":"No data from stdout"),this.outputChannel.appendLine(m?"Got result from parser":"No result from parser"),S&&this.outputChannel.appendLine(`Got data without result: ${S}`),this.outputChannel.appendLine(""),h)i({limitHit:I});else{g.flush(),u=null;let L;P&&!T&&(L=bj(P))?s(PM(new Fs(L.message,L.code))):i({limitHit:I})}})}):Promise.resolve({limitHit:!1})}};function bj(r){let t=r.split(`
`),e=t[0].trim();if(t.some(o=>o.startsWith("regex parse error")))return new Fs(yj(t),2);let n=e.match(/grep config error: unknown encoding: (.*)/);if(n)return new Fs(`Unknown encoding: ${n[1]}`,1);if(e.startsWith("error parsing glob"))return new Fs(e.charAt(0).toUpperCase()+e.substr(1),3);if(e.startsWith("the literal"))return new Fs(e.charAt(0).toUpperCase()+e.substr(1),4);if(e.startsWith("PCRE2: error compiling pattern"))return new Fs(e,2)}function yj(r){let t=["Regex parse error"],e=r.filter(n=>n.startsWith("PCRE2:"));if(e.length>=1){let n=e[0].replace("PCRE2:","");if(n.indexOf(":")!==-1&&n.split(":").length>=2){let o=n.split(":")[1];t.push(":"+o)}}return t.join("")}var IL=class extends mj{constructor(e,n,o){super();this.maxResults=e;this.root=n;this.previewOptions=o;this.remainder="";this.isDone=!1;this.hitLimit=!1;this.numResults=0;this.stringDecoder=new gj}cancel(){this.isDone=!0}flush(){this.handleDecodedData(this.stringDecoder.end())}on(e,n){return super.on(e,n),this}handleData(e){if(this.isDone)return;let n=typeof e=="string"?e:this.stringDecoder.write(e);this.handleDecodedData(n)}handleDecodedData(e){let n=e.indexOf(`
`),o=this.remainder+e;if(n>=0)n+=this.remainder.length;else{this.remainder=o;return}let i=0;for(;n>=0;)this.handleLine(o.substring(i,n).trim()),i=n+1,n=o.indexOf(`
`,i);this.remainder=o.substring(i)}handleLine(e){if(this.isDone||!e)return;let n;try{n=JSON.parse(e)}catch{throw new Error(`malformed line from rg: ${e}`)}if(n.type==="match"){let o=Qb(n.data.path),i=b.joinPath(this.root,o),s=this.createTextSearchMatch(n.data,i);this.onResult(s),this.hitLimit&&(this.cancel(),this.emit("hitLimit"))}else if(n.type==="context"){let o=Qb(n.data.path),i=b.joinPath(this.root,o);this.createTextSearchContexts(n.data,i).forEach(a=>this.onResult(a))}}createTextSearchMatch(e,n){let o=e.line_number-1,i=Qb(e.lines),s=Buffer.from(i),a=0,l=0,d=o;e.submatches.length===0&&e.submatches.push(i.length?{start:0,end:1,match:{text:i[0]}}:{start:0,end:0,match:{text:""}});let c=tt(e.submatches.map((g,h)=>{if(this.hitLimit)return null;this.numResults++,this.numResults>=this.maxResults&&(this.hitLimit=!0);let f=Qb(g.match),I=s.slice(a,g.start).toString(),S=bB(I),T=S.numLines>0?S.lastLineLength:S.lastLineLength+l,P=bB(f),L=S.numLines+d,q=P.numLines+L,N=P.numLines>0?P.lastLineLength:P.lastLineLength+T;return a=g.end,l=N,d=q,new Xm(L,T,q,N)})),u=Kd(c,cB),m=new Zm(i,u,this.previewOptions);return new zo(n,m.rangeLocations.map(g=>({sourceRange:vL(g.source),previewRange:vL(g.preview)})),m.previewText)}createTextSearchContexts(e,n){let o=Qb(e.lines),i=e.line_number;return o.replace(/\r?\n$/,"").split(`
`).map((s,a)=>new Us(n,s,i+a))}onResult(e){this.emit("result",e)}};function Qb(r){return r.bytes?Buffer.from(r.bytes,"base64").toString():r.text}function bB(r){let t=/\n/g,e=0,n=-1,o;for(;o=t.exec(r);)e++,n=o.index;let i=n>=0?r.length-n-1:r.length;return{numLines:e,lastLineLength:i}}function Ij(r,t){let e=["--hidden","--no-require-git"];e.push(r.isCaseSensitive?"--case-sensitive":"--ignore-case"),t.folderOptions.ignoreGlobCase&&(e.push("--glob-case-insensitive"),e.push("--ignore-file-case-insensitive"));let{doubleStarIncludes:n,otherIncludes:o}=ju(t.folderOptions.includes,s=>s.startsWith("**")?"doubleStarIncludes":"otherIncludes");if(o&&o.length){let s=new Set;o.forEach(a=>{s.add(a)}),e.push("-g","!*"),s.forEach(a=>{xj(a).map(df).forEach(l=>{e.push("-g",l)})})}n&&n.length&&n.forEach(s=>{e.push("-g",s)}),t.folderOptions.excludes.map(s=>typeof s=="string"?s:s.pattern).map(df).forEach(s=>e.push("-g",`!${s}`)),t.maxFileSize&&e.push("--max-filesize",t.maxFileSize+""),t.folderOptions.useIgnoreFiles.local?t.folderOptions.useIgnoreFiles.parent||e.push("--no-ignore-parent"):e.push("--no-ignore"),t.folderOptions.followSymlinks&&e.push("--follow"),t.folderOptions.encoding&&t.folderOptions.encoding!=="utf8"&&e.push("--encoding",t.folderOptions.encoding),t.numThreads&&e.push("--threads",`${t.numThreads}`),r.pattern==="--"&&(r.isRegExp=!0,r.pattern="\\-\\-"),r.isMultiline&&!r.isRegExp&&(r.pattern=pr(r.pattern),r.isRegExp=!0),t.usePCRE2&&e.push("--pcre2"),e.push("--crlf"),r.isRegExp&&(r.pattern=Sj(r.pattern),e.push("--engine","auto"));let i;if(r.isWordMatch){let a=dI(r.pattern,!!r.isRegExp,{wholeWord:r.isWordMatch}).source.replace(/\\\//g,"/");e.push("--regexp",a)}else if(r.isRegExp){let s=Cj(r.pattern);s=Tj(s),e.push("--regexp",s)}else i=r.pattern,e.push("--fixed-strings");return e.push("--no-config"),t.folderOptions.useIgnoreFiles.global||e.push("--no-ignore-global"),e.push("--json"),r.isMultiline&&e.push("--multiline"),t.surroundingContext&&(e.push("--before-context",t.surroundingContext+""),e.push("--after-context",t.surroundingContext+"")),e.push("--"),i&&e.push(i),e.push("."),e}function xj(r){return xB(r).flatMap(e=>{let n=va(e,"/");return n.map((o,i)=>n.slice(0,i+1).join("/"))})}function Sj(r){let t=/((?:[^\\]|^)(?:\\\\)*)\\u([a-z0-9]{4})/gi;for(;r.match(t);)r=r.replace(t,"$1\\x{$2}");let e=/((?:[^\\]|^)(?:\\\\)*)\\u\{([a-z0-9]{4})\}/gi;for(;r.match(e);)r=r.replace(e,"$1\\x{$2}");return r}var yB=r=>r.type==="Assertion"&&r.kind==="lookbehind";function Cj(r){let t;try{t=new fj().parsePattern(r)}catch{return r}let e="",n=0,o=(a,l,d)=>{e+=r.slice(n,a)+d,n=l},i=[];return new hj({onCharacterEnter(a){if(a.raw!=="\\n")return;let l=i[0];if(!l)o(a.start,a.end,"\\r?\\n");else if(!i.some(yB))if(l.type==="CharacterClass")if(l.negate){let d=r.slice(l.start+2,a.start)+r.slice(a.end,l.end-1);l.parent?.type==="Quantifier"?o(l.start,l.end,d?`[^${d}]`:"."):o(l.start,l.end,"(?!\\r?\\n"+(d?`|[${d}]`:"")+")")}else{let d=r.slice(l.start+1,a.start)+r.slice(a.end,l.end-1);o(l.start,l.end,d===""?"\\r?\\n":`(?:[${d}]|\\r?\\n)`)}else l.type==="Quantifier"&&o(a.start,a.end,"(?:\\r?\\n)")},onQuantifierEnter(a){i.unshift(a)},onQuantifierLeave(){i.shift()},onCharacterClassRangeEnter(a){i.unshift(a)},onCharacterClassRangeLeave(){i.shift()},onCharacterClassEnter(a){i.unshift(a)},onCharacterClassLeave(){i.shift()},onAssertionEnter(a){yB(a)&&i.push(a)},onAssertionLeave(a){i[0]===a&&i.shift()}}).visit(t),e+=r.slice(n),e}function Tj(r){return r.replace(/\n/g,"\\r?\\n")}function Ej(r){let t=!1,e=!1,n="",o="";for(let i=0;i<r.length;i++){let s=r[i];switch(s){case"\\":e?(t?o+="\\"+s:n+="\\"+s,e=!1):e=!0;break;case"{":if(e)t?o+=s:n+=s,e=!1;else{if(t)return{strInBraces:n+"{"+o+"{"+r.substring(i+1)};t=!0}break;case"}":if(e)t?o+=s:n+=s,e=!1;else{if(t)return{fixedStart:n,strInBraces:o,fixedEnd:r.substring(i+1)};n+=s}break;default:t?o+=(e?"\\":"")+s:n+=(e?"\\":"")+s,e=!1;break}}return{strInBraces:n+(t?"{"+o:"")}}function xB(r){let{fixedStart:t,strInBraces:e,fixedEnd:n}=Ej(r);if(t===void 0||n===void 0)return[e];let o=va(e,",");o.length||(o=[""]);let i=xB(n);return o.flatMap(s=>{let a=t+s;return i.map(l=>a+l)})}var pf=class extends Eu{constructor(t,e,n=bi,o="searchProcess"){super({query:t,provider:e},{readdir:i=>n.Promises.readdir(i.fsPath),toCanonicalName:i=>M4(i)},o)}};var UE=class{constructor(t,e){this.query=t;this.numThreads=e}search(t,e,n){if((!this.query.folderQueries||!this.query.folderQueries.length)&&(!this.query.extraFileResources||!this.query.extraFileResources.length))return Promise.resolve({type:"success",limitHit:!1,stats:{type:"searchProcess"},messages:[]});let o={appendLine(s){n({message:s})}},i=new pf(this.query,new uf(o,this.numThreads),bi);return new Promise((s,a)=>i.search(l=>{e(l.map(wj))},t).then(l=>s({limitHit:l.limitHit??!1,type:"success",stats:l.stats,messages:[]}),a))}};function wj(r){return{path:r.resource&&r.resource.fsPath,results:r.results,numMatches:(r.results||[]).reduce((t,e)=>pb(e)?t+e.rangeLocations.length:t+1,0)}}var FE=class r{constructor(t="searchProcess",e){this.processType=t;this.getNumThreads=e;this.caches=Object.create(null)}static{this.BATCH_SIZE=512}fileSearch(t){let e,n=SB(t),o=new E({onDidAddFirstListener:()=>{e=fr(async i=>{let s=await this.getNumThreads?.();return this.doFileSearchWithEngine(Gb,n,a=>o.fire(a),i,r.BATCH_SIZE,s)}),e.then(i=>o.fire(i),i=>o.fire({type:"error",error:{message:i.message,stack:i.stack}}))},onDidRemoveLastListener:()=>{e.cancel()}});return o.event}textSearch(t){let e,n=SB(t),o=new E({onDidAddFirstListener:()=>{e=fr(i=>this.ripgrepTextSearch(n,s=>o.fire(s),i)),e.then(i=>o.fire(i),i=>o.fire({type:"error",error:{message:i.message,stack:i.stack}}))},onDidRemoveLastListener:()=>{e.cancel()}});return o.event}async ripgrepTextSearch(t,e,n){t.maxFileSize=this.getPlatformFileLimits().maxFileSize;let o=await this.getNumThreads?.();return new UE(t,o).search(n,e,e)}getPlatformFileLimits(){return{maxFileSize:16*pc.GB}}doFileSearch(t,e,n,o){return this.doFileSearchWithEngine(Gb,t,n,o,r.BATCH_SIZE,e)}doFileSearchWithEngine(t,e,n,o,i=r.BATCH_SIZE,s){let a=0,l=c=>{Array.isArray(c)?(a+=c.length,n(c.map(u=>this.rawMatchToSearchItem(u)))):c.relativePath?(a++,n(this.rawMatchToSearchItem(c))):n(c)};if(e.sortByScore){let c=this.trySortedSearchFromCache(e,l,o);if(!c){let u=e.maxResults?Object.assign({},e,{maxResults:null}):e,m=new t(u,s);c=this.doSortedSearch(m,e,n,l,o)}return new Promise((u,m)=>{c.then(([g,h])=>{let f=h.map(I=>this.rawMatchToSearchItem(I));this.sendProgress(f,n,i),u(g)},m)})}let d=new t(e,s);return this.doSearch(d,l,i,o).then(c=>({limitHit:c.limitHit,type:"success",stats:{detailStats:c.stats,type:this.processType,fromCache:!1,resultCount:a,sortingTime:void 0},messages:[]}))}rawMatchToSearchItem(t){return{path:t.base?Ne(t.base,t.relativePath):t.relativePath}}doSortedSearch(t,e,n,o,i){let s=new E,a=fr(d=>{let c=[],u=m=>{Array.isArray(m)?c=m:(o(m),s.fire(m))};return this.doSearch(t,u,-1,d).then(m=>[m,c])}),l;if(e.cacheKey){l=this.getOrCreateCache(e.cacheKey);let d={promise:a,event:s.event,resolved:!1};l.resultsToSearchCache[e.filePattern||""]=d,a.then(()=>{d.resolved=!0},c=>{delete l.resultsToSearchCache[e.filePattern||""]}),a=this.preventCancellation(a)}return a.then(([d,c])=>{let u=l?l.scorerCache:Object.create(null),m=(typeof e.maxResults!="number"||e.maxResults>0)&&an.create(!1);return this.sortResults(e,c,u,i).then(g=>{let h=m?m.elapsed():-1;return[{type:"success",stats:{detailStats:d.stats,sortingTime:h,fromCache:!1,type:this.processType,resultCount:g.length},messages:d.messages,limitHit:d.limitHit||typeof e.maxResults=="number"&&c.length>e.maxResults},g]})})}getOrCreateCache(t){let e=this.caches[t];return e||(this.caches[t]=new xL)}trySortedSearchFromCache(t,e,n){let o=t.cacheKey&&this.caches[t.cacheKey];if(!o)return;let i=this.getResultsFromCache(o,t.filePattern||"",e,n);if(i)return i.then(([s,a,l])=>{let d=an.create(!1);return this.sortResults(t,a,o.scorerCache,n).then(c=>{let u=d.elapsed(),m={fromCache:!0,detailStats:l,type:this.processType,resultCount:a.length,sortingTime:u};return[{type:"success",limitHit:s.limitHit||typeof t.maxResults=="number"&&a.length>t.maxResults,stats:m,messages:[]},c]})})}sortResults(t,e,n,o){let i=jb(t.filePattern||""),s=(l,d)=>dB(l,d,i,!0,kj,n),a=typeof t.maxResults=="number"?t.maxResults:md;return HN(e,s,a,1e4,o)}sendProgress(t,e,n){if(n&&n>0)for(let o=0;o<t.length;o+=n)e(t.slice(o,o+n));else e(t)}getResultsFromCache(t,e,n,o){let i=an.create(!1),s=e.indexOf(xt)>=0,a;for(let u in t.resultsToSearchCache)if(e.startsWith(u)){if(s&&u.indexOf(xt)<0&&u!=="")continue;let m=t.resultsToSearchCache[u];a={promise:this.preventCancellation(m.promise),event:m.event,resolved:m.resolved};break}if(!a)return null;let l=i.elapsed(),d=an.create(!1),c=a.event(n);return o&&o.onCancellationRequested(()=>{c.dispose()}),a.promise.then(([u,m])=>{if(o&&o.isCancellationRequested)throw Ys();let g=[],h=jb(e).normalizedLowercase;for(let f of m)mb(f,h)&&g.push(f);return[u,g,{cacheWasResolved:a.resolved,cacheLookupTime:l,cacheFilterTime:d.elapsed(),cacheEntryCount:m.length}]})}doSearch(t,e,n,o){return new Promise((i,s)=>{let a=[];o?.onCancellationRequested(()=>t.cancel()),t.search(l=>{l&&(n?(a.push(l),n>0&&a.length>=n&&(e(a),a=[])):e(l))},l=>{e(l)},(l,d)=>{a.length&&e(a),l?(e({message:"Search finished. Error: "+l.message}),s(l)):(e({message:"Search finished. Stats: "+JSON.stringify(d.stats)}),i(d))})})}clearCache(t){return delete this.caches[t],Promise.resolve(void 0)}preventCancellation(t){return new class{get[Symbol.toStringTag](){return this.toString()}cancel(){}then(e,n){return t.then(e,n)}catch(e){return this.then(void 0,e)}finally(e){return t.finally(e)}}}},xL=class{constructor(){this.resultsToSearchCache=Object.create(null);this.scorerCache=Object.create(null)}},kj=new class{getItemLabel(r){return nt(r.relativePath)}getItemDescription(r){return cn(r.relativePath)}getItemPath(r){return r.relativePath}};function SB(r){return{...r,folderQueries:r.folderQueries&&r.folderQueries.map(Pj),extraFileResources:r.extraFileResources&&r.extraFileResources.map(t=>b.revive(t))}}function Pj(r){return ht(r)}var Jb=class{constructor(t,e){this.outputChannel=t;this.getNumThreads=e;this.inProgress=new Set;process.once("exit",()=>this.dispose())}async provideTextSearchResults(t,e,n,o){let i=await this.getNumThreads(),s=new uf(this.outputChannel,i);return Promise.all(e.folderOptions.map(a=>{let l={folderOptions:a,numThreads:i,maxResults:e.maxResults,previewOptions:e.previewOptions,maxFileSize:e.maxFileSize,surroundingContext:e.surroundingContext};if(a.folder.scheme===V.vscodeUserData){let d={...l,folder:a.folder.with({scheme:V.file})},c=new us(u=>n.report({...u,uri:u.uri.with({scheme:a.folder.scheme})}));return this.withToken(o,u=>s.provideTextSearchResultsWithRgOptions(t,d,c,u))}else return this.withToken(o,d=>s.provideTextSearchResultsWithRgOptions(t,l,n,d))})).then((a=>({limitHit:a.some(d=>!!d&&d.limitHit)})))}async withToken(t,e){let n=_j(t);this.inProgress.add(n);let o=await e(n.token);return this.inProgress.delete(n),o}dispose(){this.inProgress.forEach(t=>t.cancel())}};function _j(r){let t=new Ce;return r.onCancellationRequested(()=>t.cancel()),t}var mf=class extends Pd{constructor(e,n,o,i,s){super(e,o,s);this.configurationService=i;this._pfs=bi;this._internalFileSearchHandle=-1;this._internalFileSearchProvider=null;this._registeredEHSearchProvider=!1;this._disposables=new $;this.isDisposed=!1;this.getNumThreads=this.getNumThreads.bind(this),this.getNumThreadsCached=this.getNumThreadsCached.bind(this),this.handleConfigurationChanged=this.handleConfigurationChanged.bind(this);let a=new Du("RipgrepSearchUD",this._logService);this._disposables.add(this.registerTextSearchProvider(V.vscodeUserData,new Jb(a,this.getNumThreadsCached))),n.remote.isRemote&&n.remote.authority&&this._registerEHSearchProviders(),i.getConfigProvider().then(l=>{this.isDisposed||this._disposables.add(l.onDidChangeConfiguration(this.handleConfigurationChanged))})}handleConfigurationChanged(e){e.affectsConfiguration("search")&&(this._numThreadsPromise=void 0)}async getNumThreads(){return(await this.configurationService.getConfigProvider()).getConfiguration("search").get("ripgrep.maxThreads")}async getNumThreadsCached(){return this._numThreadsPromise||(this._numThreadsPromise=this.getNumThreads()),this._numThreadsPromise}dispose(){this.isDisposed=!0,this._disposables.dispose()}$enableExtensionHostSearch(){this._registerEHSearchProviders()}_registerEHSearchProviders(){if(this._registeredEHSearchProvider)return;this._registeredEHSearchProvider=!0;let e=new Du("RipgrepSearchEH",this._logService);this._disposables.add(this.registerTextSearchProvider(V.file,new Jb(e,this.getNumThreadsCached))),this._disposables.add(this.registerInternalFileSearchProvider(V.file,new FE("fileSearchProvider",this.getNumThreadsCached)))}registerInternalFileSearchProvider(e,n){let o=this._handlePool++;return this._internalFileSearchProvider=n,this._internalFileSearchHandle=o,this._proxy.$registerFileSearchProvider(o,this._transformScheme(e)),K(()=>{this._internalFileSearchProvider=null,this._proxy.$unregisterProvider(o)})}$provideFileSearchResults(e,n,o,i){let s=Lb(o);if(e===this._internalFileSearchHandle){let a=Date.now();return this.doInternalFileSearch(e,n,s,i).then(l=>{let d=Date.now()-a;return this._logService.debug(`Ext host file search time: ${d}ms`),l})}return super.$provideFileSearchResults(e,n,o,i)}async doInternalFileSearchWithCustomCallback(e,n,o){let i=a=>{if(w4(a)&&(a=[a]),Array.isArray(a)){o(a.map(l=>b.file(l.path)));return}a.message&&this._logService.debug("ExtHostSearch",a.message)};if(!this._internalFileSearchProvider)throw new Error("No internal file search handler");let s=await this.getNumThreadsCached();return this._internalFileSearchProvider.doFileSearch(e,s,i,n)}async doInternalFileSearch(e,n,o,i){return this.doInternalFileSearchWithCustomCallback(o,i,s=>{this._proxy.$handleFileMatch(e,n,s)})}$clearCache(e){return this._internalFileSearchProvider?.clearCache(e),super.$clearCache(e)}createTextSearchManager(e,n){return new pf(e,n,void 0,"textSearchProvider")}};mf=_([C(0,se),C(1,Ye),C(2,ds),C(3,Sn),C(4,oe)],mf);function SL(r,t,e,n,o,i){if(Array.isArray(r)){let s=0;for(let a of r){let l=SL(a,t,e,n,o,i);if(l===10)return l;l>s&&(s=l)}return s}else{if(typeof r=="string")return n?r==="*"?5:r===e?10:0:0;if(r){let{language:s,pattern:a,scheme:l,hasAccessToAllModels:d,notebookType:c}=r;if(!n&&!d)return 0;c&&o&&(t=o);let u=0;if(l)if(l===t.scheme)u=10;else if(l==="*")u=5;else return 0;if(s)if(s===e)u=10;else if(s==="*")u=Math.max(u,5);else return 0;if(c)if(c===i)u=10;else if(c==="*"&&i!==void 0)u=Math.max(u,5);else return 0;if(a){let m;if(typeof a=="string"?m=a:m={...a,base:bo(a.base)},m===t.fsPath||nr(m,t.fsPath))u=10;else return 0}return u}else return 0}}function CL(r){return typeof r=="string"?!1:Array.isArray(r)?r.some(CL):!!r.notebookType}var TL=(o=>(o[o.None=0]="None",o[o.Indent=1]="Indent",o[o.IndentOutdent=2]="IndentOutdent",o[o.Outdent=3]="Outdent",o))(TL||{});var Eqe=R("editSessionIdentityService"),EL=(n=>(n[n.Complete=100]="Complete",n[n.Partial=50]="Partial",n[n.None=0]="None",n))(EL||{});var HE=class{constructor(t){this._relatedInformationProviders=new Map;this._nextHandle=0;this._proxy=t.getProxy(F.MainThreadAiRelatedInformation)}async $provideAiRelatedInformation(t,e,n){if(this._relatedInformationProviders.size===0)throw new Error("No related information providers registered");let o=this._relatedInformationProviders.get(t);if(!o)throw new Error("related information provider not found");return await o.provideRelatedInformation(e,n)??[]}getRelatedInformation(t,e,n){return this._proxy.$getAiRelatedInformation(e,n)}registerRelatedInformationProvider(t,e,n){let o=this._nextHandle;return this._nextHandle++,this._relatedInformationProviders.set(o,n),this._proxy.$registerAiRelatedInformationProvider(o,e),new be(()=>{this._proxy.$unregisterAiRelatedInformationProvider(o),this._relatedInformationProviders.delete(o)})}};var WE=class{constructor(t){this._settingsSearchProviders=new Map;this._nextHandle=0;this._proxy=t.getProxy(F.MainThreadAiSettingsSearch)}async $startSearch(t,e,n,o){if(this._settingsSearchProviders.size===0)throw new Error("No related information providers registered");let i=this._settingsSearchProviders.get(t);if(!i)throw new Error("Settings search provider not found");let s=new us(a=>{this._proxy.$handleSearchResult(t,TM.fromSettingsSearchResult(a))});return i.provideSettingsSearchResults(e,n,s,o)}registerSettingsSearchProvider(t,e){let n=this._nextHandle;return this._nextHandle++,this._settingsSearchProviders.set(n,e),this._proxy.$registerAiSettingsSearchProvider(n),new be(()=>{this._proxy.$unregisterAiSettingsSearchProvider(n),this._settingsSearchProviders.delete(n)})}};function CB(r){for(let t=0,e=r.length;t<e;t+=4){let n=r[t+0],o=r[t+1],i=r[t+2],s=r[t+3];r[t+0]=s,r[t+1]=i,r[t+2]=o,r[t+3]=n}}function Rj(r){let t=new Uint8Array(r.buffer,r.byteOffset,r.length*4);return Zy()||CB(t),H.wrap(t)}function Aj(r){let t=r.buffer;if(Zy()||CB(t),t.byteOffset%4===0)return new Uint32Array(t.buffer,t.byteOffset,t.length/4);{let e=new Uint8Array(t.byteLength);return e.set(t),new Uint32Array(e.buffer,e.byteOffset,e.length/4)}}function VE(r){let t=new Uint32Array(Mj(r)),e=0;if(t[e++]=r.id,r.type==="full")t[e++]=1,t[e++]=r.data.length,t.set(r.data,e),e+=r.data.length;else{t[e++]=2,t[e++]=r.deltas.length;for(let n of r.deltas)t[e++]=n.start,t[e++]=n.deleteCount,n.data?(t[e++]=n.data.length,t.set(n.data,e),e+=n.data.length):t[e++]=0}return Rj(t)}function Mj(r){let t=0;if(t+=2,r.type==="full")t+=1+r.data.length;else{t+=1,t+=3*r.deltas.length;for(let e of r.deltas)e.data&&(t+=e.data.length)}return t}function wL(r){let t=Aj(r),e=0,n=t[e++];if(t[e++]===1){let a=t[e++],l=t.subarray(e,e+a);return e+=a,{id:n,type:"full",data:l}}let i=t[e++],s=[];for(let a=0;a<i;a++){let l=t[e++],d=t[e++],c=t[e++],u;c>0&&(u=t.subarray(e,e+c),e+=c),s[a]={start:l,deleteCount:d,data:u}}return{id:n,type:"delta",deltas:s}}var Lj=[new Re("vscode.executeDocumentHighlights","_executeDocumentHighlights","Execute document highlight provider.",[Z.Uri,Z.Position],new ke("A promise that resolves to an array of DocumentHighlight-instances.",zi(ou.to))),new Re("vscode.executeDocumentSymbolProvider","_executeDocumentSymbolProvider","Execute document symbol provider.",[Z.Uri],new ke("A promise that resolves to an array of SymbolInformation and DocumentSymbol instances.",(r,t)=>{if(sh(r))return;class e extends Or{constructor(){super(...arguments);this.containerName=""}static to(i){let s=new e(i.name,Ur.to(i.kind),i.containerName||"",new en(t[0],j.to(i.range)));return s.detail=i.detail,s.range=s.location.range,s.selectionRange=j.to(i.selectionRange),s.children=i.children?i.children.map(e.to):[],s}}return r.map(e.to)})),new Re("vscode.executeFormatDocumentProvider","_executeFormatDocumentProvider","Execute document format provider.",[Z.Uri,new Z("options","Formatting options",r=>!0,r=>r)],new ke("A promise that resolves to an array of TextEdits.",zi(Pn.to))),new Re("vscode.executeFormatRangeProvider","_executeFormatRangeProvider","Execute range format provider.",[Z.Uri,Z.Range,new Z("options","Formatting options",r=>!0,r=>r)],new ke("A promise that resolves to an array of TextEdits.",zi(Pn.to))),new Re("vscode.executeFormatOnTypeProvider","_executeFormatOnTypeProvider","Execute format on type provider.",[Z.Uri,Z.Position,new Z("ch","Trigger character",r=>typeof r=="string",r=>r),new Z("options","Formatting options",r=>!0,r=>r)],new ke("A promise that resolves to an array of TextEdits.",zi(Pn.to))),new Re("vscode.executeDefinitionProvider","_executeDefinitionProvider","Execute all definition providers.",[Z.Uri,Z.Position],new ke("A promise that resolves to an array of Location or LocationLink instances.",Md)),new Re("vscode.experimental.executeDefinitionProvider_recursive","_executeDefinitionProvider_recursive","Execute all definition providers.",[Z.Uri,Z.Position],new ke("A promise that resolves to an array of Location or LocationLink instances.",Md)),new Re("vscode.executeTypeDefinitionProvider","_executeTypeDefinitionProvider","Execute all type definition providers.",[Z.Uri,Z.Position],new ke("A promise that resolves to an array of Location or LocationLink instances.",Md)),new Re("vscode.experimental.executeTypeDefinitionProvider_recursive","_executeTypeDefinitionProvider_recursive","Execute all type definition providers.",[Z.Uri,Z.Position],new ke("A promise that resolves to an array of Location or LocationLink instances.",Md)),new Re("vscode.executeDeclarationProvider","_executeDeclarationProvider","Execute all declaration providers.",[Z.Uri,Z.Position],new ke("A promise that resolves to an array of Location or LocationLink instances.",Md)),new Re("vscode.experimental.executeDeclarationProvider_recursive","_executeDeclarationProvider_recursive","Execute all declaration providers.",[Z.Uri,Z.Position],new ke("A promise that resolves to an array of Location or LocationLink instances.",Md)),new Re("vscode.executeImplementationProvider","_executeImplementationProvider","Execute all implementation providers.",[Z.Uri,Z.Position],new ke("A promise that resolves to an array of Location or LocationLink instances.",Md)),new Re("vscode.experimental.executeImplementationProvider_recursive","_executeImplementationProvider_recursive","Execute all implementation providers.",[Z.Uri,Z.Position],new ke("A promise that resolves to an array of Location or LocationLink instances.",Md)),new Re("vscode.executeReferenceProvider","_executeReferenceProvider","Execute all reference providers.",[Z.Uri,Z.Position],new ke("A promise that resolves to an array of Location-instances.",zi(po.to))),new Re("vscode.experimental.executeReferenceProvider","_executeReferenceProvider_recursive","Execute all reference providers.",[Z.Uri,Z.Position],new ke("A promise that resolves to an array of Location-instances.",zi(po.to))),new Re("vscode.executeHoverProvider","_executeHoverProvider","Execute all hover providers.",[Z.Uri,Z.Position],new ke("A promise that resolves to an array of Hover-instances.",zi($m.to))),new Re("vscode.experimental.executeHoverProvider_recursive","_executeHoverProvider_recursive","Execute all hover providers.",[Z.Uri,Z.Position],new ke("A promise that resolves to an array of Hover-instances.",zi($m.to))),new Re("vscode.executeSelectionRangeProvider","_executeSelectionRangeProvider","Execute selection range provider.",[Z.Uri,new Z("position","A position in a text document",r=>Array.isArray(r)&&r.every(t=>we.isPosition(t)),r=>r.map(ct.from))],new ke("A promise that resolves to an array of ranges.",r=>r.map(t=>{let e;for(let n of t.reverse())e=new Ss(j.to(n),e);return e}))),new Re("vscode.executeWorkspaceSymbolProvider","_executeWorkspaceSymbolProvider","Execute all workspace symbol providers.",[Z.String.with("query","Search string")],new ke("A promise that resolves to an array of SymbolInformation-instances.",r=>r.map(cd.to))),new Re("vscode.prepareCallHierarchy","_executePrepareCallHierarchy","Prepare call hierarchy at a position inside a document",[Z.Uri,Z.Position],new ke("A promise that resolves to an array of CallHierarchyItem-instances",r=>r.map(Ha.to))),new Re("vscode.provideIncomingCalls","_executeProvideIncomingCalls","Compute incoming calls for an item",[Z.CallHierarchyItem],new ke("A promise that resolves to an array of CallHierarchyIncomingCall-instances",r=>r.map(X1.to))),new Re("vscode.provideOutgoingCalls","_executeProvideOutgoingCalls","Compute outgoing calls for an item",[Z.CallHierarchyItem],new ke("A promise that resolves to an array of CallHierarchyOutgoingCall-instances",r=>r.map(Z1.to))),new Re("vscode.prepareRename","_executePrepareRename","Execute the prepareRename of rename provider.",[Z.Uri,Z.Position],new ke("A promise that resolves to a range and placeholder text.",r=>{if(r)return{range:j.to(r.range),placeholder:r.text}})),new Re("vscode.executeDocumentRenameProvider","_executeDocumentRenameProvider","Execute rename provider.",[Z.Uri,Z.Position,Z.String.with("newName","The new symbol name")],new ke("A promise that resolves to a WorkspaceEdit.",r=>{if(r){if(r.rejectReason)throw new Error(r.rejectReason);return mo.to(r)}})),new Re("vscode.executeLinkProvider","_executeLinkProvider","Execute document link provider.",[Z.Uri,Z.Number.with("linkResolveCount","Number of links that should be resolved, only when links are unresolved.").optional()],new ke("A promise that resolves to an array of DocumentLink-instances.",r=>r.map(Wa.to))),new Re("vscode.provideDocumentSemanticTokensLegend","_provideDocumentSemanticTokensLegend","Provide semantic tokens legend for a document",[Z.Uri],new ke("A promise that resolves to SemanticTokensLegend.",r=>{if(r)return new qc(r.tokenTypes,r.tokenModifiers)})),new Re("vscode.provideDocumentSemanticTokens","_provideDocumentSemanticTokens","Provide semantic tokens for a document",[Z.Uri],new ke("A promise that resolves to SemanticTokens.",r=>{if(!r)return;let t=wL(r);if(t.type==="full")return new Oi(t.data,void 0)})),new Re("vscode.provideDocumentRangeSemanticTokensLegend","_provideDocumentRangeSemanticTokensLegend","Provide semantic tokens legend for a document range",[Z.Uri,Z.Range.optional()],new ke("A promise that resolves to SemanticTokensLegend.",r=>{if(r)return new qc(r.tokenTypes,r.tokenModifiers)})),new Re("vscode.provideDocumentRangeSemanticTokens","_provideDocumentRangeSemanticTokens","Provide semantic tokens for a document range",[Z.Uri,Z.Range],new ke("A promise that resolves to SemanticTokens.",r=>{if(!r)return;let t=wL(r);if(t.type==="full")return new Oi(t.data,void 0)})),new Re("vscode.executeCompletionItemProvider","_executeCompletionItemProvider","Execute completion item provider.",[Z.Uri,Z.Position,Z.String.with("triggerCharacter","Trigger completion when the user types the character, like `,` or `(`").optional(),Z.Number.with("itemResolveCount","Number of completions to resolve (too large numbers slow down completions)").optional()],new ke("A promise that resolves to a CompletionList-instance.",(r,t,e)=>{if(!r)return new Pi([]);let n=r.suggestions.map(o=>rM.to(o,e));return new Pi(n,r.incomplete)})),new Re("vscode.executeSignatureHelpProvider","_executeSignatureHelpProvider","Execute signature help provider.",[Z.Uri,Z.Position,Z.String.with("triggerCharacter","Trigger signature help when the user types the character, like `,` or `(`").optional()],new ke("A promise that resolves to SignatureHelp.",r=>{if(r)return zm.to(r)})),new Re("vscode.executeCodeLensProvider","_executeCodeLensProvider","Execute code lens provider.",[Z.Uri,Z.Number.with("itemResolveCount","Number of lenses that should be resolved and returned. Will only return resolved lenses, will impact performance)").optional()],new ke("A promise that resolves to an array of CodeLens-instances.",(r,t,e)=>zi(n=>new Ul(j.to(n.range),n.command&&e.fromInternal(n.command)))(r))),new Re("vscode.executeCodeActionProvider","_executeCodeActionProvider","Execute code action provider.",[Z.Uri,new Z("rangeOrSelection","Range in a text document. Some refactoring provider requires Selection object.",r=>fe.isRange(r),r=>Jn.isSelection(r)?Eo.from(r):j.from(r)),Z.String.with("kind","Code action kind to return code actions for").optional(),Z.Number.with("itemResolveCount","Number of code actions to resolve (too large numbers slow down code actions)").optional()],new ke("A promise that resolves to an array of Command-instances.",(r,t,e)=>zi(n=>{if(n._isSynthetic){if(!n.command)throw new Error("Synthetic code actions must have a command");return e.fromInternal(n.command)}else{let o=new xs(n.title,n.kind?new St(n.kind):void 0);return n.edit&&(o.edit=mo.to(n.edit)),n.command&&(o.command=e.fromInternal(n.command)),o.isPreferred=n.isPreferred,o}})(r))),new Re("vscode.executeDocumentColorProvider","_executeDocumentColorProvider","Execute document color provider.",[Z.Uri],new ke("A promise that resolves to an array of ColorInformation objects.",r=>r?r.map(t=>new Bl(j.to(t.range),lu.to(t.color))):[])),new Re("vscode.executeColorPresentationProvider","_executeColorPresentationProvider","Execute color presentation provider.",[new Z("color","The color to show and insert",r=>r instanceof _i,lu.from),new Z("context","Context object with uri and range",r=>!0,r=>({uri:r.uri,range:j.from(r.range)}))],new ke("A promise that resolves to an array of ColorPresentation objects.",r=>r?r.map(tb.to):[])),new Re("vscode.executeInlayHintProvider","_executeInlayHintProvider","Execute inlay hints provider",[Z.Uri,Z.Range],new ke("A promise that resolves to an array of Inlay objects",(r,t,e)=>r.map(iM.to.bind(void 0,e)))),new Re("vscode.executeFoldingRangeProvider","_executeFoldingRangeProvider","Execute folding range provider",[Z.Uri],new ke("A promise that resolves to an array of FoldingRange objects",(r,t)=>{if(r)return r.map(ob.to)})),new Re("vscode.resolveNotebookContentProviders","_resolveNotebookContentProvider","Resolve Notebook Content Providers",[],new ke("A promise that resolves to an array of NotebookContentProvider static info objects.",zi(r=>({viewType:r.viewType,displayName:r.displayName,options:{transientOutputs:r.options.transientOutputs,transientCellMetadata:r.options.transientCellMetadata,transientDocumentMetadata:r.options.transientDocumentMetadata},filenamePattern:r.filenamePattern.map(t=>ib.to(t))})))),new Re("vscode.executeInlineValueProvider","_executeInlineValueProvider","Execute inline value provider",[Z.Uri,Z.Range,new Z("context","An InlineValueContext",r=>r&&typeof r.frameId=="number"&&r.stoppedLocation instanceof fe,r=>eb.from(r))],new ke("A promise that resolves to an array of InlineValue objects",r=>r.map(Zv.to))),new Re("vscode.open","_workbench.open","Opens the provided resource in the editor. Can be a text or binary file, or an http(s) URL. If you need more control over the options for opening a text file, use vscode.window.showTextDocument instead.",[new Z("uriOrString","Uri-instance or string (only http/https)",r=>b.isUri(r)||typeof r=="string"&&KU(r,V.http,V.https),r=>r),new Z("columnOrOptions","Either the column in which to open or editor options, see vscode.TextDocumentShowOptions",r=>r===void 0||typeof r=="number"||typeof r=="object",r=>r&&(typeof r=="number"?[Vt.from(r),void 0]:[Vt.from(r.viewColumn),rb.from(r)])).optional(),Z.String.with("label","").optional()],ke.Void),new Re("vscode.openWith","_workbench.openWith","Opens the provided resource with a specific editor.",[Z.Uri.with("resource","Resource to open"),Z.String.with("viewId","Custom editor view id. This should be the viewType string for custom editors or the notebookType string for notebooks. Use 'default' to use VS Code's default text editor"),new Z("columnOrOptions","Either the column in which to open or editor options, see vscode.TextDocumentShowOptions",r=>r===void 0||typeof r=="number"||typeof r=="object",r=>r&&(typeof r=="number"?[Vt.from(r),void 0]:[Vt.from(r.viewColumn),rb.from(r)])).optional()],ke.Void),new Re("vscode.diff","_workbench.diff","Opens the provided resources in the diff editor to compare their contents.",[Z.Uri.with("left","Left-hand side resource of the diff editor"),Z.Uri.with("right","Right-hand side resource of the diff editor"),Z.String.with("title","Human readable title for the diff editor").optional(),new Z("columnOrOptions","Either the column in which to open or editor options, see vscode.TextDocumentShowOptions",r=>r===void 0||typeof r=="object",r=>r&&[Vt.from(r.viewColumn),rb.from(r)]).optional()],ke.Void),new Re("vscode.changes","_workbench.changes","Opens a list of resources in the changes editor to compare their contents.",[Z.String.with("title","Human readable title for the changes editor"),new Z("resourceList","List of resources to compare",r=>{for(let t of r){if(t.length!==3)return!1;let[e,n,o]=t;if(!b.isUri(e)||!b.isUri(n)&&n!==void 0&&n!==null||!b.isUri(o)&&o!==void 0&&o!==null)return!1}return!0},r=>r)],ke.Void),new Re("vscode.prepareTypeHierarchy","_executePrepareTypeHierarchy","Prepare type hierarchy at a position inside a document",[Z.Uri,Z.Position],new ke("A promise that resolves to an array of TypeHierarchyItem-instances",r=>r.map(Va.to))),new Re("vscode.provideSupertypes","_executeProvideSupertypes","Compute supertypes for an item",[Z.TypeHierarchyItem],new ke("A promise that resolves to an array of TypeHierarchyItem-instances",r=>r.map(Va.to))),new Re("vscode.provideSubtypes","_executeProvideSubtypes","Compute subtypes for an item",[Z.TypeHierarchyItem],new ke("A promise that resolves to an array of TypeHierarchyItem-instances",r=>r.map(Va.to))),new Re("vscode.revealTestInExplorer","_revealTestInExplorer","Reveals a test instance in the explorer",[Z.TestItem],ke.Void),new Re("vscode.startContinuousTestRun","testing.startContinuousRunFromExtension","Starts running the given tests with continuous run mode.",[Z.TestProfile,Z.Arr(Z.TestItem)],ke.Void),new Re("vscode.stopContinuousTestRun","testing.stopContinuousRunFromExtension","Stops running the given tests with continuous run mode.",[Z.Arr(Z.TestItem)],ke.Void),new Re("vscode.experimental.editSession.continue","_workbench.editSessions.actions.continueEditSession","Continue the current edit session in a different workspace",[Z.Uri.with("workspaceUri","The target workspace to continue the current edit session in")],ke.Void),new Re("setContext","_setContext","Set a custom context key value that can be used in when clauses.",[Z.String.with("name","The context key name"),new Z("value","The context key value",()=>!0,r=>r)],ke.Void),new Re("vscode.editorChat.start","inlineChat.start","Invoke a new editor chat session",[new Z("Run arguments","",r=>!0,r=>{if(r)return{initialRange:r.initialRange?j.from(r.initialRange):void 0,initialSelection:Jn.isSelection(r.initialSelection)?Eo.from(r.initialSelection):void 0,message:r.message,attachments:r.attachments,autoSend:r.autoSend,position:r.position?ct.from(r.position):void 0,resolveOnResponse:r.resolveOnResponse}})],ke.Void),new Re("vscode.extensionPromptFileProvider","_listExtensionPromptFiles","Get all extension-contributed prompt files (custom agents, instructions, and prompt files).",[],new ke("A promise that resolves to an array of objects containing uri, type, and extensionId.",r=>r?r.map(t=>({uri:b.revive(t.uri),type:t.type,extensionId:t.extensionId})):[]))],BE=class{static register(t){Lj.forEach(t.registerApiCommand,t),this._registerValidateWhenClausesCommand(t)}static _registerValidateWhenClausesCommand(t){t.registerCommand(!1,"_validateWhenClauses",UF)}};function zi(r){return t=>{if(Array.isArray(t))return t.map(r)}}function Md(r){if(!Array.isArray(r))return;let t=[];for(let e of r)q2(e)?t.push(Bm.to(e)):t.push(po.to(e));return t}var gf=class{constructor(t,e){this._proxy=t.getProxy(F.MainThreadBulkEdits),this._versionInformationProvider={getTextDocumentVersion:n=>e.getDocument(n)?.version,getNotebookDocumentVersion:()=>{}}}applyWorkspaceEdit(t,e,n){let o=new Gt(mo.from(t,this._versionInformationProvider));return this._proxy.$tryApplyWorkspaceEdit(o,void 0,n?.isRefactoring??!1)}};gf=_([C(0,se)],gf);function TB(r){return!!r&&b.isUri(r.sessionResource)&&r.$mid===19}function Oj(r){return!!r&&typeof r=="object"&&"uri"in r&&r.uri instanceof b&&"version"in r&&typeof r.version=="number"&&"ranges"in r&&Array.isArray(r.ranges)&&r.ranges.every(We.isIRange)}function EB(r){return!!r&&typeof r=="object"&&"documents"in r&&Array.isArray(r.documents)&&r.documents.every(Oj)}function wB(r){return!!r&&typeof r=="object"&&"command"in r&&"language"in r}var _t;(u=>{let r;(T=>(T[T.Streaming=0]="Streaming",T[T.WaitingForConfirmation=1]="WaitingForConfirmation",T[T.Executing=2]="Executing",T[T.WaitingForPostApproval=3]="WaitingForPostApproval",T[T.Completed=4]="Completed",T[T.Cancelled=5]="Cancelled"))(r=u.StateKind||={});function t(m,g){if(m.kind==="toolInvocationSerialized")return m.isConfirmed===void 0||typeof m.isConfirmed=="boolean"?{type:m.isConfirmed?4:0}:m.isConfirmed;let h=m.state.read(g);if(!(h.type===0||h.type===1))return h.type===5?{type:h.reason}:h.confirmed}u.executionConfirmedOrDenied=t;function e(m,g){let h=t(m);if(h)return Promise.resolve(h);let f=new $;return new Promise(I=>{g&&f.add(g.onCancellationRequested(()=>{I({type:0})})),f.add(Vo(S=>{let T=t(m,S);T&&(f.dispose(),I(T))}))}).finally(()=>{f.dispose()})}u.awaitConfirmation=e;function n(m,g){let h=m.state.read(g);if(h.type===4)return h.postConfirmed||{type:1};if(h.type===5)return{type:h.reason}}function o(m,g){let h=m?.state.get();return h?.type===1||h?.type===3?(h.confirm(g),!0):!1}u.confirmWith=o;function i(m,g){let h=n(m);if(h)return Promise.resolve(h);let f=new $;return new Promise(I=>{g&&f.add(g.onCancellationRequested(()=>{I({type:0})})),f.add(Vo(S=>{let T=n(m,S);T&&(f.dispose(),I(T))}))}).finally(()=>{f.dispose()})}u.awaitPostConfirmation=i;function s(m,g){if(m.kind==="toolInvocationSerialized")return m.resultDetails;let h=m.state.read(g);if(h.type===4||h.type===3)return h.resultDetails}u.resultDetails=s;function a(m,g){if(m.kind==="toolInvocationSerialized")return!0;let h=m.state.read(g);return h.type===4||h.type===5}u.isComplete=a;function l(m,g){return m.kind==="toolInvocationSerialized"?!1:m.state.read(g).type===0}u.isStreaming=l;function d(m,g){if(m.kind==="toolInvocationSerialized")return;let h=m.state.read(g);if(h.type!==0)return h.parameters}u.getParameters=d;function c(m,g){if(m.kind==="toolInvocationSerialized")return;let h=m.state.read(g);if(h.type!==0)return h.confirmationMessages}u.getConfirmationMessages=c})(_t||={});var Nj;(o=>{function r(i){return i.kind==="sent"}o.isSent=r;function t(i){return i.kind==="rejected"}o.isRejected=t;function e(i){return i.kind==="queued"}o.isQueued=e;function n(i){if(i.kind!=="sent")throw new Error(`Expected ChatSendResult to be 'sent', but was '${i.kind}'`)}o.assertSent=n})(Nj||={});var $s=R("IChatService");var ff=class{constructor(t,e,n,o,i,s,a){this._extension=t;this._request=e;this._proxy=n;this._commandsConverter=o;this._sessionDisposables=i;this._pendingCarouselResolvers=s;this._token=a;this._stopWatch=an.create(!1);this._isClosed=!1}close(){this._isClosed=!0}get timings(){return{firstProgress:this._firstProgress,totalElapsed:this._stopWatch.elapsed()}}get apiObject(){if(!this._apiObject){let n=function(l){if(t._isClosed){let d=new Error("Response stream has been closed");throw Error.captureStackTrace(d,l),d}},s=function(l,d){if(o.push(d!==void 0?[l,d]:l)===1&&queueMicrotask(()=>{let u=i;i=[],t._proxy.$handleProgressChunk(t._request.requestId,o).finally(()=>{u.forEach(m=>m())}),o.length=0}),d!==void 0)return new Promise(u=>{i.push(u)})},t=this;this._stopWatch.reset();let e=0,o=[],i=[],a=(l,d)=>{if(typeof this._firstProgress>"u"&&(l.kind==="markdownContent"||l.kind==="markdownVuln"||l.kind==="beginToolInvocation")&&(this._firstProgress=this._stopWatch.elapsed()),d){let c=e++,u=s(l,c),m={report:g=>{u.then(()=>{Zt.isMarkdownString(g.value)?s(cb.from(g),c):s(su.from(g),c)})}};Promise.all([u,d(m)]).then(([g,h])=>{s(gM.from(h),c)})}else s(l)};this._apiObject=Object.freeze({clearToPreviousToolInvocation(l){return n(this.markdown),s({kind:"clearToPreviousToolInvocation",reason:l}),this},markdown(l){n(this.markdown);let d=new ka(l),c=Qv.from(d);return a(c),this},markdownWithVulnerabilities(l,d){n(this.markdown),d&&A(t._extension,"chatParticipantAdditions");let c=new _s(l,d),u=cT.from(c);return a(u),this},codeblockUri(l,d){n(this.codeblockUri),A(t._extension,"chatParticipantAdditions");let c=new Aa(l,d),u=dT.from(c);return a(u),this},filetree(l,d){n(this.filetree);let c=new _a(l,d),u=Jv.from(c);return a(u),this},anchor(l,d){let c=new Ds(l,d);return this.push(c)},button(l){n(this.anchor);let d=new Ra(l),c=Yv.from(d,t._commandsConverter,t._sessionDisposables);return a(c),this},progress(l,d){n(this.progress);let c=new rd(l,d),u=d?gT.from(c):lb.from(c);return a(u,d),this},thinkingProgress(l){n(this.thinkingProgress),A(t._extension,"chatParticipantAdditions");let d=new Ni(l.text??"",l.id,l.metadata),c=db.from(d);return a(c),this},hookProgress(l,d,c){n(this.hookProgress),A(t._extension,"chatParticipantAdditions");let u=new Da(l,d,c),m=mT.from(u);return a(m),this},warning(l){n(this.progress),A(t._extension,"chatParticipantAdditions");let d=new Rs(l),c=cb.from(d);return a(c),this},reference(l,d){return this.reference2(l,d)},reference2(l,d,c){if(n(this.reference),typeof l=="object"&&"variableName"in l&&A(t._extension,"chatParticipantAdditions"),typeof l=="object"&&"variableName"in l&&!l.value){let u=t._request.variables.variables.find(m=>m.name===l.variableName);if(u){let m;if(u.references?.length)m=u.references.map(g=>({kind:"reference",reference:{variableName:l.variableName,value:g.reference}}));else{let g=new ti(l,d,c);m=[su.from(g)]}return m.forEach(g=>a(g)),this}}else{let u=new ti(l,d,c),m=su.from(u);a(m)}return this},codeCitation(l,d,c){n(this.codeCitation),A(t._extension,"chatParticipantAdditions");let u=new Ma(l,d,c),m=yT.from(u);a(m)},textEdit(l,d){n(this.textEdit),A(t._extension,"chatParticipantAdditions");let c=new Ms(l,d);c.isDone=d===!0?!0:void 0;let u=fT.from(c);return a(u),this},notebookEdit(l,d){n(this.notebookEdit),A(t._extension,"chatParticipantAdditions");let c=new Oa(l,d),u=vT.from(c);return a(u),this},workspaceEdit(l){n(this.workspaceEdit),A(t._extension,"chatParticipantAdditions");let d=new ad(l),c=bT.from(d);return a(c),this},async externalEdit(l,d){n(this.externalEdit);let c=Array.isArray(l)?l:[l],u=e++,m=Ae();await s({kind:"externalEdits",start:!0,resources:c,undoStopId:m},u);try{return await d(),m}finally{await s({kind:"externalEdits",start:!1,resources:c,undoStopId:m},u)}},confirmation(l,d,c,u){n(this.confirmation),A(t._extension,"chatParticipantAdditions");let m=new Pa(l,d,c,u),g=uT.from(m);return a(g),this},async questionCarousel(l,d=!0){n(this.questionCarousel),A(t._extension,"chatParticipantAdditions");let c=Ae(),u=new As(l,d),m=pT.from(u);m.resolveId=c;let g=new Jt;return t._pendingCarouselResolvers.has(t._request.requestId)||t._pendingCarouselResolvers.set(t._request.requestId,new Map),t._pendingCarouselResolvers.get(t._request.requestId).set(c,g),a(m),gp(g.p,t._token)},beginToolInvocation(l,d,c){n(this.beginToolInvocation),A(t._extension,"chatParticipantAdditions");let u={kind:"beginToolInvocation",toolCallId:l,toolName:d,streamData:c?{partialInput:c.partialInput}:void 0,subagentInvocationId:c?.subagentInvocationId};return a(u),this},updateToolInvocation(l,d){n(this.updateToolInvocation),A(t._extension,"chatParticipantAdditions");let c={kind:"updateToolInvocation",toolCallId:l,streamData:{partialInput:d.partialInput}};return a(c),this},push(l){if(n(this.push),(l instanceof Ms||l instanceof Oa||l instanceof _s||l instanceof Rs||l instanceof Pa||l instanceof As||l instanceof Ma||l instanceof La||l instanceof id||l instanceof Gc||l instanceof Ni||l instanceof sd||l instanceof rd)&&A(t._extension,"chatParticipantAdditions"),l instanceof ti)this.reference2(l.value,l.iconPath,l.options);else if(l instanceof rd){let d=l.task?gT.from(l):lb.from(l);a(d,l.task)}else if(l instanceof Ni){let d=db.from(l);a(d)}else if(l instanceof Ds){let d=Vm.from(l);if(l.resolve){A(t._extension,"chatParticipantAdditions"),d.resolveId=Ae();let c=new Ce;l.resolve(c.token).then(()=>{let u=Vm.from(l);t._proxy.$handleAnchorResolve(t._request.requestId,d.resolveId,u)}).then(()=>c.dispose(),()=>c.dispose()),t._sessionDisposables.add(K(()=>c.dispose(!0)))}a(d)}else{if(l instanceof Gc)return this.externalEdit(l.uris,l.callback).then(c=>l.didGetApplied(c)),this;{let d=jm.from(l,t._commandsConverter,t._sessionDisposables);a(d)}}return this},usage(l){n(this.usage),A(t._extension,"chatParticipantAdditions");let d={kind:"usage",promptTokens:l.promptTokens,completionTokens:l.completionTokens,outputBuffer:l.outputBuffer,promptTokenDetails:l.promptTokenDetails};return a(d),this}})}return this._apiObject}},$E=class r extends O{constructor(e,n,o,i,s,a,l,d){super();this._logService=n;this._commands=o;this._documents=i;this._editorsAndDocuments=s;this._languageModels=a;this._diagnostics=l;this._tools=d;this._agents=new Map;this._participantDetectionProviders=new Map;this._promptFileProviders=new Map;this._customizationProviders=new Map;this._sessionDisposables=this._register(new zy);this._completionDisposables=this._register(new Fn);this._inFlightRequests=new Set;this._pendingCarouselResolvers=new Map;this._onDidChangeChatRequestTools=this._register(new E);this.onDidChangeChatRequestTools=this._onDidChangeChatRequestTools.event;this._onDidDisposeChatSession=this._register(new E);this.onDidDisposeChatSession=this._onDidDisposeChatSession.event;this._onDidChangeCustomAgents=this._register(new E);this.onDidChangeCustomAgents=this._onDidChangeCustomAgents.event;this._onDidChangeInstructions=this._register(new E);this.onDidChangeInstructions=this._onDidChangeInstructions.event;this._onDidChangeSkills=this._register(new E);this.onDidChangeSkills=this._onDidChangeSkills.event;this._customAgents=[];this._instructions=[];this._skills=[];this._onDidChangeActiveChatPanelSessionResource=this._register(new E);this.onDidChangeActiveChatPanelSessionResource=this._onDidChangeActiveChatPanelSessionResource.event;this._proxy=e.getProxy(F.MainThreadChatAgents2),o.registerArgumentProcessor({processArgument:c=>TB(c)?null:c})}static{this._idPool=0}static{this._participantDetectionProviderIdPool=0}static{this._contributionsProviderIdPool=0}static{this._customizationProviderIdPool=0}get activeChatPanelSessionResource(){return this._activeChatPanelSessionResource}get customAgents(){return this._customAgents}get instructions(){return this._instructions}get skills(){return this._skills}$acceptCustomAgents(e){this._customAgents=e.map(n=>Object.freeze({uri:b.revive(n.uri)})),this._onDidChangeCustomAgents.fire()}$acceptInstructions(e){this._instructions=e.map(n=>Object.freeze({uri:b.revive(n.uri)})),this._onDidChangeInstructions.fire()}$acceptSkills(e){this._skills=e.map(n=>Object.freeze({uri:b.revive(n.uri)})),this._onDidChangeSkills.fire()}async transferActiveChat(e){await this._proxy.$transferActiveChatSession(e)}createChatAgent(e,n,o){let i=r._idPool++,s=new zE(e,n,this._proxy,i,o);return this._agents.set(i,s),this._proxy.$registerAgent(i,e.identifier,n,{},void 0),s.apiAgent}createDynamicChatAgent(e,n,o,i){let s=r._idPool++,a=new zE(e,n,this._proxy,s,i);return this._agents.set(s,a),this._proxy.$registerAgent(s,e.identifier,n,{isSticky:!0},o),a.apiAgent}registerChatParticipantDetectionProvider(e,n){let o=r._participantDetectionProviderIdPool++;return this._participantDetectionProviders.set(o,new kL(e,n)),this._proxy.$registerChatParticipantDetectionProvider(o),K(()=>{this._participantDetectionProviders.delete(o),this._proxy.$unregisterChatParticipantDetectionProvider(o)})}registerPromptFileProvider(e,n,o){let i=r._contributionsProviderIdPool++;this._promptFileProviders.set(i,{extension:e,provider:o}),this._proxy.$registerPromptFileProvider(i,n,e.identifier);let s=new $,a;switch(n){case"agent":a=o.onDidChangeCustomAgents;break;case"instructions":a=o.onDidChangeInstructions;break;case"prompt":a=o.onDidChangePromptFiles;break;case"skill":a=o.onDidChangeSkills;break}return a&&s.add(a(()=>{this._proxy.$onDidChangePromptFiles(i)})),s.add(K(()=>{this._promptFileProviders.delete(i),this._proxy.$unregisterPromptFileProvider(i)})),s}async $providePromptFiles(e,n,o,i){let s=this._promptFileProviders.get(e);if(!s)return;let a=s.provider,l;switch(n){case"agent":l=await a.provideCustomAgents(o,i)??void 0;break;case"instructions":l=await a.provideInstructions(o,i)??void 0;break;case"prompt":l=await a.providePromptFiles(o,i)??void 0;break;case"skill":l=await a.provideSkills(o,i)??void 0;break}return l}registerChatSessionCustomizationProvider(e,n,o,i){let s=r._customizationProviderIdPool++;this._customizationProviders.set(s,{extension:e,provider:i});let a={label:o.label,iconId:o.iconId,unsupportedTypes:o.unsupportedTypes?.map(d=>IT.from(d))};this._proxy.$registerChatSessionCustomizationProvider(s,n,a,e.identifier);let l=new $;return i.onDidChange&&l.add(i.onDidChange(()=>{this._proxy.$onDidChangeCustomizations(s)})),l.add(K(()=>{this._customizationProviders.delete(s),this._proxy.$unregisterChatSessionCustomizationProvider(s)})),l}async $provideChatSessionCustomizations(e,n){let o=this._customizationProviders.get(e);if(o)try{let i=await o.provider.provideChatSessionCustomizations(n);return i?i.map(s=>({uri:s.uri,type:IT.from(s.type),name:s.name,description:s.description,groupKey:s.groupKey,badge:s.badge,badgeTooltip:s.badgeTooltip})):void 0}catch{return}}async $detectChatParticipant(e,n,o,i,s){let a=this._participantDetectionProviders.get(e);if(!a)return;let{request:l,location:d,history:c}=await this._createRequest(n,o,a.extension),u=await this.getModelForRequest(l,a.extension),m=await this.getToolsForRequest(a.extension,l.userSelectedTools,u.id,s),g=Gm.to(l,d,u,l.modelConfiguration,this.getDiagnosticsWhenEnabled(a.extension),m,a.extension,this._logService);return a.provider.provideParticipantDetection(g,{history:c,yieldRequested:!1},{participants:i.participants,location:Qm.to(i.location)},s)}async _createRequest(e,n,o){let i=ht(e),s=await this.prepareHistoryTurns(o,i.agentId,n),a;if(i.locationData?.type==="editor"){let l=this._documents.getDocument(i.locationData.document),d=this._editorsAndDocuments.getEditor(i.locationData.id);a=new Mm(d.value,l,Eo.to(i.locationData.selection),j.to(i.locationData.wholeRange))}else if(i.locationData?.type==="notebook"){let l=this._documents.getDocument(i.locationData.sessionInputUri);a=new Lm(l)}else i.locationData?.type,"terminal";return{request:i,location:a,history:s}}async getModelForRequest(e,n){let o;if(e.userSelectedModelId&&(o=await this._languageModels.getLanguageModelByIdentifier(n,e.userSelectedModelId)),!o&&(o=await this._languageModels.getDefaultLanguageModel(n),!o))throw new Error("Language model unavailable");return o}async $setRequestTools(e,n){let o=[...this._inFlightRequests].find(s=>s.requestId===e);if(!o)return;o.extRequest.tools.clear();let i=await this.getToolsForRequest(o.extension,n,o.extRequest.model.id,ve.None);for(let[s,a]of i)o.extRequest.tools.set(s,a);this._onDidChangeChatRequestTools.fire(o.extRequest)}$setYieldRequested(e,n){let o=[...this._inFlightRequests].find(i=>i.requestId===e);o&&(o.yieldRequested=n)}async $invokeAgent(e,n,o,i){let s=this._agents.get(e);if(!s)throw new Error(`[CHAT](${e}) CANNOT invoke agent because the agent is not registered`);let a,l;try{let{request:d,location:c,history:u}=await this._createRequest(n,o,s.extension),m=this._sessionDisposables.get(d.sessionResource);m||(m=new $,this._sessionDisposables.set(d.sessionResource,m)),a=new ff(s.extension,d,this._proxy,this._commands.converter,m,this._pendingCarouselResolvers,i);let g=await this.getModelForRequest(d,s.extension),h=await this.getToolsForRequest(s.extension,d.userSelectedTools,g.id,i),f=Gm.to(d,c,g,d.modelConfiguration,this.getDiagnosticsWhenEnabled(s.extension),h,s.extension,this._logService);l={requestId:n.requestId,extRequest:f,extension:s.extension,hooks:d.hooks,yieldRequested:!1},this._inFlightRequests.add(l);let I;o.chatSessionContext&&(I={chatSessionItem:{resource:b.revive(o.chatSessionContext.chatSessionResource),label:o.chatSessionContext.isUntitled?"Untitled Session":"Session"},isUntitled:o.chatSessionContext.isUntitled,initialSessionOptions:o.chatSessionContext.initialSessionOptions});let S={history:u,chatSessionContext:I,get yieldRequested(){return l?.yieldRequested??!1}},T=s.invoke(f,S,a.apiObject,i);return await Uj(1e3,Promise.resolve(T).then(P=>{if(P?.metadata)try{JSON.stringify(P.metadata)}catch(q){let N=`result.metadata MUST be JSON.stringify-able. Got error: ${q.message}`;return this._logService.error(`[${s.extension.identifier.value}] [@${s.id}] ${N}`,s.extension),{errorDetails:{message:N},timings:a?.timings,nextQuestion:P.nextQuestion}}let L;return P?.errorDetails&&(L={...P.errorDetails,responseIsIncomplete:!0}),(L?.responseIsRedacted||L?.isQuotaExceeded||L?.isRateLimited||L?.confirmationButtons||L?.code)&&A(s.extension,"chatParticipantPrivate"),{errorDetails:L,timings:a?.timings,metadata:P?.metadata,nextQuestion:P?.nextQuestion,details:P?.details}}),i)}catch(d){this._logService.error(d,s.extension),d instanceof Tr&&d.cause&&(d=d.cause);let c=d instanceof Error&&d.name==="ChatQuotaExceeded",u=d instanceof Error&&d.name==="ChatRateLimited";return{errorDetails:{message:Io(d),responseIsIncomplete:!0,isQuotaExceeded:c,isRateLimited:u}}}finally{l&&this._inFlightRequests.delete(l);let d=this._pendingCarouselResolvers.get(n.requestId);if(d){for(let c of d.values())c.complete(void 0);this._pendingCarouselResolvers.delete(n.requestId)}a?.close()}}getDiagnosticsWhenEnabled(e){return He(e,"chatReferenceDiagnostic")?this._diagnostics.getDiagnostics():[]}async getToolsForRequest(e,n,o,i){if(!n)return new Map;let s=new Map;for(let a of this._tools.getTools(e))typeof n[a.name]=="boolean"&&s.set(a,n[a.name]);return s}async prepareHistoryTurns(e,n,o){let i=[];for(let s of o.history){let a=Jm.to(s.result),l=n===s.request.agentId||kB(s.request.agentId)&&kB(n)?a:{...a,metadata:void 0},d=[],c=[];for(let f of s.request.variables.variables)if(f.kind==="tool")c.push(au.to(f));else if(f.kind==="toolset")c.push(...f.value.map(au.to));else{let I=xT.to(f,this.getDiagnosticsWhenEnabled(e),this._logService);I&&d.push(I)}let u=He(e,"chatParticipantPrivate")?s.request.editedFileEvents:void 0,m=He(e,"chatParticipantPrivate")&&s.request.modeInstructions?uu.to(s.request.modeInstructions):void 0,g=new Ls(s.request.message,s.request.command,d,s.request.agentId,c,u,s.request.requestId,void 0,m);i.push(g);let h=tt(s.response.map(f=>jm.toContent(f,this._commands.converter)));i.push(new wm(h,l,s.request.agentId,s.request.command))}return i}$releaseSession(e){let n=b.revive(e);this._sessionDisposables.deleteAndDispose(n);let o=Qr.parseLocalSessionId(n);o&&this._onDidDisposeChatSession.fire(o)}$acceptActiveChatSession(e){let n=e?b.revive(e):void 0;this._activeChatPanelSessionResource?.toString()!==n?.toString()&&(this._activeChatPanelSessionResource=n,this._onDidChangeActiveChatPanelSessionResource.fire(n))}async $provideFollowups(e,n,o,i,s){let a=this._agents.get(n);if(!a)return Promise.resolve([]);let l=ht(e),d=await this.prepareHistoryTurns(a.extension,a.id,i),c=Jm.to(o);return(await a.provideFollowups(c,{history:d,yieldRequested:!1},s)).filter(u=>{let m=!u.participant||Nt.some(this._agents.values(),g=>g.id===u.participant&&Ee.equals(g.extension.identifier,a.extension.identifier));return m||this._logService.warn(`[@${a.id}] ChatFollowup refers to an unknown participant: ${u.participant}`),m}).map(u=>aT.from(u,l))}$acceptFeedback(e,n,o){let i=this._agents.get(e);if(!i)return;let s=Jm.to(n),a;switch(o.direction){case 0:a=0;break;case 1:a=1;break}let l={result:s,kind:a};i.acceptFeedback(Object.freeze(l))}$handleQuestionCarouselAnswer(e,n,o){let i=this._pendingCarouselResolvers.get(e);if(!i)return;let s=i.get(n);s&&(s.complete(o),i.delete(n)),i.size===0&&this._pendingCarouselResolvers.delete(e)}$acceptAction(e,n,o){let i=this._agents.get(e);if(!i||o.action.kind==="vote")return;let s=vM.to(n,o,this._commands.converter);s&&i.acceptAction(Object.freeze(s))}async $invokeCompletionProvider(e,n,o){let i=this._agents.get(e);if(!i)return[];let s=this._completionDisposables.get(e);return s?s.clear():(s=new $,this._completionDisposables.set(e,s)),(await i.invokeCompletionProvider(n,o)).map(l=>hM.from(l,this._commands.converter,s))}async $provideChatTitle(e,n,o){let i=this._agents.get(e);if(!i)return;let s=await this.prepareHistoryTurns(i.extension,i.id,{history:n}),a=n[0]?.request.sessionResource?b.revive(n[0].request.sessionResource):void 0;return await i.provideTitle({history:s,sessionResource:a,yieldRequested:!1},o)}async $provideChatSummary(e,n,o){let i=this._agents.get(e);if(!i)return;let s=await this.prepareHistoryTurns(i.extension,i.id,{history:n}),a=n[0]?.request.sessionResource?b.revive(n[0].request.sessionResource):void 0;return await i.provideSummary({history:s,sessionResource:a,yieldRequested:!1},o)}},kL=class{constructor(t,e){this.extension=t;this.provider=e}},zE=class{constructor(t,e,n,o,i){this.extension=t;this.id=e;this._proxy=n;this._handle=o;this._requestHandler=i;this._onDidReceiveFeedback=new E;this._onDidPerformAction=new E;this._pauseStateEmitter=new E}acceptFeedback(t){this._onDidReceiveFeedback.fire(t)}acceptAction(t){this._onDidPerformAction.fire(t)}setChatRequestPauseState(t){this._pauseStateEmitter.fire(t)}async invokeCompletionProvider(t,e){return this._agentVariableProvider?await this._agentVariableProvider.provider.provideCompletionItems(t,e)??[]:[]}async provideFollowups(t,e,n){if(!this._followupProvider)return[];let o=await this._followupProvider.provideFollowups(t,e,n);return o?o.filter(i=>!(i&&"commandId"in i)).filter(i=>!(i&&"message"in i)):[]}async provideTitle(t,e){if(this._titleProvider)return await this._titleProvider.provideChatTitle(t,e)??void 0}async provideSummary(t,e){if(this._summarizer)return await this._summarizer.provideChatSummary(t,e)??void 0}get apiAgent(){let t=!1,e=!1,n=()=>{t||e||(e=!0,queueMicrotask(()=>{this._proxy.$updateAgent(this._handle,{icon:this._iconPath?this._iconPath instanceof b?this._iconPath:"light"in this._iconPath?this._iconPath.light:void 0:void 0,iconDark:this._iconPath&&"dark"in this._iconPath?this._iconPath.dark:void 0,themeIcon:this._iconPath instanceof un?this._iconPath:void 0,hasFollowups:this._followupProvider!==void 0,helpTextPrefix:!this._helpTextPrefix||typeof this._helpTextPrefix=="string"?this._helpTextPrefix:ue.from(this._helpTextPrefix),helpTextPostfix:!this._helpTextPostfix||typeof this._helpTextPostfix=="string"?this._helpTextPostfix:ue.from(this._helpTextPostfix),supportIssueReporting:this._supportIssueReporting,additionalWelcomeMessage:!this._additionalWelcomeMessage||typeof this._additionalWelcomeMessage=="string"?this._additionalWelcomeMessage:ue.from(this._additionalWelcomeMessage)}),e=!1}))},o=this;return{get id(){return o.id},get iconPath(){return o._iconPath},set iconPath(i){o._iconPath=i,n()},get requestHandler(){return o._requestHandler},set requestHandler(i){ep(typeof i=="function","Invalid request handler"),o._requestHandler=i},get followupProvider(){return o._followupProvider},set followupProvider(i){o._followupProvider=i,n()},get helpTextPrefix(){return A(o.extension,"defaultChatParticipant"),o._helpTextPrefix},set helpTextPrefix(i){A(o.extension,"defaultChatParticipant"),o._helpTextPrefix=i,n()},get helpTextPostfix(){return A(o.extension,"defaultChatParticipant"),o._helpTextPostfix},set helpTextPostfix(i){A(o.extension,"defaultChatParticipant"),o._helpTextPostfix=i,n()},get supportIssueReporting(){return A(o.extension,"chatParticipantPrivate"),o._supportIssueReporting},set supportIssueReporting(i){A(o.extension,"chatParticipantPrivate"),o._supportIssueReporting=i,n()},get onDidReceiveFeedback(){return o._onDidReceiveFeedback.event},set participantVariableProvider(i){if(A(o.extension,"chatParticipantAdditions"),o._agentVariableProvider=i,i){if(!i.triggerCharacters.length)throw new Error("triggerCharacters are required");o._proxy.$registerAgentCompletionsProvider(o._handle,o.id,i.triggerCharacters)}else o._proxy.$unregisterAgentCompletionsProvider(o._handle,o.id)},get participantVariableProvider(){return A(o.extension,"chatParticipantAdditions"),o._agentVariableProvider},set additionalWelcomeMessage(i){A(o.extension,"defaultChatParticipant"),o._additionalWelcomeMessage=i,n()},get additionalWelcomeMessage(){return A(o.extension,"defaultChatParticipant"),o._additionalWelcomeMessage},set titleProvider(i){A(o.extension,"defaultChatParticipant"),o._titleProvider=i,n()},get titleProvider(){return A(o.extension,"defaultChatParticipant"),o._titleProvider},set summarizer(i){A(o.extension,"defaultChatParticipant"),o._summarizer=i},get summarizer(){return A(o.extension,"defaultChatParticipant"),o._summarizer},get onDidChangePauseState(){return A(o.extension,"chatParticipantAdditions"),o._pauseStateEmitter.event},onDidPerformAction:He(this.extension,"chatParticipantAdditions")?this._onDidPerformAction.event:void 0,dispose(){t=!0,o._followupProvider=void 0,o._onDidReceiveFeedback.dispose(),o._onDidPerformAction.dispose(),o._pauseStateEmitter.dispose(),o._proxy.$unregisterAgent(o._handle)}}}invoke(t,e,n,o){return this._requestHandler(t,e,n,o)}};function Uj(r,t,e){return new Promise((n,o)=>{let i=e.onCancellationRequested(async()=>{i.dispose(),await Ut(r),n(void 0)});t.then(n,o).finally(()=>i.dispose())})}function kB(r){return r.startsWith("github.copilot")}var qE=class{constructor(t,e){this.webviews=e;this._renderers=new Map;this._proxy=t.getProxy(F.MainThreadChatOutputRenderer)}registerChatOutputRenderer(t,e,n){if(this._renderers.has(e))throw new Error(`Chat output renderer already registered for: ${e}`);return this._renderers.set(e,{extension:t,renderer:n}),this._proxy.$registerChatOutputRenderer(e,t.identifier,t.extensionLocation),new be(()=>{this._renderers.delete(e),this._proxy.$unregisterChatOutputRenderer(e)})}async $renderChatOutput(t,e,n,o,i){let s=this._renderers.get(t);if(!s)throw new Error(`No chat output renderer registered for: ${t}`);let a=this.webviews.createNewWebview(o,{},s.extension),l=Object.freeze({webview:a,onDidDispose:a._onDidDispose});return s.renderer.renderChatOutput(Object.freeze({mime:e,value:n.buffer}),l,{},i)}};var _L=class{#e;#t;#n;#o;#s;#i;#l;#a;#d;#c;#r;constructor(t,e,n){this.resource=t,this.#e=e,this.#r=n}get label(){return this.#e}set label(t){this.#e!==t&&(this.#e=t,this.#r())}get iconPath(){return this.#t}set iconPath(t){this.#t!==t&&(this.#t=t,this.#r())}get description(){return this.#n}set description(t){this.#n!==t&&(this.#n=t,this.#r())}get badge(){return this.#o}set badge(t){this.#o!==t&&(this.#o=t,this.#r())}get status(){return this.#s}set status(t){this.#s!==t&&(this.#s=t,this.#r())}get archived(){return this.#i}set archived(t){this.#i!==t&&(this.#i=t,this.#r())}get tooltip(){return this.#l}set tooltip(t){this.#l!==t&&(this.#l=t,this.#r())}get timing(){return this.#a}set timing(t){this.#a!==t&&(this.#a=t,this.#r())}get changes(){return this.#d}set changes(t){this.#d!==t&&(this.#d=t,this.#r())}get metadata(){return this.#c}set metadata(t){if(t!==void 0)try{JSON.stringify(t)}catch{throw new Error("metadata must be JSON-serializable")}qt(this.#c,t)||(this.#c=t,this.#r())}};function Hj(r,t){let e={addedOrUpdated:new Ke,removed:new kr};for(let[n,o]of t)r.get(n)!==o&&e.addedOrUpdated.set(n,o);for(let n of r.keys())t.has(n)||e.removed.add(n);return e}function Wj(r){return{addedOrUpdated:r.addedOrUpdated?Array.from(r.addedOrUpdated.values(),pd.from):[],removed:r.removed?Array.from(r.removed.keys()):[]}}var KE=class{#e=new Ke;#t;#n;constructor(t,e){this.#t=e,this.#n=t}get size(){return this.#e.size}replace(t){if(!t.length&&!this.#e.size)return;let e=new Ke(t.map(o=>[o.resource,o])),n=Hj(this.#e,e);!n.addedOrUpdated?.size&&!n.removed?.size||(this.#e=e,this.#t.$updateChatSessionItems(this.#n,Wj(n)))}forEach(t,e){for(let[n,o]of this.#e)t.call(e,o,this)}add(t){let e=this.#e.get(t.resource);e&&e===t||(this.#e.set(t.resource,t),this.#t.$addOrUpdateChatSessionItem(this.#n,pd.from(t)))}delete(t){this.#e.delete(t)&&this.#t.$updateChatSessionItems(this.#n,{addedOrUpdated:[],removed:[t]})}get(t){return this.#e.get(t)}[Symbol.iterator](){return this.#e.entries()}},DL=class{constructor(t,e,n,o,i,s){this.session=t;this.extension=e;this.proxy=o;this.commandsConverter=i;this.sessionDisposables=s;this._pendingCarouselResolvers=new Map;this._stream=new ff(e,n,o,i,s,this._pendingCarouselResolvers,ve.None)}get activeResponseStream(){return this._stream}getActiveRequestStream(t){return new ff(this.extension,t,this.proxy,this.commandsConverter,this.sessionDisposables,this._pendingCarouselResolvers,ve.None)}},hf=class extends O{constructor(e,n,o,i){super();this.commands=e;this._languageModels=n;this._extHostRpc=o;this._logService=i;this._itemControllerHandlePool=0;this._chatSessionItemControllers=new Map;this._contentProviderHandlePool=0;this._chatSessionContentProviders=new Map;this._extHostChatSessions=new Ke;this._providerOptionGroups=new Map;this._proxy=this._extHostRpc.getProxy(F.MainThreadChatSessions),e.registerArgumentProcessor({processArgument:s=>{if(s&&s.$mid===25){let a=s.session.resource;for(let{controller:l}of this._chatSessionItemControllers.values()){let d=l.items.get(a);if(d)return d}return this._logService.warn(`No chat session found with uri: ${a}`),s}return s}})}registerChatSessionItemProvider(e,n,o){let i=this._itemControllerHandlePool++,s=new $,a=s.add(new E),l=new KE(i,this._proxy),d={id:n,items:l,createChatSessionItem:(c,u)=>{throw new Error("Not implemented for providers")},onDidChangeChatSessionItemState:a.event,newChatSessionItemHandler:void 0,dispose:()=>{s.dispose()},refreshHandler:async c=>{let u=await o.provideChatSessionItems(c)??[];l.replace(u)}};return this._chatSessionItemControllers.set(i,{chatSessionType:n,controller:d,extension:e,disposable:s,onDidChangeChatSessionItemStateEmitter:a}),this._proxy.$registerChatSessionItemController(i,n),o.onDidChangeChatSessionItems&&s.add(o.onDidChangeChatSessionItems(()=>{this._logService.trace(`ExtHostChatSessions. Provider items changed for ${n}`),d.refreshHandler(ve.None)})),o.onDidCommitChatSessionItem&&s.add(o.onDidCommitChatSessionItem(c=>{let{original:u,modified:m}=c;this._proxy.$onDidCommitChatSessionItem(i,u.resource,m.resource)})),{dispose:()=>{this._chatSessionItemControllers.delete(i),s.dispose(),this._proxy.$unregisterChatSessionItemController(i)}}}createChatSessionItemController(e,n,o){let i=this._itemControllerHandlePool++,s=new $,a=!1,l,d,c=s.add(new E),u=new KE(i,this._proxy),m=Object.freeze({id:n,refreshHandler:async g=>{if(a)throw new Error("ChatSessionItemController has been disposed");this._logService.trace(`ExtHostChatSessions. Controller(${n}).refresh()`),await o(g)},items:u,onDidChangeChatSessionItemState:c.event,createChatSessionItem:(g,h)=>{if(a)throw new Error("ChatSessionItemController has been disposed");let f=new _L(g,h,()=>{u.get(g)===f&&this._proxy.$addOrUpdateChatSessionItem(i,pd.from(f))});return f},get newChatSessionItemHandler(){return l},set newChatSessionItemHandler(g){l=g},get forkHandler(){return d},set forkHandler(g){d=g},dispose:()=>{a=!0,s.dispose()}});return this._chatSessionItemControllers.set(i,{controller:m,extension:e,disposable:s,chatSessionType:n,onDidChangeChatSessionItemStateEmitter:c}),this._proxy.$registerChatSessionItemController(i,n),s.add(K(()=>{this._chatSessionItemControllers.delete(i),this._proxy.$unregisterChatSessionItemController(i)})),m}registerChatSessionContentProvider(e,n,o,i,s){let a=this._contentProviderHandlePool++,l=new $;return this._chatSessionContentProviders.set(a,{provider:i,extension:e,capabilities:s,disposable:l}),this._proxy.$registerChatSessionContentProvider(a,n),i.onDidChangeChatSessionOptions&&l.add(i.onDidChangeChatSessionOptions(d=>{let c=Object.create(null);for(let u of d.updates)c[u.optionId]=u.value;this._proxy.$onDidChangeChatSessionOptions(a,d.resource,c)})),i.onDidChangeChatSessionProviderOptions&&l.add(i.onDidChangeChatSessionProviderOptions(()=>{this._proxy.$onDidChangeChatSessionProviderOptions(a)})),new be(()=>{this._chatSessionContentProviders.delete(a),l.dispose(),this._proxy.$unregisterChatSessionContentProvider(a)})}async $provideChatSessionContent(e,n,o,i){let s=this._chatSessionContentProviders.get(e);if(!s)throw new Error(`No provider for handle ${e}`);let a=b.revive(n),l=await s.provider.provideChatSessionContent(a,i,{sessionOptions:o?.initialSessionOptions??[]});if(i.isCancellationRequested)throw new Be;let d=this.getChatSessionItemController(a.scheme),c=new $,u=a.toString(),m=new DL(l,s.extension,{sessionResource:a,requestId:"ongoing",agentId:u,message:"",variables:{variables:[]},location:"panel"},{$handleProgressChunk:(f,I)=>this._proxy.$handleProgressChunk(e,a,f,I),$handleAnchorResolve:(f,I,S)=>{this._proxy.$handleAnchorResolve(e,a,f,I,S)}},this.commands.converter,c),g=c.add(new Ce);this._extHostChatSessions.set(a,{sessionObj:m,disposeCts:g}),l.activeResponseCallback&&Promise.resolve(l.activeResponseCallback(m.activeResponseStream.apiObject,g.token)).finally(()=>{this._proxy.$handleProgressComplete(e,a,"ongoing")});let{capabilities:h}=s;return{resource:b.revive(a),title:l.title,hasActiveResponseCallback:!!l.activeResponseCallback,hasRequestHandler:!!l.requestHandler,hasForkHandler:!!d?.controller.forkHandler||!!l.forkHandler,supportsInterruption:!!h?.supportsInterruptions,options:l.options,history:l.history.map(f=>f instanceof Ls?this.convertRequestTurn(f):this.convertResponseTurn(f,c))}}async $provideHandleOptionsChange(e,n,o,i){let s=b.revive(n),a=this._chatSessionContentProviders.get(e);if(!a){this._logService.warn(`No provider for handle ${e}`);return}if(!a.provider.provideHandleOptionsChange){this._logService.debug(`Provider for handle ${e} does not implement provideHandleOptionsChange`);return}try{let l=Object.entries(o).map(([d,c])=>({optionId:d,value:c===void 0?void 0:typeof c=="string"?c:c.id}));a.provider.provideHandleOptionsChange(s,l,i)}catch(l){this._logService.error(`Error calling provideHandleOptionsChange for handle ${e}, sessionResource ${s}:`,l)}}async $provideChatSessionProviderOptions(e,n){let o=this._chatSessionContentProviders.get(e);if(!o){this._logService.warn(`No provider for handle ${e} when requesting chat session options`);return}let i=o.provider;if(i.provideChatSessionProviderOptions)try{let s=await i.provideChatSessionProviderOptions(n);if(!s)return;let{optionGroups:a,newSessionOptions:l}=s;return a&&this._providerOptionGroups.set(e,a),{optionGroups:a,newSessionOptions:l}}catch(s){this._logService.error(`Error calling provideChatSessionProviderOptions for handle ${e}:`,s);return}}async $interruptChatSessionActiveResponse(e,n,o){this._extHostChatSessions.get(b.revive(n))?.disposeCts.cancel()}async $disposeChatSessionContent(e,n){let o=this._extHostChatSessions.get(b.revive(n));if(!o){this._logService.warn(`No chat session found for resource: ${n}`);return}o.disposeCts.cancel(),o.sessionObj.sessionDisposables.dispose(),this._extHostChatSessions.delete(b.revive(n))}async $invokeChatSessionRequestHandler(e,n,o,i,s){let a=this._extHostChatSessions.get(b.revive(n));if(!a||!a.sessionObj.session.requestHandler)return{};let l=Gm.to(o,void 0,await this.getModelForRequest(o,a.sessionObj.extension),o.modelConfiguration,[],new Map,a.sessionObj.extension,this._logService),d=a.sessionObj.getActiveRequestStream(o);return await a.sessionObj.session.requestHandler(l,{history:i,yieldRequested:!1},d.apiObject,s),{}}async $forkChatSession(e,n,o,i){let s=b.revive(n),a=this._extHostChatSessions.get(s);if(!a)throw new Error(`No chat session found for resource ${s.toString()}`);let l=this.convertRequestDtoToRequestTurn(o),d=this.getChatSessionItemController(s.scheme);if(d?.controller.forkHandler){let u=await d.controller.forkHandler(s,l,i);return pd.from(u)}if(!a.sessionObj.session.forkHandler)throw new Error(`No fork handler for session ${s.toString()}`);let c=await a.sessionObj.session.forkHandler(s,l,i);return pd.from(c)}convertRequestDtoToRequestTurn(e){if(e)return new Ls(e.prompt,e.command,[],e.participant,[],void 0,e.id,e.modelId,uu.to(e.modeInstructions))}getChatSessionItemController(e){for(let n of this._chatSessionItemControllers.values())if(n.chatSessionType===e)return n}async getModelForRequest(e,n){let o;if(e.userSelectedModelId&&(o=await this._languageModels.getLanguageModelByIdentifier(n,e.userSelectedModelId)),!o&&(o=await this._languageModels.getDefaultLanguageModel(n),!o))throw new Error("Language model unavailable");return o}convertRequestTurn(e){let n=e.references.map(o=>this.convertReferenceToVariable(o));return{type:"request",id:e.id,prompt:e.prompt,participant:e.participant,command:e.command,variableData:n.length>0?{variables:n}:void 0,modelId:e.modelId,modeInstructions:uu.from(e.modeInstructions2)}}convertReferenceToVariable(e){let n=e.value&&typeof e.value=="object"&&"uri"in e.value&&"range"in e.value?ri.from(e.value):e.value,o=e.range?{start:e.range[0],endExclusive:e.range[1]}:void 0;if(n&&n instanceof ld&&Array.isArray(n.diagnostics)&&n.diagnostics.length&&n.diagnostics[0][1].length){let a=Fa.from(n.diagnostics[0][1][0]),l={filterRange:{startLineNumber:a.startLineNumber,startColumn:a.startColumn,endLineNumber:a.endLineNumber,endColumn:a.endColumn},filterSeverity:a.severity,filterUri:n.diagnostics[0][0],problemMessage:n.diagnostics[0][1][0].message};return sv.toEntry(l)}if(en.isLocation(e.value)&&e.name.startsWith("sym:")){let a=ri.from(e.value);return{id:e.id,name:e.name,fullName:e.name.substring(4),value:{uri:e.value.uri,range:a.range},symbolKind:6,icon:AR.toIcon(6),kind:"symbol",range:o}}if(b.isUri(n)&&e.name.startsWith("prompt:")){if(e.id.startsWith("vscode.instructions.file.root"))return Pl(n,"vscode.instructions.file.root");if(e.id.startsWith("vscode.instructions.file.reference"))return Pl(n,"vscode.instructions.file.reference");if(e.id.startsWith("vscode.prompt.file"))return Pl(n,"vscode.prompt.file")}let i=b.isUri(n)||n&&typeof n=="object"&&"uri"in n,s=i&&b.isUri(n)&&n.path.endsWith("/");return{id:e.id,name:e.name,value:n,modelDescription:e.modelDescription,range:o,kind:s?"directory":i?"file":"generic"}}convertResponseTurn(e,n){return{type:"response",parts:tt(e.response.map(i=>jm.from(i,this.commands.converter,n))),participant:e.participant}}async $invokeOptionGroupSearch(e,n,o,i){let s=this._providerOptionGroups.get(e);if(!s)return this._logService.warn(`No option groups found for provider handle ${e}`),[];let a=s.find(l=>l.id===n);if(!a||!a.onSearch)return this._logService.warn(`No onSearch callback found for option group ${n}`),[];try{return await a.onSearch(o,i)??[]}catch(l){return this._logService.error(`Error calling onSearch for option group ${n}:`,l),[]}}async $refreshChatSessionItems(e,n){let o=this._chatSessionItemControllers.get(e);if(!o){this._logService.warn(`No controller found for handle ${e}`);return}await o.controller.refreshHandler(n)}async $newChatSessionItem(e,n,o){let i=this._chatSessionItemControllers.get(e);if(!i){this._logService.warn(`No controller found for handle ${e}`);return}let s=i.controller.newChatSessionItemHandler;if(!s)return;let a=await s({request:{prompt:n.prompt,command:n.command},sessionOptions:n.initialSessionOptions??[]},o);if(a)return pd.from(a)}$onDidChangeChatSessionItemState(e,n,o){let i=this._chatSessionItemControllers.get(e);if(!i){this._logService.warn(`No controller found for handle ${e}`);return}let s=b.revive(n),a=i.controller.items.get(s);if(!a){this._logService.warn(`No item found for session resource ${s.toString()}`);return}a.archived=o,i.onDidChangeChatSessionItemStateEmitter.fire(a)}};hf=_([C(2,se),C(3,oe)],hf);var jE=class{constructor(t){this._items=new Map;this._proxy=t.getProxy(F.MainThreadChatStatus)}createChatStatusItem(t,e){let n=Vj(t.identifier,e);if(this._items.has(n))throw new Error(`Chat status item '${e}' already exists`);let o={id:n,title:"",description:"",detail:""},i=!1,s=!1,a=()=>{if(i)throw new Error("Chat status item is disposed");s&&this._proxy.$setEntry(e,o)},l=Object.freeze({id:e,get title(){return o.title},set title(d){o.title=d,a()},get description(){return o.description},set description(d){o.description=d,a()},get detail(){return o.detail},set detail(d){o.detail=d,a()},show:()=>{s=!0,a()},hide:()=>{s=!1,this._proxy.$disposeEntry(e)},dispose:()=>{i=!0,this._proxy.$disposeEntry(e),this._items.delete(n)}});return this._items.set(n,l),l}};function Vj(r,t){return`${Ee.toKey(r)}.${t}`}var GE=class{constructor(t){let e=t.getProxy(F.MainThreadClipboard);this.value=Object.freeze({readText(){return e.$readText()},writeText(n){return e.$writeText(n)}})}};var PB="vscode-cdn.net",Bj=`vscode-resource.${PB}`,Yb=`'self' https://*.${PB}`;function Ld(r,t){return r.scheme===V.http||r.scheme===V.https?r:(t&&t.authority&&t.isRemote&&r.scheme===V.file&&(r=b.from({scheme:V.vscodeRemote,authority:t.authority,path:r.path})),b.from({scheme:V.https,authority:`${r.scheme}+${$j(r.authority)}.${Bj}`,path:r.path,fragment:r.fragment,query:r.query}))}function $j(r){return r.replace(/./g,t=>{let e=t.charCodeAt(0);return e>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57?t:"-"+e.toString(16).padStart(4,"0")})}var QE=class{constructor(t,e,n){this._proxy=t;this._editors=e;this._remoteInfo=n;this._handlePool=0;this._disposables=new $;this._insets=new Map;this._disposables.add(e.onDidChangeVisibleTextEditors(()=>{let o=e.getVisibleTextEditors();for(let i of this._insets.values())o.indexOf(i.editor)<0&&i.inset.dispose()}))}dispose(){this._insets.forEach(t=>t.inset.dispose()),this._disposables.dispose()}createWebviewEditorInset(t,e,n,o,i){let s;for(let g of this._editors.getVisibleTextEditors(!0))if(g.value===t){s=g;break}if(!s)throw new Error("not a visible editor");let a=this,l=this._handlePool++,d=new E,c=new E,u=new class{constructor(){this._html="";this._options=Object.create(null)}asWebviewUri(g){return Ld(g,a._remoteInfo)}get cspSource(){return Yb}set options(g){this._options=g,a._proxy.$setOptions(l,g)}get options(){return this._options}set html(g){this._html=g,a._proxy.$setHtml(l,g)}get html(){return this._html}get onDidReceiveMessage(){return d.event}postMessage(g){return a._proxy.$postMessage(l,g)}},m=new class{constructor(){this.editor=t;this.line=e;this.height=n;this.webview=u;this.onDidDispose=c.event}dispose(){a._insets.delete(l)&&(a._proxy.$disposeEditorInset(l),c.fire(),c.dispose(),d.dispose())}};return this._proxy.$createEditorInset(l,s.id,s.value.document.uri,e+1,n,o||{},i.identifier,i.extensionLocation),this._insets.set(l,{editor:t,inset:m,onDidReceiveMessage:d}),m}$onDidDispose(t){let e=this._insets.get(t);e&&e.inset.dispose()}$onDidReceiveMessage(t,e){this._insets.get(t)?.onDidReceiveMessage.fire(e)}};var JE=class r{constructor(t){this.providers=new Map;this._proxy=t.getProxy(F.MainThreadCodeMapper)}static{this._providerHandlePool=0}async $mapCode(t,e,n){let o=this.providers.get(t);if(!o)throw new Error(`Received request to map code for unknown provider handle ${t}`);let i={textEdit:(l,d)=>{d=Dn(d),this._proxy.$handleProgress(e.requestId,{uri:l,edits:d.map(Pn.from)})},notebookEdit:(l,d)=>{d=Dn(d),this._proxy.$handleProgress(e.requestId,{uri:l,edits:d.map(hT.from)})}},s={location:e.location,chatRequestId:e.chatRequestId,chatRequestModel:e.chatRequestModel,chatSessionId:e.chatSessionResource?Qr.parseLocalSessionId(b.revive(e.chatSessionResource)):void 0,codeBlocks:e.codeBlocks.map(l=>({code:l.code,resource:b.revive(l.resource),markdownBeforeBlock:l.markdownBeforeBlock}))};return await o.provideMappedEdits(s,i,n)??null}registerMappedEditsProvider(t,e){let n=r._providerHandlePool++;return this._proxy.$registerCodeMapperProvider(n,t.displayName??t.name),this.providers.set(n,e),{dispose:()=>this._proxy.$unregisterCodeMapperProvider(n)}}};function _B(r,t,e){let n=r.getProxy(F.MainThreadComments);class o{constructor(){this._commentControllers=new Map;this._commentControllersByExtension=new uo;t.registerArgumentProcessor({processArgument:f=>{if(f&&f.$mid===6){let I=this._commentControllers.get(f.handle);return I?I.value:f}else if(f&&f.$mid===7){let I=f,S=this._commentControllers.get(I.commentControlHandle);if(!S)return I;let T=S.getCommentThread(I.commentThreadHandle);return T?T.value:I}else if(f&&(f.$mid===9||f.$mid===8)){let I=this._commentControllers.get(f.thread.commentControlHandle);if(!I)return f;let S=I.getCommentThread(f.thread.commentThreadHandle);return S?f.$mid===8?S.value:{thread:S.value,text:f.text}:f}else if(f&&f.$mid===10){let I=this._commentControllers.get(f.thread.commentControlHandle);if(!I)return f;let S=I.getCommentThread(f.thread.commentThreadHandle);if(!S)return f;let T=f.commentUniqueId,P=S.getCommentByUniqueId(T);return P||f}else if(f&&f.$mid===11){let I=this._commentControllers.get(f.thread.commentControlHandle);if(!I)return f;let S=I.getCommentThread(f.thread.commentThreadHandle);if(!S)return f;let T=f.text,P=f.commentUniqueId,L=S.getCommentByUniqueId(P);return L?(typeof L.body=="string"?L.body=T:L.body=new Zt(T),L):f}return f}})}static{this.handlePool=0}createCommentController(f,I,S){let T=o.handlePool++,P=new s(f,T,I,S);this._commentControllers.set(P.handle,P);let L=this._commentControllersByExtension.get(f.identifier)||[];return L.push(P),this._commentControllersByExtension.set(f.identifier,L),P.value}async $createCommentThreadTemplate(f,I,S,T){let P=this._commentControllers.get(f);P&&P.$createCommentThreadTemplate(I,S,T)}async $setActiveComment(f,I){let S=this._commentControllers.get(f);S&&S.$setActiveComment(I??void 0)}async $updateCommentThreadTemplate(f,I,S){let T=this._commentControllers.get(f);T&&T.$updateCommentThreadTemplate(I,S)}$deleteCommentThread(f,I){this._commentControllers.get(f)?.$deleteCommentThread(I)}async $updateCommentThread(f,I,S){this._commentControllers.get(f)?.$updateCommentThread(I,S)}async $provideCommentingRanges(f,I,S){let T=this._commentControllers.get(f);if(!T||!T.commentingRangeProvider)return Promise.resolve(void 0);let P=await e.ensureDocumentData(b.revive(I));return hn(async()=>{let L=await T.commentingRangeProvider?.provideCommentingRanges(P.document,S),q;return Array.isArray(L)?q={ranges:L,fileComments:!1}:L?q={ranges:L.ranges||[],fileComments:L.enableFileComments||!1}:q=L??void 0,q}).then(L=>{let q;return L&&(q={ranges:L.ranges.map(N=>j.from(N)),fileComments:L.fileComments}),q})}$toggleReaction(f,I,S,T,P){let L=this._commentControllers.get(f);return!L||!L.reactionHandler?Promise.resolve(void 0):hn(()=>{let q=L.getCommentThread(I);if(q){let N=q.getCommentByUniqueId(T.uniqueIdInThread);if(L!==void 0&&N&&L.reactionHandler)return L.reactionHandler(N,d(P))}return Promise.resolve(void 0)})}}let g=class g{constructor(f,I,S,T,P,L,q,N,B){this._commentControllerHandle=I;this._id=S;this._uri=T;this._range=P;this._comments=L;this.extensionDescription=q;this._isTemplate=N;this.handle=g._handlePool++;this.commentHandle=0;this.modifications=Object.create(null);this._onDidUpdateCommentThread=new E;this.onDidUpdateCommentThread=this._onDidUpdateCommentThread.event;this._canReply=!0;this._commentsMap=new Map;this._acceptInputDisposables=new sn;this._acceptInputDisposables.value=new $,this._id===void 0&&(this._id=`${f}.${this.handle}`),n.$createCommentThread(I,this.handle,this._id,this._uri,j.from(this._range),this._comments.map(J=>a(this,J,this._commentsMap,this.extensionDescription)),q.identifier,this._isTemplate,B),this._localDisposables=[],this._isDiposed=!1,this._localDisposables.push(this.onDidUpdateCommentThread(()=>{this.eventuallyUpdateCommentThread()})),this._localDisposables.push({dispose:()=>{n.$deleteCommentThread(I,this.handle)}});let G=this;this.value={get uri(){return G.uri},get range(){return G.range},set range(J){G.range=J},get comments(){return G.comments},set comments(J){G.comments=J},get collapsibleState(){return G.collapsibleState},set collapsibleState(J){G.collapsibleState=J},get canReply(){return G.canReply},set canReply(J){G.canReply=J},get contextValue(){return G.contextValue},set contextValue(J){G.contextValue=J},get label(){return G.label},set label(J){G.label=J},get state(){return G.state},set state(J){G.state=J},reveal:(J,Y)=>G.reveal(J,Y),hide:()=>G.hide(),dispose:()=>{G.dispose()}}}static{this._handlePool=0}set threadId(f){this._id=f}get threadId(){return this._id}get id(){return this._id}get resource(){return this._uri}get uri(){return this._uri}set range(f){(f===void 0!=(this._range===void 0)||!f||!this._range||!f.isEqual(this._range))&&(this._range=f,this.modifications.range=f,this._onDidUpdateCommentThread.fire())}get range(){return this._range}set canReply(f){this._canReply!==f&&(this._canReply=f,this.modifications.canReply=f,this._onDidUpdateCommentThread.fire())}get canReply(){return this._canReply}get label(){return this._label}set label(f){this._label=f,this.modifications.label=f,this._onDidUpdateCommentThread.fire()}get contextValue(){return this._contextValue}set contextValue(f){this._contextValue=f,this.modifications.contextValue=f,this._onDidUpdateCommentThread.fire()}get comments(){return this._comments}set comments(f){this._comments=f,this.modifications.comments=f,this._onDidUpdateCommentThread.fire()}get collapsibleState(){return this._collapseState}set collapsibleState(f){this._collapseState!==f&&(this._collapseState=f,this.modifications.collapsibleState=f,this._onDidUpdateCommentThread.fire())}get state(){return this._state}set state(f){this._state=f,typeof f=="object"?(A(this.extensionDescription,"commentThreadApplicability"),this.modifications.state=f.resolved,this.modifications.applicability=f.applicability):this.modifications.state=f,this._onDidUpdateCommentThread.fire()}get isDisposed(){return this._isDiposed}updateIsTemplate(){this._isTemplate&&(this._isTemplate=!1,this.modifications.isTemplate=!1)}eventuallyUpdateCommentThread(){if(this._isDiposed)return;this.updateIsTemplate(),this._acceptInputDisposables.value||(this._acceptInputDisposables.value=new $);let f=S=>Object.prototype.hasOwnProperty.call(this.modifications,S),I={};f("range")&&(I.range=j.from(this._range)),f("label")&&(I.label=this.label),f("contextValue")&&(I.contextValue=this.contextValue??null),f("comments")&&(I.comments=this._comments.map(S=>a(this,S,this._commentsMap,this.extensionDescription))),f("collapsibleState")&&(I.collapseState=c(this._collapseState)),f("canReply")&&(I.canReply=this.canReply),f("state")&&(I.state=u(this._state)),f("applicability")&&(I.applicability=m(this._state)),f("isTemplate")&&(I.isTemplate=this._isTemplate),this.modifications={},n.$updateCommentThread(this._commentControllerHandle,this.handle,this._id,this._uri,I)}getCommentByUniqueId(f){for(let I of this._commentsMap){let S=I[0],T=I[1];if(f===T)return S}}async reveal(f,I){A(this.extensionDescription,"commentReveal");let S;f&&f.body!==void 0?S=f:I=I??f;let T=S?this._commentsMap.get(S):void 0;T??=this._commentsMap.get(this._comments[0]);let P=!0,L=!1;return I?.focus===1?(L=!0,P=!1):I?.focus===2&&(P=!1),n.$revealCommentThread(this._commentControllerHandle,this.handle,T,{preserveFocus:P,focusReply:L})}async hide(){return n.$hideCommentThread(this._commentControllerHandle,this.handle)}dispose(){this._isDiposed=!0,this._acceptInputDisposables.dispose(),this._onDidUpdateCommentThread.dispose(),this._localDisposables.forEach(f=>f.dispose())}};_([rc(100)],g.prototype,"eventuallyUpdateCommentThread",1);let i=g;class s{constructor(f,I,S,T){this._extension=f;this._handle=I;this._id=S;this._label=T;this._threads=new Map;n.$registerCommentController(this.handle,S,T,this._extension.identifier.value);let P=this;this.value=Object.freeze({id:P.id,label:P.label,get options(){return P.options},set options(L){P.options=L},get commentingRangeProvider(){return P.commentingRangeProvider},set commentingRangeProvider(L){P.commentingRangeProvider=L},get reactionHandler(){return P.reactionHandler},set reactionHandler(L){P.reactionHandler=L},get activeCommentThread(){return P.activeCommentThread},createCommentThread(L,q,N){return P.createCommentThread(L,q,N).value},dispose:()=>{P.dispose()}}),this._localDisposables=[],this._localDisposables.push({dispose:()=>{n.$unregisterCommentController(this.handle)}})}get id(){return this._id}get label(){return this._label}get handle(){return this._handle}get commentingRangeProvider(){return this._commentingRangeProvider}set commentingRangeProvider(f){this._commentingRangeProvider=f,f?.resourceHints&&A(this._extension,"commentingRangeHint"),n.$updateCommentingRanges(this.handle,f?.resourceHints)}get reactionHandler(){return this._reactionHandler}set reactionHandler(f){this._reactionHandler=f,n.$updateCommentControllerFeatures(this.handle,{reactionHandler:!!f})}get options(){return this._options}set options(f){this._options=f,n.$updateCommentControllerFeatures(this.handle,{options:this._options})}get activeComment(){return A(this._extension,"activeComment"),this._activeComment}get activeCommentThread(){return A(this._extension,"activeComment"),this._activeThread?.value}createCommentThread(f,I,S){let T=new i(this.id,this.handle,void 0,f,I,S,this._extension,!1);return this._threads.set(T.handle,T),T}$setActiveComment(f){if(!f){this._activeComment=void 0,this._activeThread=void 0;return}let I=this._threads.get(f.commentThreadHandle);I&&(this._activeComment=f.uniqueIdInThread?I.getCommentByUniqueId(f.uniqueIdInThread):void 0,this._activeThread=I)}$createCommentThreadTemplate(f,I,S){let T=new i(this.id,this.handle,void 0,b.revive(f),j.to(I),[],this._extension,!0,S);return T.collapsibleState=1,this._threads.set(T.handle,T),T}$updateCommentThreadTemplate(f,I){let S=this._threads.get(f);S&&(S.range=j.to(I))}$updateCommentThread(f,I){let S=this._threads.get(f);if(!S)return;(P=>Object.prototype.hasOwnProperty.call(I,P))("collapseState")&&(S.collapsibleState=c(I.collapseState))}$deleteCommentThread(f){this._threads.get(f)?.dispose(),this._threads.delete(f)}getCommentThread(f){return this._threads.get(f)}dispose(){this._threads.forEach(f=>{f.dispose()}),this._localDisposables.forEach(f=>f.dispose())}}function a(h,f,I,S){let T=I.get(f);return T||(T=++h.commentHandle,I.set(f,T)),f.state!==void 0&&A(S,"commentsDraftState"),f.reactions?.some(P=>P.reactors!==void 0)&&A(S,"commentReactor"),{mode:f.mode,contextValue:f.contextValue,uniqueIdInThread:T,body:typeof f.body=="string"?f.body:ue.from(f.body),userName:f.author.name,userIconPath:f.author.iconPath,label:f.label,commentReactions:f.reactions?f.reactions.map(P=>l(P)):void 0,state:f.state,timestamp:f.timestamp?.toJSON()}}function l(h){return{label:h.label,iconPath:h.iconPath?Xv(h.iconPath):void 0,count:h.count,hasReacted:h.authorHasReacted,reactors:h.reactors&&h.reactors.length>0&&typeof h.reactors[0]!="string"?h.reactors.map(f=>f.name):h.reactors}}function d(h){return{label:h.label||"",count:h.count||0,iconPath:h.iconPath?b.revive(h.iconPath):"",authorHasReacted:h.hasReacted||!1,reactors:h.reactors?.map(f=>({name:f}))}}function c(h){if(h!==void 0)switch(h){case 1:return 1;case 0:return 0}return 0}function u(h){let f;if(typeof h=="object"?f=h.resolved:f=h,f!==void 0)switch(f){case 0:return 0;case 1:return 1}return 0}function m(h){let f;if(typeof h=="object"&&(f=h.applicability),f!==void 0)switch(f){case 0:return 0;case 1:return 1}return 0}return new o}var YE={},yt={exports:YE};(function(r,t){if(typeof YE=="object"&&typeof yt=="object")yt.exports=t();else if(typeof define=="function"&&define.amd)define([],t);else{var e=t();for(var n in e)(typeof YE=="object"?YE:r)[n]=e[n]}})(typeof self<"u"?self:void 0,(function(){return(function(r){var t={};function e(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return r[n].call(o.exports,o,o.exports,e),o.l=!0,o.exports}return e.m=r,e.c=t,e.d=function(n,o,i){e.o(n,o)||Object.defineProperty(n,o,{enumerable:!0,get:i})},e.r=function(n){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},e.t=function(n,o){if(1&o&&(n=e(n)),8&o||4&o&&typeof n=="object"&&n&&n.__esModule)return n;var i=Object.create(null);if(e.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:n}),2&o&&typeof n!="string")for(var s in n)e.d(i,s,function(a){return n[a]}.bind(null,s));return i},e.n=function(n){var o=n&&n.__esModule?function(){return n.default}:function(){return n};return e.d(o,"a",o),o},e.o=function(n,o){return Object.prototype.hasOwnProperty.call(n,o)},e.p="",e(e.s=0)})([function(r,t,e){(function(n){var o;t=r.exports=kt,o=typeof n=="object"&&n.env&&n.env.NODE_DEBUG&&/\bsemver\b/i.test(n.env.NODE_DEBUG)?function(){var M=Array.prototype.slice.call(arguments,0);M.unshift("SEMVER"),console.log.apply(console,M)}:function(){},t.SEMVER_SPEC_VERSION="2.0.0";var i=256,s=Number.MAX_SAFE_INTEGER||9007199254740991,a=t.re=[],l=t.src=[],d=0,c=d++;l[c]="0|[1-9]\\d*";var u=d++;l[u]="[0-9]+";var m=d++;l[m]="\\d*[a-zA-Z-][a-zA-Z0-9-]*";var g=d++;l[g]="("+l[c]+")\\.("+l[c]+")\\.("+l[c]+")";var h=d++;l[h]="("+l[u]+")\\.("+l[u]+")\\.("+l[u]+")";var f=d++;l[f]="(?:"+l[c]+"|"+l[m]+")";var I=d++;l[I]="(?:"+l[u]+"|"+l[m]+")";var S=d++;l[S]="(?:-("+l[f]+"(?:\\."+l[f]+")*))";var T=d++;l[T]="(?:-?("+l[I]+"(?:\\."+l[I]+")*))";var P=d++;l[P]="[0-9A-Za-z-]+";var L=d++;l[L]="(?:\\+("+l[P]+"(?:\\."+l[P]+")*))";var q=d++,N="v?"+l[g]+l[S]+"?"+l[L]+"?";l[q]="^"+N+"$";var B="[v=\\s]*"+l[h]+l[T]+"?"+l[L]+"?",G=d++;l[G]="^"+B+"$";var J=d++;l[J]="((?:<|>)?=?)";var Y=d++;l[Y]=l[u]+"|x|X|\\*";var re=d++;l[re]=l[c]+"|x|X|\\*";var Pe=d++;l[Pe]="[v=\\s]*("+l[re]+")(?:\\.("+l[re]+")(?:\\.("+l[re]+")(?:"+l[S]+")?"+l[L]+"?)?)?";var ot=d++;l[ot]="[v=\\s]*("+l[Y]+")(?:\\.("+l[Y]+")(?:\\.("+l[Y]+")(?:"+l[T]+")?"+l[L]+"?)?)?";var rt=d++;l[rt]="^"+l[J]+"\\s*"+l[Pe]+"$";var ne=d++;l[ne]="^"+l[J]+"\\s*"+l[ot]+"$";var ee=d++;l[ee]="(?:^|[^\\d])(\\d{1,16})(?:\\.(\\d{1,16}))?(?:\\.(\\d{1,16}))?(?:$|[^\\d])";var te=d++;l[te]="(?:~>?)";var X=d++;l[X]="(\\s*)"+l[te]+"\\s+",a[X]=new RegExp(l[X],"g");var de=d++;l[de]="^"+l[te]+l[Pe]+"$";var ge=d++;l[ge]="^"+l[te]+l[ot]+"$";var Le=d++;l[Le]="(?:\\^)";var gt=d++;l[gt]="(\\s*)"+l[Le]+"\\s+",a[gt]=new RegExp(l[gt],"g");var Ue=d++;l[Ue]="^"+l[Le]+l[Pe]+"$";var wt=d++;l[wt]="^"+l[Le]+l[ot]+"$";var Ht=d++;l[Ht]="^"+l[J]+"\\s*("+B+")$|^$";var je=d++;l[je]="^"+l[J]+"\\s*("+N+")$|^$";var _n=d++;l[_n]="(\\s*)"+l[J]+"\\s*("+B+"|"+l[Pe]+")",a[_n]=new RegExp(l[_n],"g");var _o=d++;l[_o]="^\\s*("+l[Pe]+")\\s+-\\s+("+l[Pe]+")\\s*$";var Qi=d++;l[Qi]="^\\s*("+l[ot]+")\\s+-\\s+("+l[ot]+")\\s*$";var Qa=d++;l[Qa]="(<|>)?=?\\s*\\*";for(var di=0;di<35;di++)o(di,l[di]),a[di]||(a[di]=new RegExp(l[di]));function ye(M,z){if(M instanceof kt)return M;if(typeof M!="string"||M.length>i||!(z?a[G]:a[q]).test(M))return null;try{return new kt(M,z)}catch{return null}}function kt(M,z){if(M instanceof kt){if(M.loose===z)return M;M=M.version}else if(typeof M!="string")throw new TypeError("Invalid Version: "+M);if(M.length>i)throw new TypeError("version is longer than "+i+" characters");if(!(this instanceof kt))return new kt(M,z);o("SemVer",M,z),this.loose=z;var Q=M.trim().match(z?a[G]:a[q]);if(!Q)throw new TypeError("Invalid Version: "+M);if(this.raw=M,this.major=+Q[1],this.minor=+Q[2],this.patch=+Q[3],this.major>s||this.major<0)throw new TypeError("Invalid major version");if(this.minor>s||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>s||this.patch<0)throw new TypeError("Invalid patch version");Q[4]?this.prerelease=Q[4].split(".").map((function(_e){if(/^[0-9]+$/.test(_e)){var $e=+_e;if($e>=0&&$e<s)return $e}return _e})):this.prerelease=[],this.build=Q[5]?Q[5].split("."):[],this.format()}t.parse=ye,t.valid=function(M,z){var Q=ye(M,z);return Q?Q.version:null},t.clean=function(M,z){var Q=ye(M.trim().replace(/^[=v]+/,""),z);return Q?Q.version:null},t.SemVer=kt,kt.prototype.format=function(){return this.version=this.major+"."+this.minor+"."+this.patch,this.prerelease.length&&(this.version+="-"+this.prerelease.join(".")),this.version},kt.prototype.toString=function(){return this.version},kt.prototype.compare=function(M){return o("SemVer.compare",this.version,this.loose,M),M instanceof kt||(M=new kt(M,this.loose)),this.compareMain(M)||this.comparePre(M)},kt.prototype.compareMain=function(M){return M instanceof kt||(M=new kt(M,this.loose)),wr(this.major,M.major)||wr(this.minor,M.minor)||wr(this.patch,M.patch)},kt.prototype.comparePre=function(M){if(M instanceof kt||(M=new kt(M,this.loose)),this.prerelease.length&&!M.prerelease.length)return-1;if(!this.prerelease.length&&M.prerelease.length)return 1;if(!this.prerelease.length&&!M.prerelease.length)return 0;var z=0;do{var Q=this.prerelease[z],_e=M.prerelease[z];if(o("prerelease compare",z,Q,_e),Q===void 0&&_e===void 0)return 0;if(_e===void 0)return 1;if(Q===void 0)return-1;if(Q!==_e)return wr(Q,_e)}while(++z)},kt.prototype.inc=function(M,z){switch(M){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",z);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",z);break;case"prepatch":this.prerelease.length=0,this.inc("patch",z),this.inc("pre",z);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",z),this.inc("pre",z);break;case"major":this.minor===0&&this.patch===0&&this.prerelease.length!==0||this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":this.patch===0&&this.prerelease.length!==0||this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":if(this.prerelease.length===0)this.prerelease=[0];else{for(var Q=this.prerelease.length;--Q>=0;)typeof this.prerelease[Q]=="number"&&(this.prerelease[Q]++,Q=-2);Q===-1&&this.prerelease.push(0)}z&&(this.prerelease[0]===z?isNaN(this.prerelease[1])&&(this.prerelease=[z,0]):this.prerelease=[z,0]);break;default:throw new Error("invalid increment argument: "+M)}return this.format(),this.raw=this.version,this},t.inc=function(M,z,Q,_e){typeof Q=="string"&&(_e=Q,Q=void 0);try{return new kt(M,Q).inc(z,_e).version}catch{return null}},t.diff=function(M,z){if(zu(M,z))return null;var Q=ye(M),_e=ye(z);if(Q.prerelease.length||_e.prerelease.length){for(var $e in Q)if(($e==="major"||$e==="minor"||$e==="patch")&&Q[$e]!==_e[$e])return"pre"+$e;return"prerelease"}for(var $e in Q)if(($e==="major"||$e==="minor"||$e==="patch")&&Q[$e]!==_e[$e])return $e},t.compareIdentifiers=wr;var nh=/^[0-9]+$/;function wr(M,z){var Q=nh.test(M),_e=nh.test(z);return Q&&_e&&(M=+M,z=+z),Q&&!_e?-1:_e&&!Q?1:M<z?-1:M>z?1:0}function Ko(M,z,Q){return new kt(M,Q).compare(new kt(z,Q))}function et(M,z,Q){return Ko(M,z,Q)>0}function Fd(M,z,Q){return Ko(M,z,Q)<0}function zu(M,z,Q){return Ko(M,z,Q)===0}function ci(M,z,Q){return Ko(M,z,Q)!==0}function Ji(M,z,Q){return Ko(M,z,Q)>=0}function Hd(M,z,Q){return Ko(M,z,Q)<=0}function Wd(M,z,Q,_e){var $e;switch(z){case"===":typeof M=="object"&&(M=M.version),typeof Q=="object"&&(Q=Q.version),$e=M===Q;break;case"!==":typeof M=="object"&&(M=M.version),typeof Q=="object"&&(Q=Q.version),$e=M!==Q;break;case"":case"=":case"==":$e=zu(M,Q,_e);break;case"!=":$e=ci(M,Q,_e);break;case">":$e=et(M,Q,_e);break;case">=":$e=Ji(M,Q,_e);break;case"<":$e=Fd(M,Q,_e);break;case"<=":$e=Hd(M,Q,_e);break;default:throw new TypeError("Invalid operator: "+z)}return $e}function jo(M,z){if(M instanceof jo){if(M.loose===z)return M;M=M.value}if(!(this instanceof jo))return new jo(M,z);o("comparator",M,z),this.loose=z,this.parse(M),this.semver===Ja?this.value="":this.value=this.operator+this.semver.version,o("comp",this)}t.rcompareIdentifiers=function(M,z){return wr(z,M)},t.major=function(M,z){return new kt(M,z).major},t.minor=function(M,z){return new kt(M,z).minor},t.patch=function(M,z){return new kt(M,z).patch},t.compare=Ko,t.compareLoose=function(M,z){return Ko(M,z,!0)},t.rcompare=function(M,z,Q){return Ko(z,M,Q)},t.sort=function(M,z){return M.sort((function(Q,_e){return t.compare(Q,_e,z)}))},t.rsort=function(M,z){return M.sort((function(Q,_e){return t.rcompare(Q,_e,z)}))},t.gt=et,t.lt=Fd,t.eq=zu,t.neq=ci,t.gte=Ji,t.lte=Hd,t.cmp=Wd,t.Comparator=jo;var Ja={};function pn(M,z){if(M instanceof pn)return M.loose===z?M:new pn(M.raw,z);if(M instanceof jo)return new pn(M.value,z);if(!(this instanceof pn))return new pn(M,z);if(this.loose=z,this.raw=M,this.set=M.split(/\s*\|\|\s*/).map((function(Q){return this.parseRange(Q.trim())}),this).filter((function(Q){return Q.length})),!this.set.length)throw new TypeError("Invalid SemVer Range: "+M);this.format()}function Xn(M){return!M||M.toLowerCase()==="x"||M==="*"}function Uy(M,z,Q,_e,$e,mn,Ct,Dt,nn,Bn,ir,bn,$n){return((z=Xn(Q)?"":Xn(_e)?">="+Q+".0.0":Xn($e)?">="+Q+"."+_e+".0":">="+z)+" "+(Dt=Xn(nn)?"":Xn(Bn)?"<"+(+nn+1)+".0.0":Xn(ir)?"<"+nn+"."+(+Bn+1)+".0":bn?"<="+nn+"."+Bn+"."+ir+"-"+bn:"<="+Dt)).trim()}function Vd(M,z){for(var Q=0;Q<M.length;Q++)if(!M[Q].test(z))return!1;if(z.prerelease.length){for(Q=0;Q<M.length;Q++)if(o(M[Q].semver),M[Q].semver!==Ja&&M[Q].semver.prerelease.length>0){var _e=M[Q].semver;if(_e.major===z.major&&_e.minor===z.minor&&_e.patch===z.patch)return!0}return!1}return!0}function Qs(M,z,Q){try{z=new pn(z,Q)}catch{return!1}return z.test(M)}function qu(M,z,Q,_e){var $e,mn,Ct,Dt,nn;switch(M=new kt(M,_e),z=new pn(z,_e),Q){case">":$e=et,mn=Hd,Ct=Fd,Dt=">",nn=">=";break;case"<":$e=Fd,mn=Ji,Ct=et,Dt="<",nn="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(Qs(M,z,_e))return!1;for(var Bn=0;Bn<z.set.length;++Bn){var ir=z.set[Bn],bn=null,$n=null;if(ir.forEach((function(io){io.semver===Ja&&(io=new jo(">=0.0.0")),bn=bn||io,$n=$n||io,$e(io.semver,bn.semver,_e)?bn=io:Ct(io.semver,$n.semver,_e)&&($n=io)})),bn.operator===Dt||bn.operator===nn||(!$n.operator||$n.operator===Dt)&&mn(M,$n.semver)||$n.operator===nn&&Ct(M,$n.semver))return!1}return!0}jo.prototype.parse=function(M){var z=this.loose?a[Ht]:a[je],Q=M.match(z);if(!Q)throw new TypeError("Invalid comparator: "+M);this.operator=Q[1],this.operator==="="&&(this.operator=""),Q[2]?this.semver=new kt(Q[2],this.loose):this.semver=Ja},jo.prototype.toString=function(){return this.value},jo.prototype.test=function(M){return o("Comparator.test",M,this.loose),this.semver===Ja||(typeof M=="string"&&(M=new kt(M,this.loose)),Wd(M,this.operator,this.semver,this.loose))},jo.prototype.intersects=function(M,z){if(!(M instanceof jo))throw new TypeError("a Comparator is required");var Q;if(this.operator==="")return Q=new pn(M.value,z),Qs(this.value,Q,z);if(M.operator==="")return Q=new pn(this.value,z),Qs(M.semver,Q,z);var _e=!(this.operator!==">="&&this.operator!==">"||M.operator!==">="&&M.operator!==">"),$e=!(this.operator!=="<="&&this.operator!=="<"||M.operator!=="<="&&M.operator!=="<"),mn=this.semver.version===M.semver.version,Ct=!(this.operator!==">="&&this.operator!=="<="||M.operator!==">="&&M.operator!=="<="),Dt=Wd(this.semver,"<",M.semver,z)&&(this.operator===">="||this.operator===">")&&(M.operator==="<="||M.operator==="<"),nn=Wd(this.semver,">",M.semver,z)&&(this.operator==="<="||this.operator==="<")&&(M.operator===">="||M.operator===">");return _e||$e||mn&&Ct||Dt||nn},t.Range=pn,pn.prototype.format=function(){return this.range=this.set.map((function(M){return M.join(" ").trim()})).join("||").trim(),this.range},pn.prototype.toString=function(){return this.range},pn.prototype.parseRange=function(M){var z=this.loose;M=M.trim(),o("range",M,z);var Q=z?a[Qi]:a[_o];M=M.replace(Q,Uy),o("hyphen replace",M),M=M.replace(a[_n],"$1$2$3"),o("comparator trim",M,a[_n]),M=(M=(M=M.replace(a[X],"$1~")).replace(a[gt],"$1^")).split(/\s+/).join(" ");var _e=z?a[Ht]:a[je],$e=M.split(" ").map((function(mn){return(function(Ct,Dt){return o("comp",Ct),Ct=(function(nn,Bn){return nn.trim().split(/\s+/).map((function(ir){return(function(bn,$n){o("caret",bn,$n);var io=$n?a[wt]:a[Ue];return bn.replace(io,(function(sr,Ve,Je,zt,on){var zn;return o("caret",bn,sr,Ve,Je,zt,on),Xn(Ve)?zn="":Xn(Je)?zn=">="+Ve+".0.0 <"+(+Ve+1)+".0.0":Xn(zt)?zn=Ve==="0"?">="+Ve+"."+Je+".0 <"+Ve+"."+(+Je+1)+".0":">="+Ve+"."+Je+".0 <"+(+Ve+1)+".0.0":on?(o("replaceCaret pr",on),on.charAt(0)!=="-"&&(on="-"+on),zn=Ve==="0"?Je==="0"?">="+Ve+"."+Je+"."+zt+on+" <"+Ve+"."+Je+"."+(+zt+1):">="+Ve+"."+Je+"."+zt+on+" <"+Ve+"."+(+Je+1)+".0":">="+Ve+"."+Je+"."+zt+on+" <"+(+Ve+1)+".0.0"):(o("no pr"),zn=Ve==="0"?Je==="0"?">="+Ve+"."+Je+"."+zt+" <"+Ve+"."+Je+"."+(+zt+1):">="+Ve+"."+Je+"."+zt+" <"+Ve+"."+(+Je+1)+".0":">="+Ve+"."+Je+"."+zt+" <"+(+Ve+1)+".0.0"),o("caret return",zn),zn}))})(ir,Bn)})).join(" ")})(Ct,Dt),o("caret",Ct),Ct=(function(nn,Bn){return nn.trim().split(/\s+/).map((function(ir){return(function(bn,$n){var io=$n?a[ge]:a[de];return bn.replace(io,(function(sr,Ve,Je,zt,on){var zn;return o("tilde",bn,sr,Ve,Je,zt,on),Xn(Ve)?zn="":Xn(Je)?zn=">="+Ve+".0.0 <"+(+Ve+1)+".0.0":Xn(zt)?zn=">="+Ve+"."+Je+".0 <"+Ve+"."+(+Je+1)+".0":on?(o("replaceTilde pr",on),on.charAt(0)!=="-"&&(on="-"+on),zn=">="+Ve+"."+Je+"."+zt+on+" <"+Ve+"."+(+Je+1)+".0"):zn=">="+Ve+"."+Je+"."+zt+" <"+Ve+"."+(+Je+1)+".0",o("tilde return",zn),zn}))})(ir,Bn)})).join(" ")})(Ct,Dt),o("tildes",Ct),Ct=(function(nn,Bn){return o("replaceXRanges",nn,Bn),nn.split(/\s+/).map((function(ir){return(function(bn,$n){bn=bn.trim();var io=$n?a[ne]:a[rt];return bn.replace(io,(function(sr,Ve,Je,zt,on,zn){o("xRange",bn,sr,Ve,Je,zt,on,zn);var Bd=Xn(Je),Js=Bd||Xn(zt),ie=Js||Xn(on);return Ve==="="&&ie&&(Ve=""),Bd?sr=Ve===">"||Ve==="<"?"<0.0.0":"*":Ve&&ie?(Js&&(zt=0),ie&&(on=0),Ve===">"?(Ve=">=",Js?(Je=+Je+1,zt=0,on=0):ie&&(zt=+zt+1,on=0)):Ve==="<="&&(Ve="<",Js?Je=+Je+1:zt=+zt+1),sr=Ve+Je+"."+zt+"."+on):Js?sr=">="+Je+".0.0 <"+(+Je+1)+".0.0":ie&&(sr=">="+Je+"."+zt+".0 <"+Je+"."+(+zt+1)+".0"),o("xRange return",sr),sr}))})(ir,Bn)})).join(" ")})(Ct,Dt),o("xrange",Ct),Ct=(function(nn,Bn){return o("replaceStars",nn,Bn),nn.trim().replace(a[Qa],"")})(Ct,Dt),o("stars",Ct),Ct})(mn,z)})).join(" ").split(/\s+/);return this.loose&&($e=$e.filter((function(mn){return!!mn.match(_e)}))),$e=$e.map((function(mn){return new jo(mn,z)}))},pn.prototype.intersects=function(M,z){if(!(M instanceof pn))throw new TypeError("a Range is required");return this.set.some((function(Q){return Q.every((function(_e){return M.set.some((function($e){return $e.every((function(mn){return _e.intersects(mn,z)}))}))}))}))},t.toComparators=function(M,z){return new pn(M,z).set.map((function(Q){return Q.map((function(_e){return _e.value})).join(" ").trim().split(" ")}))},pn.prototype.test=function(M){if(!M)return!1;typeof M=="string"&&(M=new kt(M,this.loose));for(var z=0;z<this.set.length;z++)if(Vd(this.set[z],M))return!0;return!1},t.satisfies=Qs,t.maxSatisfying=function(M,z,Q){var _e=null,$e=null;try{var mn=new pn(z,Q)}catch{return null}return M.forEach((function(Ct){mn.test(Ct)&&(_e&&$e.compare(Ct)!==-1||($e=new kt(_e=Ct,Q)))})),_e},t.minSatisfying=function(M,z,Q){var _e=null,$e=null;try{var mn=new pn(z,Q)}catch{return null}return M.forEach((function(Ct){mn.test(Ct)&&(_e&&$e.compare(Ct)!==1||($e=new kt(_e=Ct,Q)))})),_e},t.validRange=function(M,z){try{return new pn(M,z).range||"*"}catch{return null}},t.ltr=function(M,z,Q){return qu(M,z,"<",Q)},t.gtr=function(M,z,Q){return qu(M,z,">",Q)},t.outside=qu,t.prerelease=function(M,z){var Q=ye(M,z);return Q&&Q.prerelease.length?Q.prerelease:null},t.intersects=function(M,z,Q){return M=new pn(M,Q),z=new pn(z,Q),M.intersects(z)},t.coerce=function(M){if(M instanceof kt)return M;if(typeof M!="string")return null;var z=M.match(a[ee]);return z==null?null:ye((z[1]||"0")+"."+(z[2]||"0")+"."+(z[3]||"0"))}}).call(this,e(1))},function(r,t){var e,n,o=r.exports={};function i(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(I){if(e===setTimeout)return setTimeout(I,0);if((e===i||!e)&&setTimeout)return e=setTimeout,setTimeout(I,0);try{return e(I,0)}catch{try{return e.call(null,I,0)}catch{return e.call(this,I,0)}}}(function(){try{e=typeof setTimeout=="function"?setTimeout:i}catch{e=i}try{n=typeof clearTimeout=="function"?clearTimeout:s}catch{n=s}})();var l,d=[],c=!1,u=-1;function m(){c&&l&&(c=!1,l.length?d=l.concat(d):u=-1,d.length&&g())}function g(){if(!c){var I=a(m);c=!0;for(var S=d.length;S;){for(l=d,d=[];++u<S;)l&&l[u].run();u=-1,S=d.length}l=null,c=!1,(function(T){if(n===clearTimeout)return clearTimeout(T);if((n===s||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(T);try{n(T)}catch{try{return n.call(null,T)}catch{return n.call(this,T)}}})(I)}}function h(I,S){this.fun=I,this.array=S}function f(){}o.nextTick=function(I){var S=new Array(arguments.length-1);if(arguments.length>1)for(var T=1;T<arguments.length;T++)S[T-1]=arguments[T];d.push(new h(I,S)),d.length!==1||c||a(g)},h.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=f,o.addListener=f,o.once=f,o.off=f,o.removeListener=f,o.removeAllListeners=f,o.emit=f,o.prependListener=f,o.prependOnceListener=f,o.listeners=function(I){return[]},o.binding=function(I){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(I){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}}])}));var AGe=yt.exports.SEMVER_SPEC_VERSION,MGe=yt.exports.parse,zj=yt.exports.valid,LGe=yt.exports.coerce,OGe=yt.exports.clean,NGe=yt.exports.inc,UGe=yt.exports.major,FGe=yt.exports.minor,HGe=yt.exports.patch,WGe=yt.exports.prerelease,VGe=yt.exports.gt,BGe=yt.exports.gte,$Ge=yt.exports.lt,zGe=yt.exports.lte,qGe=yt.exports.eq,KGe=yt.exports.neq,jGe=yt.exports.cmp,GGe=yt.exports.compare,QGe=yt.exports.rcompare,JGe=yt.exports.compareIdentifiers,YGe=yt.exports.rcompareIdentifiers,XGe=yt.exports.compareBuild,ZGe=yt.exports.sort,eQe=yt.exports.rsort,tQe=yt.exports.diff,nQe=yt.exports.validRange,oQe=yt.exports.satisfies,rQe=yt.exports.maxSatisfying,iQe=yt.exports.minSatisfying,sQe=yt.exports.minVersion,aQe=yt.exports.gtr,lQe=yt.exports.ltr,dQe=yt.exports.outside,cQe=yt.exports.intersects,uQe=yt.exports.SemVer,pQe=yt.exports.Comparator,mQe=yt.exports.Range;var DB=/^(\^|>=)?((\d+)|x)\.((\d+)|x)\.((\d+)|x)(\-.*)?$/,Kj=/^-(\d{4})(\d{2})(\d{2})(\d{2})?(\d{2})?$/;function jj(r){return r=r.trim(),r==="*"||DB.test(r)}function RL(r){if(!jj(r))return null;if(r=r.trim(),r==="*")return{hasCaret:!1,hasGreaterEquals:!1,majorBase:0,majorMustEqual:!1,minorBase:0,minorMustEqual:!1,patchBase:0,patchMustEqual:!1,preRelease:null};let t=r.match(DB);return t?{hasCaret:t[1]==="^",hasGreaterEquals:t[1]===">=",majorBase:t[2]==="x"?0:parseInt(t[2],10),majorMustEqual:t[2]!=="x",minorBase:t[4]==="x"?0:parseInt(t[4],10),minorMustEqual:t[4]!=="x",patchBase:t[6]==="x"?0:parseInt(t[6],10),patchMustEqual:t[6]!=="x",preRelease:t[8]||null}:null}function AL(r){if(!r)return null;let t=r.majorBase,e=r.majorMustEqual,n=r.minorBase,o=r.minorMustEqual,i=r.patchBase,s=r.patchMustEqual;r.hasCaret&&(t===0||(o=!1),s=!1);let a=0;if(r.preRelease){let l=Kj.exec(r.preRelease);if(l){let[,d,c,u,m,g]=l;a=Date.UTC(Number(d),Number(c)-1,Number(u),Number(m)||0,Number(g)||0)}}return{majorBase:t,majorMustEqual:e,minorBase:n,minorMustEqual:o,patchBase:i,patchMustEqual:s,isMinimum:r.hasGreaterEquals,notBefore:a}}var ML=class{constructor(){this.buffers=[]}add(t){let e=this.buffers.indexOf(t);return e<0&&(e=this.buffers.length,this.buffers.push(t)),e}};function RB(r,t){if(t.serializeBuffersForPostMessage){let e=new ML,o=JSON.stringify(r,(s,a)=>{if(a instanceof ArrayBuffer)return{$$vscode_array_buffer_reference$$:!0,index:e.add(a)};if(ArrayBuffer.isView(a)){let l=Gj(a);if(l)return{$$vscode_array_buffer_reference$$:!0,index:e.add(a.buffer),view:{type:l,byteLength:a.byteLength,byteOffset:a.byteOffset}}}return a}),i=e.buffers.map(s=>{let a=new Uint8Array(s);return H.wrap(a)});return{message:o,buffers:i}}else return{message:JSON.stringify(r),buffers:[]}}function Gj(r){switch(r.constructor.name){case"Int8Array":return 1;case"Uint8Array":return 2;case"Uint8ClampedArray":return 3;case"Int16Array":return 4;case"Uint16Array":return 5;case"Int32Array":return 6;case"Uint32Array":return 7;case"Float32Array":return 8;case"Float64Array":return 9;case"BigInt64Array":return 10;case"BigUint64Array":return 11}}function AB(r,t){let e=t.map(i=>{let s=new ArrayBuffer(i.byteLength);return new Uint8Array(s).set(i.buffer),s}),n=t.length?(i,s)=>{if(s&&typeof s=="object"&&s.$$vscode_array_buffer_reference$$){let a=s,{index:l}=a,d=e[l];if(a.view)switch(a.view.type){case 1:return new Int8Array(d,a.view.byteOffset,a.view.byteLength/Int8Array.BYTES_PER_ELEMENT);case 2:return new Uint8Array(d,a.view.byteOffset,a.view.byteLength/Uint8Array.BYTES_PER_ELEMENT);case 3:return new Uint8ClampedArray(d,a.view.byteOffset,a.view.byteLength/Uint8ClampedArray.BYTES_PER_ELEMENT);case 4:return new Int16Array(d,a.view.byteOffset,a.view.byteLength/Int16Array.BYTES_PER_ELEMENT);case 5:return new Uint16Array(d,a.view.byteOffset,a.view.byteLength/Uint16Array.BYTES_PER_ELEMENT);case 6:return new Int32Array(d,a.view.byteOffset,a.view.byteLength/Int32Array.BYTES_PER_ELEMENT);case 7:return new Uint32Array(d,a.view.byteOffset,a.view.byteLength/Uint32Array.BYTES_PER_ELEMENT);case 8:return new Float32Array(d,a.view.byteOffset,a.view.byteLength/Float32Array.BYTES_PER_ELEMENT);case 9:return new Float64Array(d,a.view.byteOffset,a.view.byteLength/Float64Array.BYTES_PER_ELEMENT);case 10:return new BigInt64Array(d,a.view.byteOffset,a.view.byteLength/BigInt64Array.BYTES_PER_ELEMENT);case 11:return new BigUint64Array(d,a.view.byteOffset,a.view.byteLength/BigUint64Array.BYTES_PER_ELEMENT);default:throw new Error("Unknown array buffer view type")}return d}return s}:void 0;return{message:JSON.parse(r,n),arrayBuffers:e}}var LL=class{constructor(t,e,n,o,i,s,a){this.#l="";this.#d=!1;this.#c=!1;this._onMessageEmitter=new E;this.onDidReceiveMessage=this._onMessageEmitter.event;this.#p=new E;this._onDidDispose=this.#p.event;this.#e=t,this.#t=e,this.#a=n,this.#o=o,this.#s=i,this.#i=s,this.#r=qa(s),this.#u=Qj(s),this.#n=a}#e;#t;#n;#o;#s;#i;#l;#a;#d;#c;#r;#u;#p;dispose(){this.#d=!0,this.#p.fire(),this.#p.dispose(),this._onMessageEmitter.dispose()}asWebviewUri(t){return this.#c=!0,Ld(t,this.#o)}get cspSource(){let t=this.#i.extensionLocation;if(t.scheme===V.https||t.scheme===V.http){let e=t.toString();return e.endsWith("/")||(e+="/"),e+" "+Yb}return Yb}get html(){return this.assertNotDisposed(),this.#l}set html(t){this.assertNotDisposed(),this.#l!==t&&(this.#l=t,this.#u&&!this.#c&&/(["'])vscode-resource:([^\s'"]+?)(["'])/i.test(t)&&(this.#c=!0,this.#n.report("Webview vscode-resource: uris",this.#i,"Please migrate to use the 'webview.asWebviewUri' api instead: https://aka.ms/vscode-webview-use-aswebviewuri")),this.#t.$setHtml(this.#e,this.rewriteOldResourceUrlsIfNeeded(t)))}get options(){return this.assertNotDisposed(),this.#a}set options(t){this.assertNotDisposed(),qt(this.#a,t)||this.#t.$setOptions(this.#e,OL(this.#i,this.#s,t)),this.#a=t}async postMessage(t){if(this.#d)return!1;let e=RB(t,{serializeBuffersForPostMessage:this.#r});return this.#t.$postMessage(this.#e,e.message,...e.buffers)}assertNotDisposed(){if(this.#d)throw new Error("Webview is disposed")}rewriteOldResourceUrlsIfNeeded(t){if(!this.#u)return t;let e=this.#i.extensionLocation?.scheme===V.vscodeRemote,n=this.#i.extensionLocation.scheme===V.vscodeRemote?this.#i.extensionLocation.authority:void 0;return t.replace(/(["'])(?:vscode-resource):(\/\/([^\s\/'"]+?)(?=\/))?([^\s'"]+?)(["'])/gi,(o,i,s,a,l,d)=>{let c=b.from({scheme:a||"file",path:decodeURIComponent(l)}),u=Ld(c,{isRemote:e,authority:n}).toString();return`${i}${u}${d}`}).replace(/(["'])(?:vscode-webview-resource):(\/\/[^\s\/'"]+\/([^\s\/'"]+?)(?=\/))?([^\s'"]+?)(["'])/gi,(o,i,s,a,l,d)=>{let c=b.from({scheme:a||"file",path:decodeURIComponent(l)}),u=Ld(c,{isRemote:e,authority:n}).toString();return`${i}${u}${d}`})}};function qa(r){try{let t=AL(RL(r.engines.vscode));return!!t&&t.majorBase>=1&&t.minorBase>=57}catch{return!1}}function Qj(r){try{let t=AL(RL(r.engines.vscode));return t?t.majorBase<1||t.majorBase===1&&t.minorBase<60:!1}catch{return!1}}var XE=class extends O{constructor(e,n,o,i,s){super();this.remoteInfo=n;this.workspace=o;this._logService=i;this._deprecationService=s;this._webviews=new Map;this._webviewProxy=e.getProxy(F.MainThreadWebviews)}dispose(){super.dispose();for(let e of this._webviews.values())e.dispose();this._webviews.clear()}$onMessage(e,n,o){let i=this.getWebview(e);if(i){let{message:s}=AB(n,o.value);i._onMessageEmitter.fire(s)}}$onMissingCsp(e,n){this._logService.warn(`${n} created a webview without a content security policy: https://aka.ms/vscode-webview-missing-csp`)}createNewWebview(e,n,o){let i=new LL(e,this._webviewProxy,Jj(n),this.remoteInfo,this.workspace,o,this._deprecationService);this._webviews.set(e,i);let s=i._onDidDispose(()=>{s.dispose(),this.deleteWebview(e)});return i}deleteWebview(e){this._webviews.delete(e)}getWebview(e){return this._webviews.get(e)}};function Ru(r){return{id:r.identifier,location:r.extensionLocation}}function OL(r,t,e){return{enableCommandUris:e.enableCommandUris,enableScripts:e.enableScripts,enableForms:e.enableForms,portMapping:e.portMapping,localResourceRoots:e.localResourceRoots||Yj(r,t)}}function Jj(r){return{enableCommandUris:r.enableCommandUris,enableScripts:r.enableScripts,enableForms:r.enableForms,portMapping:r.portMapping,localResourceRoots:r.localResourceRoots?.map(t=>b.from(t))}}function Yj(r,t){return[...(t?.getWorkspaceFolders()||[]).map(e=>e.uri),r.extensionLocation]}var qo=class r{constructor(t){this.id=t;this._data=new Map;this._idPool=1}static{this.enableDebugLogging=!1}add(t){let e=this._idPool++;return this._data.set(e,t),this.logDebugInfo(),e}get(t,e){return this._data.has(t)?this._data.get(t)[e]:void 0}delete(t){this._data.delete(t),this.logDebugInfo()}logDebugInfo(){r.enableDebugLogging&&console.log(`${this.id} cache size - ${this._data.size}`)}};var NL=class{constructor(t,e){this.document=t;this._storagePath=e;this._backupCounter=1;this._edits=new qo("custom documents")}addEdit(t){return this._edits.add([t])}async undo(t,e){await this.getEdit(t).undo(),e||this.disposeBackup()}async redo(t,e){await this.getEdit(t).redo(),e||this.disposeBackup()}disposeEdits(t){for(let e of t)this._edits.delete(e)}getNewBackupUri(){if(!this._storagePath)throw new Error("Backup requires a valid storage path");let t=eG(this.document.uri)+this._backupCounter++;return Et(this._storagePath,t)}updateBackup(t){this._backup?.delete(),this._backup=t}disposeBackup(){this._backup?.delete(),this._backup=void 0}getEdit(t){let e=this._edits.get(t,0);if(!e)throw new Error("No edit found");return e}},UL=class{constructor(){this._documents=new Map}get(t,e){return this._documents.get(this.key(t,e))}add(t,e,n){let o=this.key(t,e.uri);if(this._documents.has(o))throw new Error(`Document already exists for viewType:${t} resource:${e.uri}`);let i=new NL(e,n);return this._documents.set(o,i),i}delete(t,e){let n=this.key(t,e);this._documents.delete(n)}key(t,e){return`${t}@@@${e}`}};var FL=class{constructor(){this._providers=new Map}addTextProvider(t,e,n){return this.add(t,{type:0,extension:e,provider:n})}addCustomProvider(t,e,n){return this.add(t,{type:1,extension:e,provider:n})}get(t){return this._providers.get(t)}add(t,e){if(this._providers.has(t))throw new Error(`Provider for viewType:${t} already registered`);return this._providers.set(t,e),new be(()=>this._providers.delete(t))}},ew=class{constructor(t,e,n,o,i){this._extHostDocuments=e;this._extensionStoragePaths=n;this._extHostWebview=o;this._extHostWebviewPanels=i;this._editorProviders=new FL;this._documents=new UL;this._proxy=t.getProxy(F.MainThreadCustomEditors)}registerCustomEditorProvider(t,e,n,o){let i=new $;return Xj(n)?(i.add(this._editorProviders.addTextProvider(e,t,n)),this._proxy.$registerTextEditorProvider(Ru(t),e,o.webviewOptions||{},{supportsMove:!!n.moveCustomTextEditor},qa(t))):(i.add(this._editorProviders.addCustomProvider(e,t,n)),ZE(n)&&i.add(n.onDidChangeCustomDocument(s=>{let a=this.getCustomDocumentEntry(e,s.document.uri);if(Zj(s)){let l=a.addEdit(s);this._proxy.$onDidEdit(s.document.uri,e,l,s.label)}else this._proxy.$onContentChange(s.document.uri,e)})),this._proxy.$registerCustomEditorProvider(Ru(t),e,o.webviewOptions||{},!!o.supportsMultipleEditorsPerDocument,qa(t))),be.from(i,new be(()=>{this._proxy.$unregisterEditorProvider(e)}))}async $createCustomDocument(t,e,n,o,i){let s=this._editorProviders.get(e);if(!s)throw new Error(`No provider found for '${e}'`);if(s.type!==1)throw new Error(`Invalid provide type for '${e}'`);let a=b.revive(t),l=await s.provider.openCustomDocument(a,{backupId:n,untitledDocumentData:o?.buffer},i),d;return ZE(s.provider)&&this._extensionStoragePaths&&(d=this._extensionStoragePaths.workspaceValue(s.extension)??this._extensionStoragePaths.globalValue(s.extension)),this._documents.add(e,l,d),{editable:ZE(s.provider)}}async $disposeCustomDocument(t,e){let n=this._editorProviders.get(e);if(!n)throw new Error(`No provider found for '${e}'`);if(n.type!==1)throw new Error(`Invalid provider type for '${e}'`);let o=b.revive(t),{document:i}=this.getCustomDocumentEntry(e,o);this._documents.delete(e,o),i.dispose()}async $resolveCustomEditor(t,e,n,o,i,s){let a=this._editorProviders.get(n);if(!a)throw new Error(`No provider found for '${n}'`);let l=Vt.to(i),d=this._extHostWebview.createNewWebview(e,o.contentOptions,a.extension),c=this._extHostWebviewPanels.createNewWebviewPanel(e,n,o.title,l,o.options,d,o.active),u=b.revive(t);switch(a.type){case 1:{let{document:m}=this.getCustomDocumentEntry(n,u);return a.provider.resolveCustomEditor(m,c,s)}case 0:{let m=this._extHostDocuments.getDocument(u);return a.provider.resolveCustomTextEditor(m,c,s)}default:throw new Error("Unknown webview provider type")}}$disposeEdits(t,e,n){this.getCustomDocumentEntry(e,t).disposeEdits(n)}async $onMoveCustomEditor(t,e,n){let o=this._editorProviders.get(n);if(!o)throw new Error(`No provider found for '${n}'`);if(!o.provider.moveCustomTextEditor)throw new Error(`Provider does not implement move '${n}'`);let i=this._extHostWebviewPanels.getWebviewPanel(t);if(!i)throw new Error("No webview found");let s=b.revive(e),a=this._extHostDocuments.getDocument(s);await o.provider.moveCustomTextEditor(a,i,ve.None)}async $undo(t,e,n,o){return this.getCustomDocumentEntry(e,t).undo(n,o)}async $redo(t,e,n,o){return this.getCustomDocumentEntry(e,t).redo(n,o)}async $revert(t,e,n){let o=this.getCustomDocumentEntry(e,t);await this.getCustomEditorProvider(e).revertCustomDocument(o.document,n),o.disposeBackup()}async $onSave(t,e,n){let o=this.getCustomDocumentEntry(e,t);await this.getCustomEditorProvider(e).saveCustomDocument(o.document,n),o.disposeBackup()}async $onSaveAs(t,e,n,o){let i=this.getCustomDocumentEntry(e,t);return this.getCustomEditorProvider(e).saveCustomDocumentAs(i.document,b.revive(n),o)}async $backup(t,e,n){let o=this.getCustomDocumentEntry(e,t),s=await this.getCustomEditorProvider(e).backupCustomDocument(o.document,{destination:o.getNewBackupUri()},n);return o.updateBackup(s),s.id}getCustomDocumentEntry(t,e){let n=this._documents.get(t,b.revive(e));if(!n)throw new Error("No custom document found");return n}getCustomEditorProvider(t){let n=this._editorProviders.get(t)?.provider;if(!n||!ZE(n))throw new Error("Custom document is not editable");return n}};function ZE(r){return!!r.onDidChangeCustomDocument}function Xj(r){return typeof r.resolveCustomTextEditor=="function"}function Zj(r){return typeof r.undo=="function"&&typeof r.redo=="function"}function eG(r){let t=r.scheme===V.file||r.scheme===V.untitled?r.fsPath:r.toString();return Gn(t)+""}var tw=class r{constructor(t,e,n,o,i,s,a,l){this._name=t;this._owner=e;this._maxDiagnosticsTotal=n;this._maxDiagnosticsPerFile=o;this._modelVersionIdProvider=i;this._isDisposed=!1;this._maxDiagnosticsTotal=Math.max(o,n),this.#n=new Ke(d=>s.getComparisonKey(d)),this.#e=a,this.#t=l}#e;#t;#n;dispose(){this._isDisposed||(this.#t.fire([...this.#n.keys()]),this.#e?.$clear(this._owner),this.#n.clear(),this._isDisposed=!0)}get name(){return this._checkDisposed(),this._name}set(t,e){if(!t){this.clear();return}this._checkDisposed();let n=[];if(b.isUri(t)){if(!e){this.delete(t);return}this.#n.set(t,tt(e)),n=[t]}else if(Array.isArray(t)){n=[];let s;t=[...t].sort(r._compareIndexedTuplesByUri);for(let a of t){let[l,d]=a;if((!s||l.toString()!==s.toString())&&(s&&this.#n.get(s).length===0&&this.#n.delete(s),s=l,n.push(l),this.#n.set(l,[])),d)this.#n.get(l)?.push(...tt(d));else{let c=this.#n.get(l);c&&(c.length=0)}}}if(this.#t.fire(n),!this.#e)return;let o=[],i=0;for(let s of n){let a=[],l=this.#n.get(s);if(l)if(l.length>this._maxDiagnosticsPerFile){a=[];let d=[0,1,2,3];e:for(let c=0;c<4;c++)for(let u of l)if(u.severity===d[c]&&a.push({...Fa.from(u),modelVersionId:this._modelVersionIdProvider(s)})===this._maxDiagnosticsPerFile)break e;a.push({severity:2,message:p(3487,null,l.length-this._maxDiagnosticsPerFile),startLineNumber:a[a.length-1].startLineNumber,startColumn:a[a.length-1].startColumn,endLineNumber:a[a.length-1].endLineNumber,endColumn:a[a.length-1].endColumn})}else a=l.map(d=>({...Fa.from(d),modelVersionId:this._modelVersionIdProvider(s)}));if(o.push([s,a]),i+=a.length,i>this._maxDiagnosticsTotal)break}this.#e.$changeMany(this._owner,o)}delete(t){this._checkDisposed(),this.#t.fire([t]),this.#n.delete(t),this.#e?.$changeMany(this._owner,[[t,void 0]])}clear(){this._checkDisposed(),this.#t.fire([...this.#n.keys()]),this.#n.clear(),this.#e?.$clear(this._owner)}forEach(t,e){this._checkDisposed();for(let[n,o]of this)t.call(e,n,o,this)}*[Symbol.iterator](){this._checkDisposed();for(let t of this.#n.keys())yield[t,this.get(t)]}get(t){this._checkDisposed();let e=this.#n.get(t);return Array.isArray(e)?Object.freeze(e.slice(0)):[]}has(t){return this._checkDisposed(),Array.isArray(this.#n.get(t))}_checkDisposed(){if(this._isDisposed)throw new Error("illegal state - object is disposed")}static _compareIndexedTuplesByUri(t,e){return t[0].toString()<e[0].toString()?-1:t[0].toString()>e[0].toString()?1:0}},ai=class{constructor(t,e,n,o){this._logService=e;this._fileSystemInfoService=n;this._extHostDocumentsAndEditors=o;this._collections=new Map;this._onDidChangeDiagnostics=new nI({merge:t=>t.flat(),delay:50});this.onDidChangeDiagnostics=he.map(this._onDidChangeDiagnostics.event,ai._mapper);this._proxy=t.getProxy(F.MainThreadDiagnostics)}static{this._idPool=0}static{this._maxDiagnosticsPerFile=1e3}static{this._maxDiagnosticsTotal=1.1*this._maxDiagnosticsPerFile}static _mapper(t){let e=new Ke;for(let n of t)e.set(n,n);return{uris:Object.freeze(Array.from(e.values()))}}createDiagnosticCollection(t,e){let{_collections:n,_proxy:o,_onDidChangeDiagnostics:i,_logService:s,_fileSystemInfoService:a,_extHostDocumentsAndEditors:l}=this,d=new class{$changeMany(m,g){o.$changeMany(m,g),s.trace("[DiagnosticCollection] change many (extension, owner, uris)",t.value,m,g.length===0?"CLEARING":g)}$clear(m){o.$clear(m),s.trace("[DiagnosticCollection] remove all (extension, owner)",t.value,m)}dispose(){o.dispose()}},c;if(!e)e="_generated_diagnostic_collection_name_#"+ai._idPool++,c=e;else if(!n.has(e))c=e;else{this._logService.warn(`DiagnosticCollection with name '${e}' does already exist.`);do c=e+ai._idPool++;while(n.has(c))}return new class extends tw{constructor(){super(e,c,ai._maxDiagnosticsTotal,ai._maxDiagnosticsPerFile,m=>l.getDocument(m)?.version,a.extUri,d,i),n.set(c,this)}dispose(){super.dispose(),n.delete(c)}}}getDiagnostics(t){if(t)return this._getDiagnostics(t);{let e=new Map,n=[];for(let o of this._collections.values())o.forEach((i,s)=>{let a=e.get(i.toString());typeof a>"u"&&(a=n.length,e.set(i.toString(),a),n.push([i,[]])),n[a][1]=n[a][1].concat(...s)});return n}}_getDiagnostics(t){let e=[];for(let n of this._collections.values())n.has(t)&&(e=e.concat(n.get(t)));return e}$acceptMarkersChange(t){if(!this._mirrorCollection){let e="_generated_mirror",n=new tw(e,e,Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER,o=>{},this._fileSystemInfoService.extUri,void 0,this._onDidChangeDiagnostics);this._collections.set(e,n),this._mirrorCollection=n}for(let[e,n]of t)this._mirrorCollection.set(b.revive(e),n.map(Fa.to))}};ai=_([C(1,oe),C(2,Gr)],ai);var nw=class{constructor(t){this._proxy=t.getProxy(F.MainThreadDialogs)}showOpenDialog(t){return this._proxy.$showOpenDialog(t).then(e=>e?e.map(n=>b.revive(n)):void 0)}showSaveDialog(t){return this._proxy.$showSaveDialog(t).then(e=>e?b.revive(e):void 0)}};var ow=class r{constructor(t,e,n){this._documentsAndEditors=e;this._logService=n;this._documentContentProviders=new Map;this._proxy=t.getProxy(F.MainThreadDocumentContentProviders)}static{this._handlePool=0}registerTextDocumentContentProvider(t,e){if(Object.keys(V).indexOf(t)>=0)throw new Error(`scheme '${t}' already registered`);let n=r._handlePool++;this._documentContentProviders.set(n,e),this._proxy.$registerTextContentProvider(n,t);let o;if(typeof e.onDidChange=="function"){let i;o=e.onDidChange(async s=>{if(s.scheme!==t){this._logService.warn(`Provider for scheme '${t}' is firing event for schema '${s.scheme}' which will be IGNORED`);return}if(!this._documentsAndEditors.getDocument(s))return;i&&await i;let a=this.$provideTextDocumentContent(n,s).then(async l=>{if(!l&&typeof l!="string")return;let d=this._documentsAndEditors.getDocument(s);if(!d)return;let c=uI(l);if(!d.equalLines(c))return this._proxy.$onVirtualDocumentChange(s,l)}).catch(ze).finally(()=>{i===a&&(i=void 0)});i=a})}return new be(()=>{this._documentContentProviders.delete(n)&&this._proxy.$unregisterTextContentProvider(n),o&&(o.dispose(),o=void 0)})}$provideTextDocumentContent(t,e){let n=this._documentContentProviders.get(t);return n?Promise.resolve(n.provideTextDocumentContent(b.revive(e),ve.None)):Promise.reject(new Error(`unsupported uri-scheme: ${e.scheme}`))}};var rw=class{constructor(t,e,n,o={timeout:1500,errors:3}){this._logService=t;this._documents=e;this._mainThreadBulkEdits=n;this._thresholds=o;this._callbacks=new ao;this._badListeners=new WeakMap}dispose(){this._callbacks.clear()}getOnWillSaveTextDocumentEvent(t){return(e,n,o)=>{let s={dispose:this._callbacks.push([e,n,t])};return Array.isArray(o)&&o.push(s),s}}async $participateInSave(t,e){let n=b.revive(t),o=!1,i=setTimeout(()=>o=!0,this._thresholds.timeout),s=[];try{for(let a of[...this._callbacks]){if(o)break;let l=this._documents.getDocument(n),d=await this._deliverEventAsyncAndBlameBadListeners(a,{document:l,reason:nb.to(e)});s.push(d)}}finally{clearTimeout(i)}return s}_deliverEventAsyncAndBlameBadListeners([t,e,n],o){let i=this._badListeners.get(t);return typeof i=="number"&&i>this._thresholds.errors?Promise.resolve(!1):this._deliverEventAsync(n,t,e,o).then(()=>!0,s=>{if(this._logService.error(`onWillSaveTextDocument-listener from extension '${n.identifier.value}' threw ERROR`),this._logService.error(s),!(s instanceof Error)||s.message!=="concurrent_edits"){let a=this._badListeners.get(t);this._badListeners.set(t,a?a+1:1),typeof a=="number"&&a>this._thresholds.errors&&this._logService.info(`onWillSaveTextDocument-listener from extension '${n.identifier.value}' will now be IGNORED because of timeouts and/or errors`)}return!1})}_deliverEventAsync(t,e,n,o){let i=[],s=Date.now(),{document:a,reason:l}=o,{version:d}=a,c=Object.freeze({document:a,reason:l,waitUntil(u){if(Object.isFrozen(i))throw Qu("waitUntil can not be called async");i.push(Promise.resolve(u))}});try{e.apply(n,[c])}catch(u){return Promise.reject(u)}return Object.freeze(i),new Promise((u,m)=>{let g=setTimeout(()=>m(new Error("timeout")),this._thresholds.timeout);return Promise.all(i).then(h=>{this._logService.debug(`onWillSaveTextDocument-listener from extension '${t.identifier.value}' finished after ${Date.now()-s}ms`),clearTimeout(g),u(h)}).catch(h=>{clearTimeout(g),m(h)})}).then(u=>{let m={edits:[]};for(let g of u)if(Array.isArray(g)&&g.every(h=>h instanceof Wn))for(let{newText:h,newEol:f,range:I}of g)m.edits.push({resource:a.uri,versionId:void 0,textEdit:{range:I&&j.from(I),text:h,eol:f&&ru.from(f)}});if(m.edits.length!==0)return d===a.version?this._mainThreadBulkEdits.$tryApplyWorkspaceEdit(new Gt(m)):Promise.reject(new Error("concurrent_edits"))})}};var iw=class{constructor(t,e){this._toDispose=new $;this._onDidAddDocument=this._toDispose.add(new E);this._onDidRemoveDocument=this._toDispose.add(new E);this._onDidChangeDocument=this._toDispose.add(new E);this._onDidChangeDocumentWithReason=this._toDispose.add(new E);this._onDidSaveDocument=this._toDispose.add(new E);this.onDidAddDocument=this._onDidAddDocument.event;this.onDidRemoveDocument=this._onDidRemoveDocument.event;this.onDidChangeDocument=this._onDidChangeDocument.event;this.onDidChangeDocumentWithReason=this._onDidChangeDocumentWithReason.event;this.onDidSaveDocument=this._onDidSaveDocument.event;this._documentLoader=new Map;this._proxy=t.getProxy(F.MainThreadDocuments),this._documentsAndEditors=e,this._documentsAndEditors.onDidRemoveDocuments(n=>{for(let o of n)this._onDidRemoveDocument.fire(o.document)},void 0,this._toDispose),this._documentsAndEditors.onDidAddDocuments(n=>{for(let o of n)this._onDidAddDocument.fire(o.document)},void 0,this._toDispose)}dispose(){this._toDispose.dispose()}getAllDocumentData(){return[...this._documentsAndEditors.allDocuments()]}getDocumentData(t){if(!t)return;let e=this._documentsAndEditors.getDocument(t);if(e)return e}getDocument(t){let e=this.getDocumentData(t);if(!e?.document)throw new Error(`Unable to retrieve document from URI '${t}'`);return e.document}ensureDocumentData(t,e){let n=this._documentsAndEditors.getDocument(t);if(n&&(!e?.encoding||n.document.encoding===e.encoding))return Promise.resolve(n);let o=this._documentLoader.get(t.toString());return o?e?.encoding&&(o=o.then(i=>i.document.encoding!==e.encoding?this.ensureDocumentData(t,e):i)):(o=this._proxy.$tryOpenDocument(t,e).then(i=>{this._documentLoader.delete(t.toString());let s=b.revive(i);return pi(this._documentsAndEditors.getDocument(s))},i=>(this._documentLoader.delete(t.toString()),Promise.reject(i))),this._documentLoader.set(t.toString(),o)),o}createDocumentData(t){return this._proxy.$tryCreateDocument(t).then(e=>b.revive(e))}$acceptModelLanguageChanged(t,e){let n=b.revive(t),o=this._documentsAndEditors.getDocument(n);if(!o)throw new Error("unknown document");this._onDidRemoveDocument.fire(o.document),o._acceptLanguageId(e),this._onDidAddDocument.fire(o.document)}$acceptModelSaved(t){let e=b.revive(t),n=this._documentsAndEditors.getDocument(e);if(!n)throw new Error("unknown document");this.$acceptDirtyStateChanged(t,!1),this._onDidSaveDocument.fire(n.document)}$acceptDirtyStateChanged(t,e){let n=b.revive(t),o=this._documentsAndEditors.getDocument(n);if(!o)throw new Error("unknown document");o._acceptIsDirty(e),this._onDidChangeDocument.fire({document:o.document,contentChanges:[],reason:void 0}),this._onDidChangeDocumentWithReason.fire({document:o.document,contentChanges:[],reason:void 0,detailedReason:void 0})}$acceptEncodingChanged(t,e){let n=b.revive(t),o=this._documentsAndEditors.getDocument(n);if(!o)throw new Error("unknown document");o._acceptEncoding(e),this._onDidChangeDocument.fire({document:o.document,contentChanges:[],reason:void 0}),this._onDidChangeDocumentWithReason.fire({document:o.document,contentChanges:[],reason:void 0,detailedReason:void 0})}$acceptModelChanged(t,e,n){let o=b.revive(t),i=this._documentsAndEditors.getDocument(o);if(!i)throw new Error("unknown document");i._acceptIsDirty(n),i.onEvents(e);let s;e.isUndoing?s=1:e.isRedoing&&(s=2),this._onDidChangeDocument.fire(Ah({document:i.document,contentChanges:e.changes.map(a=>({range:j.to(a.range),rangeOffset:a.rangeOffset,rangeLength:a.rangeLength,text:a.text})),reason:s})),this._onDidChangeDocumentWithReason.fire(Ah({document:i.document,contentChanges:e.changes.map(a=>({range:j.to(a.range),rangeOffset:a.rangeOffset,rangeLength:a.rangeLength,text:a.text})),reason:s,detailedReason:e.detailedReason?{source:e.detailedReason.source,metadata:e.detailedReason}:void 0}))}setWordDefinitionFor(t,e){yV(t,e)}};var sw=class{constructor(t){this._provider=new Map;this._onDidChange=new E;this.onDidChange=this._onDidChange.event;this._allKnownModels=new Set;this._handlePool=0;this._proxy=t.getProxy(F.MainThreadEmbeddings)}registerEmbeddingsProvider(t,e,n){if(this._allKnownModels.has(e))throw new Error("An embeddings provider for this model is already registered");let o=this._handlePool++;return this._proxy.$registerEmbeddingProvider(o,e),this._provider.set(o,{id:e,provider:n}),K(()=>{this._allKnownModels.delete(e),this._proxy.$unregisterEmbeddingProvider(o),this._provider.delete(o)})}async computeEmbeddings(t,e,n){n??=ve.None;let o=!1;typeof e=="string"&&(e=[e],o=!0);let i=await this._proxy.$computeEmbeddings(t,e,n);if(i.length!==e.length)throw new Error;if(o){if(i.length!==1)throw new Error;return i[0]}return i}async $provideEmbeddings(t,e,n){let o=this._provider.get(t);if(!o)return[];let i=await o.provider.provideEmbeddings(e,n);return i||[]}get embeddingsModels(){return Array.from(this._allKnownModels)}$acceptEmbeddingModels(t){this._allKnownModels=new Set(t),this._onDidChange.fire()}};var aw=class{constructor(t){this._AiEmbeddingVectorProviders=new Map;this._nextHandle=0;this._proxy=t.getProxy(F.MainThreadAiEmbeddingVector)}async $provideAiEmbeddingVector(t,e,n){if(this._AiEmbeddingVectorProviders.size===0)throw new Error("No embedding vector providers registered");let o=this._AiEmbeddingVectorProviders.get(t);if(!o)throw new Error("Embedding vector provider not found");let i=await o.provideEmbeddingVector(e,n);if(!i)throw new Error("Embedding vector provider returned undefined");return i}registerEmbeddingVectorProvider(t,e,n){let o=this._nextHandle;return this._nextHandle++,this._AiEmbeddingVectorProviders.set(o,n),this._proxy.$registerAiEmbeddingVectorProvider(e,o),new be(()=>{this._proxy.$unregisterAiEmbeddingVectorProvider(o),this._AiEmbeddingVectorProviders.delete(o)})}};var WL=class{constructor(t,e,n){let o=new Uint8Array(t*e);for(let i=0,s=t*e;i<s;i++)o[i]=n;this._data=o,this.rows=t,this.cols=e}get(t,e){return this._data[t*this.cols+e]}set(t,e,n){this._data[t*this.cols+e]=n}},Zb=class{constructor(t){let e=0,n=0;for(let i=0,s=t.length;i<s;i++){let[a,l,d]=t[i];l>e&&(e=l),a>n&&(n=a),d>n&&(n=d)}e++,n++;let o=new WL(n,e,0);for(let i=0,s=t.length;i<s;i++){let[a,l,d]=t[i];o.set(a,l,d)}this._states=o,this._maxCharCode=e}nextState(t,e){return e<0||e>=this._maxCharCode?0:this._states.get(t,e)}},HL=null;function tG(){return HL===null&&(HL=new Zb([[1,104,2],[1,72,2],[1,102,6],[1,70,6],[2,116,3],[2,84,3],[3,116,4],[3,84,4],[4,112,5],[4,80,5],[5,115,9],[5,83,9],[5,58,10],[6,105,7],[6,73,7],[7,108,8],[7,76,8],[8,101,9],[8,69,9],[9,58,10],[10,47,11],[11,47,12]])),HL}var Xb=null;function nG(){if(Xb===null){Xb=new wg(0);let r=` 	<>'"\u3001\u3002\uFF61\uFF64\uFF0C\uFF0E\uFF1A\uFF1B\u2018\u3008\u300C\u300E\u3014\uFF08\uFF3B\uFF5B\uFF62\uFF63\uFF5D\uFF3D\uFF09\u3015\u300F\u300D\u3009\u2019\uFF40\uFF5E\u2026|`;for(let e=0;e<r.length;e++)Xb.set(r.charCodeAt(e),1);let t=".,;:";for(let e=0;e<t.length;e++)Xb.set(t.charCodeAt(e),2)}return Xb}var lw=class r{static _createLink(t,e,n,o,i){let s=i-1;do{let a=e.charCodeAt(s);if(t.get(a)!==2)break;s--}while(s>o);if(o>0){let a=e.charCodeAt(o-1),l=e.charCodeAt(s);(a===40&&l===41||a===91&&l===93||a===123&&l===125)&&s--}return{range:{startLineNumber:n,startColumn:o+1,endLineNumber:n,endColumn:s+2},url:e.substring(o,s+1)}}static computeLinks(t,e=tG()){let n=nG(),o=[];for(let i=1,s=t.getLineCount();i<=s;i++){let a=t.getLineContent(i),l=a.length,d=0,c=0,u=0,m=1,g=!1,h=!1,f=!1,I=!1;for(;d<l;){let S=!1,T=a.charCodeAt(d);if(m===13){let P;switch(T){case 40:g=!0,P=0;break;case 41:P=g?0:1;break;case 91:f=!0,h=!0,P=0;break;case 93:f=!1,P=h?0:1;break;case 123:I=!0,P=0;break;case 125:P=I?0:1;break;case 39:case 34:case 96:u===T?P=1:u===39||u===34||u===96?P=0:P=1;break;case 42:P=u===42?1:0;break;case 32:P=f?0:1;break;default:P=n.get(T)}P===1&&(o.push(r._createLink(n,a,i,c,d)),S=!0)}else if(m===12){let P;T===91?(h=!0,P=0):P=n.get(T),P===1?S=!0:m=13}else m=e.nextState(m,T),m===0&&(S=!0);S&&(m=1,g=!1,h=!1,I=!1,c=d+1,u=T),d++}m===13&&o.push(r._createLink(n,a,i,c,l))}return o}};var VL=class{constructor(){this._schemes=[]}add(t){this._stateMachine=void 0,this._schemes.push(t)}delete(t){let e=this._schemes.indexOf(t);e>=0&&(this._schemes.splice(e,1),this._stateMachine=void 0)}_initStateMachine(){if(!this._stateMachine){let t=this._schemes.sort(),e=[],n,o,i=14,s=14;for(let a of t){let l=n?_U(n,a):0;for(l===0?o=1:o=s;l<a.length;l++)l+1===a.length?(i=s,s=9):s+=1,e.push([o,a.toUpperCase().charCodeAt(l),s]),e.push([o,a.toLowerCase().charCodeAt(l),s]),o=s;n=a,s=i}e.push([9,58,10]),e.push([10,47,12]),this._stateMachine=new Zb(e)}}provideDocumentLinks(t){this._initStateMachine();let e=[],n=lw.computeLinks({getLineContent(o){return t.lineAt(o-1).text},getLineCount(){return t.lineCount}},this._stateMachine);for(let o of n){let i=Wa.to(o);i.target&&e.push(i)}return e}},dw=class r{constructor(t,e){this._extHostLanguageFeatures=e;this._linkProvider=new VL;this._fsProvider=new Map;this._registeredSchemes=new Set;this._watches=new Map;this._handlePool=0;this._proxy=t.getProxy(F.MainThreadFileSystem)}dispose(){this._linkProviderRegistration?.dispose()}registerFileSystemProvider(t,e,n,o={}){if(r._validateFileSystemProvider(n),this._registeredSchemes.has(e))throw new Error(`a provider for the scheme '${e}' is already registered`);this._linkProviderRegistration||(this._linkProviderRegistration=this._extHostLanguageFeatures.registerDocumentLinkProvider(t,"*",this._linkProvider));let i=this._handlePool++;this._linkProvider.add(e),this._registeredSchemes.add(e),this._fsProvider.set(i,n);let s=2;o.isCaseSensitive&&(s+=1024),o.isReadonly&&(s+=2048),typeof n.copy=="function"&&(s+=8),typeof n.open=="function"&&typeof n.close=="function"&&typeof n.read=="function"&&typeof n.write=="function"&&(A(t,"fsChunks"),s+=4);let a;o.isReadonly&&Uo(o.isReadonly)&&o.isReadonly.value!==""&&(a={value:o.isReadonly.value,isTrusted:o.isReadonly.isTrusted,supportThemeIcons:o.isReadonly.supportThemeIcons,supportHtml:o.isReadonly.supportHtml,baseUri:o.isReadonly.baseUri,uris:o.isReadonly.uris}),this._proxy.$registerFileSystemProvider(i,e,s,a).catch(d=>{console.error(`FAILED to register filesystem provider of ${t.identifier.value}-extension for the scheme ${e}`),console.error(d)});let l=n.onDidChangeFile(d=>{let c=[];for(let u of d){let{uri:m,type:g}=u;if(m.scheme!==e)continue;let h;switch(g){case 1:h=0;break;case 2:h=1;break;case 3:h=2;break;default:throw new Error("Unknown FileChangeType")}c.push({resource:m,type:h})}this._proxy.$onFileSystemChange(i,c)});return K(()=>{l.dispose(),this._linkProvider.delete(e),this._registeredSchemes.delete(e),this._fsProvider.delete(i),this._proxy.$unregisterProvider(i)})}static _validateFileSystemProvider(t){if(!t)throw new Error("MISSING provider");if(typeof t.watch!="function")throw new Error("Provider does NOT implement watch");if(typeof t.stat!="function")throw new Error("Provider does NOT implement stat");if(typeof t.readDirectory!="function")throw new Error("Provider does NOT implement readDirectory");if(typeof t.createDirectory!="function")throw new Error("Provider does NOT implement createDirectory");if(typeof t.readFile!="function")throw new Error("Provider does NOT implement readFile");if(typeof t.writeFile!="function")throw new Error("Provider does NOT implement writeFile");if(typeof t.delete!="function")throw new Error("Provider does NOT implement delete");if(typeof t.rename!="function")throw new Error("Provider does NOT implement rename")}static _asIStat(t){let{type:e,ctime:n,mtime:o,size:i,permissions:s}=t;return{type:e,ctime:n,mtime:o,size:i,permissions:s}}$stat(t,e){return Promise.resolve(this._getFsProvider(t).stat(b.revive(e))).then(n=>r._asIStat(n))}$readdir(t,e){return Promise.resolve(this._getFsProvider(t).readDirectory(b.revive(e)))}$readFile(t,e){return Promise.resolve(this._getFsProvider(t).readFile(b.revive(e))).then(n=>H.wrap(n))}$writeFile(t,e,n,o){return Promise.resolve(this._getFsProvider(t).writeFile(b.revive(e),n.buffer,o))}$delete(t,e,n){return Promise.resolve(this._getFsProvider(t).delete(b.revive(e),n))}$rename(t,e,n,o){return Promise.resolve(this._getFsProvider(t).rename(b.revive(e),b.revive(n),o))}$copy(t,e,n,o){let i=this._getFsProvider(t);if(!i.copy)throw new Error('FileSystemProvider does not implement "copy"');return Promise.resolve(i.copy(b.revive(e),b.revive(n),o))}$mkdir(t,e){return Promise.resolve(this._getFsProvider(t).createDirectory(b.revive(e)))}$watch(t,e,n,o){let i=this._getFsProvider(t).watch(b.revive(n),o);this._watches.set(e,i)}$unwatch(t,e){let n=this._watches.get(e);n&&(n.dispose(),this._watches.delete(e))}$open(t,e,n){let o=this._getFsProvider(t);if(!o.open)throw new Error('FileSystemProvider does not implement "open"');return Promise.resolve(o.open(b.revive(e),n))}$close(t,e){let n=this._getFsProvider(t);if(!n.close)throw new Error('FileSystemProvider does not implement "close"');return Promise.resolve(n.close(e))}$read(t,e,n,o){let i=this._getFsProvider(t);if(!i.read)throw new Error('FileSystemProvider does not implement "read"');let s=H.alloc(o);return Promise.resolve(i.read(e,n,s.buffer,0,o)).then(a=>s.slice(0,a))}$write(t,e,n,o){let i=this._getFsProvider(t);if(!i.write)throw new Error('FileSystemProvider does not implement "write"');return Promise.resolve(i.write(e,n,o.buffer,0,o.byteLength))}_getFsProvider(t){let e=this._fsProvider.get(t);if(!e){let n=new Error;throw n.name="ENOPRO",n.message="no provider",n}return e}};function mw(r){return typeof r.correlationId=="number"}function MB(r){return r.recursive===!0}var cw=class r extends O{constructor(e,n,o,i){super();this.onFileChanges=e;this.onLogMessage=n;this.verboseLogging=o;this.options=i;this.watcherDisposables=this._register(new sn);this.requests=void 0;this.restartCounter=0}static{this.MAX_RESTARTS=5}init(){let e=new $;this.watcherDisposables.value=e,this.watcher=this.createWatcher(e),this.watcher.setVerboseLogging(this.verboseLogging),e.add(this.watcher.onDidChangeFile(n=>this.onFileChanges(n))),e.add(this.watcher.onDidLogMessage(n=>this.onLogMessage(n))),e.add(this.watcher.onDidError(n=>this.onError(n.error,n.request)))}onError(e,n){this.canRestart(e,n)?this.restartCounter<r.MAX_RESTARTS&&this.requests?(this.error(`restarting watcher after unexpected error: ${e}`),this.restart(this.requests)):this.error(`gave up attempting to restart watcher after unexpected error: ${e}`):this.error(e)}canRestart(e,n){return!(!this.options.restartOnError||n||e.indexOf("No space left on device")!==-1||e.indexOf("EMFILE")!==-1)}restart(e){this.restartCounter++,this.init(),this.watch(e)}async watch(e){this.requests=e,await this.watcher?.watch(e)}async setVerboseLogging(e){this.verboseLogging=e,await this.watcher?.setVerboseLogging(e)}error(e){this.onLogMessage({type:"error",message:`[File Watcher (${this.options.type})] ${e}`})}trace(e){this.onLogMessage({type:"trace",message:`[File Watcher (${this.options.type})] ${e}`})}dispose(){return this.watcher=void 0,super.dispose()}},uw=class extends cw{constructor(t,e,n){super(t,e,n,{type:"node.js",restartOnError:!1})}},pw=class extends cw{constructor(t,e,n){super(t,e,n,{type:"universal",restartOnError:!0})}};function zL(r){return r.map(t=>({type:t.type,resource:b.revive(t.resource),cId:t.cId}))}function LB(r){let t=new $L;for(let e of r)t.processEvent(e);return t.coalesce()}function qL(r,t){return typeof t=="string"&&!t.startsWith(ha)&&!En(t)?{base:r,pattern:t}:t}function KL(r,t,e){let n=[];for(let o of t)n.push(Co(qL(r,o),{ignoreCase:e}));return n}var $L=class{constructor(){this.coalesced=new Set;this.mapPathToChange=new Map}toKey(t){return Qe?t.resource.fsPath:t.resource.fsPath.toLowerCase()}processEvent(t){let e=this.mapPathToChange.get(this.toKey(t)),n=!1;if(e){let o=e.type,i=t.type;e.resource.fsPath!==t.resource.fsPath&&(t.type===2||t.type===1)?n=!0:o===1&&i===2?(this.mapPathToChange.delete(this.toKey(t)),this.coalesced.delete(e)):o===2&&i===1?e.type=0:o===1&&i===0||(e.type=i)}else n=!0;n&&(this.coalesced.add(t),this.mapPathToChange.set(this.toKey(t),t))}coalesce(){let t=[],e=[];return Array.from(this.coalesced).filter(n=>n.type!==2?(t.push(n),!1):!0).sort((n,o)=>n.resource.fsPath.length-o.resource.fsPath.length).filter(n=>e.some(o=>l2(n.resource.fsPath,o,!Qe))?!1:(e.push(n.resource.fsPath),!0)).concat(t)}};function OB(r,t){if(typeof t=="number")switch(r.type){case 1:return(t&4)===0;case 2:return(t&8)===0;case 0:return(t&2)===0}return!1}function NB(r){if(typeof r=="number"){let t=[];return r&4&&t.push("Added"),r&8&&t.push("Deleted"),r&2&&t.push("Updated"),t.length===0?"<all>":`[${t.join(", ")}]`}return"<none>"}var jL=class{constructor(t,e,n,o,i,s,a,l){this.session=Math.random();this._onDidCreate=new E;this._onDidChange=new E;this._onDidDelete=new E;this._config=0,l.ignoreCreateEvents&&(this._config+=1),l.ignoreChangeEvents&&(this._config+=2),l.ignoreDeleteEvents&&(this._config+=4);let d=typeof a=="string"?!((n.getCapabilities(V.file)??0)&1024):n.extUri.ignorePathCasing(b.revive(a.baseUri)),c=a;d&&(c=typeof a=="string"?a.toLowerCase():{base:a.base.toLowerCase(),pattern:a.pattern.toLowerCase()});let u=Co(c,{ignoreCase:!1}),m=typeof a=="string",g=!1,h=s(f=>{if(!(typeof f.session=="number"&&f.session!==this.session)&&!(g&&typeof f.session>"u")){if(!l.ignoreCreateEvents)for(let{uri:I,lowerCaseFsPath:S}of f.created)u(d?S:I.fsPath)&&(!m||o.getWorkspaceFolder(I))&&this._onDidCreate.fire(I);if(!l.ignoreChangeEvents)for(let{uri:I,lowerCaseFsPath:S}of f.changed)u(d?S:I.fsPath)&&(!m||o.getWorkspaceFolder(I))&&this._onDidChange.fire(I);if(!l.ignoreDeleteEvents)for(let{uri:I,lowerCaseFsPath:S}of f.deleted)u(d?S:I.fsPath)&&(!m||o.getWorkspaceFolder(I))&&this._onDidDelete.fire(I)}});this._disposable=be.from(this.ensureWatching(t,o,e,i,a,l,!1),this._onDidCreate,this._onDidChange,this._onDidDelete,h)}get ignoreCreateEvents(){return!!(this._config&1)}get ignoreChangeEvents(){return!!(this._config&2)}get ignoreDeleteEvents(){return!!(this._config&4)}ensureWatching(t,e,n,o,i,s,a){let l=be.from();if(typeof i=="string"||s.ignoreChangeEvents&&s.ignoreCreateEvents&&s.ignoreDeleteEvents)return l;let d=t.getProxy(F.MainThreadFileSystemEventService),c=!1;(i.pattern.includes(ha)||i.pattern.includes(lS))&&(c=!0);let u=[],m,g;if(a)(s.ignoreChangeEvents||s.ignoreCreateEvents||s.ignoreDeleteEvents)&&(g=14,s.ignoreChangeEvents&&(g&=-3),s.ignoreCreateEvents&&(g&=-5),s.ignoreDeleteEvents&&(g&=-9));else if(c&&u.length===0){let h=e.getWorkspaceFolder(b.revive(i.baseUri)),f=n.getConfiguration("files",h).get("watcherExclude");if(f)for(let I in f)I&&f[I]===!0&&u.push(I)}else if(!c){let h=e.getWorkspaceFolder(b.revive(i.baseUri));if(h){let f=n.getConfiguration("files",h).get("watcherExclude");if(f){for(let I in f)if(I&&f[I]===!0){let S=`${mr(I,"/")}/${ha}`;m||(m=[]),m.push(qL(h.uri.fsPath,S))}}if(!m||m.length===0)return l}}return d.$watch(o.identifier.value,this.session,i.baseUri,{recursive:c,excludes:u,includes:m,filter:g},!!a),be.from({dispose:()=>d.$unwatch(this.session)})}dispose(){this._disposable.dispose()}get onDidCreate(){return this._onDidCreate.event}get onDidChange(){return this._onDidChange.event}get onDidDelete(){return this._onDidDelete.event}},GL=class r{constructor(t){this._events=t;this._created=new mt(()=>this._events.created.map(r._revive));this._changed=new mt(()=>this._events.changed.map(r._revive));this._deleted=new mt(()=>this._events.deleted.map(r._revive));this.session=this._events.session}get created(){return this._created.value}get changed(){return this._changed.value}get deleted(){return this._deleted.value}static _revive(t){let e=b.revive(t);return{uri:e,lowerCaseFsPath:e.fsPath.toLowerCase()}}},gw=class{constructor(t,e,n){this._mainContext=t;this._logService=e;this._extHostDocumentsAndEditors=n;this._onFileSystemEvent=new E;this._onDidRenameFile=new E;this._onDidCreateFile=new E;this._onDidDeleteFile=new E;this._onWillRenameFile=new ns;this._onWillCreateFile=new ns;this._onWillDeleteFile=new ns;this.onDidRenameFile=this._onDidRenameFile.event;this.onDidCreateFile=this._onDidCreateFile.event;this.onDidDeleteFile=this._onDidDeleteFile.event}createFileSystemWatcher(t,e,n,o,i,s){return new jL(this._mainContext,e,n,t,o,this._onFileSystemEvent.event,$o.from(i),s)}$onFileEvent(t){this._onFileSystemEvent.fire(new GL(t))}$onDidRunFileOperation(t,e){switch(t){case 2:this._onDidRenameFile.fire(Object.freeze({files:e.map(n=>({oldUri:b.revive(n.source),newUri:b.revive(n.target)}))}));break;case 1:this._onDidDeleteFile.fire(Object.freeze({files:e.map(n=>b.revive(n.target))}));break;case 0:case 3:this._onDidCreateFile.fire(Object.freeze({files:e.map(n=>b.revive(n.target))}));break;default:}}getOnWillRenameFileEvent(t){return this._createWillExecuteEvent(t,this._onWillRenameFile)}getOnWillCreateFileEvent(t){return this._createWillExecuteEvent(t,this._onWillCreateFile)}getOnWillDeleteFileEvent(t){return this._createWillExecuteEvent(t,this._onWillDeleteFile)}_createWillExecuteEvent(t,e){return(n,o,i)=>{let s=function(l){n.call(o,l)};return s.extension=t,e.event(s,void 0,i)}}async $onWillRunFileOperation(t,e,n,o){switch(t){case 2:return await this._fireWillEvent(this._onWillRenameFile,{files:e.map(i=>({oldUri:b.revive(i.source),newUri:b.revive(i.target)}))},n,o);case 1:return await this._fireWillEvent(this._onWillDeleteFile,{files:e.map(i=>b.revive(i.target))},n,o);case 0:case 3:return await this._fireWillEvent(this._onWillCreateFile,{files:e.map(i=>b.revive(i.target))},n,o)}}async _fireWillEvent(t,e,n,o){let i=new Set,s=[];if(await t.fireAsync(e,o,async(l,d)=>{let c=Date.now(),u=await Promise.resolve(l);u instanceof Cr&&(s.push([d.extension,u]),i.add(d.extension.displayName??d.extension.identifier.value)),Date.now()-c>n&&this._logService.warn("SLOW file-participant",d.extension.identifier)}),o.isCancellationRequested||s.length===0)return;let a={edits:[]};for(let[,l]of s){let{edits:d}=mo.from(l,{getTextDocumentVersion:c=>this._extHostDocumentsAndEditors.getDocument(c)?.version,getNotebookDocumentVersion:()=>{}});a.edits=a.edits.concat(d)}return{edit:a,extensionNames:Array.from(i)}}};var fw=class{constructor(t,e,n,o,i){this._extHostNotebooks=e;this._textDocumentsAndEditors=n;this._commands=o;let s=new Re("interactive.open","_interactive.open","Open interactive window and return notebook editor and input URI",[new Z("showOptions","Show Options",a=>!0,a=>a),new Z("resource","Interactive resource Uri",a=>!0,a=>a),new Z("controllerId","Notebook controller Id",a=>!0,a=>a),new Z("title","Interactive editor title",a=>!0,a=>a)],new ke("Notebook and input URI",a=>{if(i.debug("[ExtHostInteractive] open iw with notebook editor id",a.notebookEditorId),a.notebookEditorId!==void 0){let l=this._extHostNotebooks.getEditorById(a.notebookEditorId);return i.debug("[ExtHostInteractive] notebook editor found",l.id),{notebookUri:b.revive(a.notebookUri),inputUri:b.revive(a.inputUri),notebookEditor:l.apiEditor}}return i.debug("[ExtHostInteractive] notebook editor not found, uris for the interactive document",a.notebookUri,a.inputUri),{notebookUri:b.revive(a.notebookUri),inputUri:b.revive(a.inputUri)}}));this._commands.registerApiCommand(s)}$willAddInteractiveDocument(t,e,n,o){this._textDocumentsAndEditors.acceptDocumentsAndEditorsDelta({addedDocuments:[{EOL:e,lines:[""],languageId:n,uri:t,isDirty:!1,versionId:1,encoding:"utf8"}]})}$willRemoveInteractiveDocument(t,e){this._textDocumentsAndEditors.acceptDocumentsAndEditorsDelta({removedDocuments:[t]})}};var hw=class{constructor(t){this._handlePool=0;this._proxy=t.getProxy(F.MainThreadLabelService)}$registerResourceLabelFormatter(t){let e=this._handlePool++;return this._proxy.$registerResourceLabelFormatter(e,t),K(()=>{this._proxy.$unregisterResourceLabelFormatter(e)})}};var vw=class r extends We{constructor(t,e,n,o){super(t,e,n,o),this.selectionStartLineNumber=t,this.selectionStartColumn=e,this.positionLineNumber=n,this.positionColumn=o}toString(){return"["+this.selectionStartLineNumber+","+this.selectionStartColumn+" -> "+this.positionLineNumber+","+this.positionColumn+"]"}equalsSelection(t){return r.selectionsEqual(this,t)}static selectionsEqual(t,e){return t.selectionStartLineNumber===e.selectionStartLineNumber&&t.selectionStartColumn===e.selectionStartColumn&&t.positionLineNumber===e.positionLineNumber&&t.positionColumn===e.positionColumn}getDirection(){return this.selectionStartLineNumber===this.startLineNumber&&this.selectionStartColumn===this.startColumn?0:1}setEndPosition(t,e){return this.getDirection()===0?new r(this.startLineNumber,this.startColumn,t,e):new r(t,e,this.startLineNumber,this.startColumn)}getPosition(){return new An(this.positionLineNumber,this.positionColumn)}getSelectionStart(){return new An(this.selectionStartLineNumber,this.selectionStartColumn)}setStartPosition(t,e){return this.getDirection()===0?new r(t,e,this.endLineNumber,this.endColumn):new r(this.endLineNumber,this.endColumn,t,e)}static fromPositions(t,e=t){return new r(t.lineNumber,t.column,e.lineNumber,e.column)}static fromRange(t,e){return e===0?new r(t.startLineNumber,t.startColumn,t.endLineNumber,t.endColumn):new r(t.endLineNumber,t.endColumn,t.startLineNumber,t.startColumn)}static liftSelection(t){return new r(t.selectionStartLineNumber,t.selectionStartColumn,t.positionLineNumber,t.positionColumn)}static selectionsArrEqual(t,e){if(t&&!e||!t&&e)return!1;if(!t&&!e)return!0;if(t.length!==e.length)return!1;for(let n=0,o=t.length;n<o;n++)if(!this.selectionsEqual(t[n],e[n]))return!1;return!0}static isISelection(t){return!!t&&typeof t.selectionStartLineNumber=="number"&&typeof t.selectionStartColumn=="number"&&typeof t.positionLineNumber=="number"&&typeof t.positionColumn=="number"}static createWithDirection(t,e,n,o,i){return i===0?new r(t,e,n,o):new r(n,o,t,e)}};var bw=class r{constructor(t,e){this._documents=t;this._provider=e}async provideDocumentSymbols(t,e){let n=this._documents.getDocument(t),o=await this._provider.provideDocumentSymbols(n,e);if(!sh(o))return o[0]instanceof Nr?o.map(Y1.from):r._asDocumentSymbolTree(o)}static _asDocumentSymbolTree(t){t=t.slice(0).sort((o,i)=>{let s=o.location.range.start.compareTo(i.location.range.start);return s===0&&(s=i.location.range.end.compareTo(o.location.range.end)),s});let e=[],n=[];for(let o of t){let i={name:o.name||"!!MISSING: name!!",kind:Ur.from(o.kind),tags:o.tags?.map(Na.from)||[],detail:"",containerName:o.containerName,range:j.from(o.location.range),selectionRange:j.from(o.location.range),children:[]};for(;;){if(n.length===0){n.push(i),e.push(i);break}let s=n[n.length-1];if(We.containsRange(s.range,i.range)&&!We.equalsRange(s.range,i.range)){s.children?.push(i),n.push(i);break}n.pop()}}return e}},vf=class{constructor(t,e,n,o,i,s){this._documents=t;this._commands=e;this._provider=n;this._extension=o;this._extTelemetry=i;this._logService=s;this._cache=new qo("CodeLens");this._disposables=new Map}async provideCodeLenses(t,e){let n=this._documents.getDocument(t),o=await this._provider.provideCodeLenses(n,e);if(!o||e.isCancellationRequested)return;let i=this._cache.add(o),s=new $;this._disposables.set(i,s);let a={cacheId:i,lenses:[]};for(let l=0;l<o.length;l++){if(!fe.isRange(o[l].range)){console.warn("INVALID code lens, range is not defined",this._extension.identifier.value);continue}a.lenses.push({cacheId:[i,l],range:j.from(o[l].range),command:this._commands.toInternal(o[l].command,s)})}return a}async resolveCodeLens(t,e){let n=t.cacheId&&this._cache.get(...t.cacheId);if(!n)return;let o;if(typeof this._provider.resolveCodeLens!="function"||n.isResolved?o=n:o=await this._provider.resolveCodeLens(n,e),o||(o=n),e.isCancellationRequested)return;let i=t.cacheId&&this._disposables.get(t.cacheId[0]);if(i){if(!o.command){let s=new Error("INVALID code lens resolved, lacks command: "+this._extension.identifier.value);this._extTelemetry.onExtensionError(this._extension.identifier,s),this._logService.error(s);return}return t.command=this._commands.toInternal(o.command,i),t}}releaseCodeLenses(t){this._disposables.get(t)?.dispose(),this._disposables.delete(t),this._cache.delete(t)}};function Ow(r){return Array.isArray(r)?r.map(Bm.from):r?[Bm.from(r)]:[]}var yw=class{constructor(t,e){this._documents=t;this._provider=e}async provideDefinition(t,e,n){let o=this._documents.getDocument(t),i=ct.to(e),s=await this._provider.provideDefinition(o,i,n);return Ow(s)}},Iw=class{constructor(t,e){this._documents=t;this._provider=e}async provideDeclaration(t,e,n){let o=this._documents.getDocument(t),i=ct.to(e),s=await this._provider.provideDeclaration(o,i,n);return Ow(s)}},xw=class{constructor(t,e){this._documents=t;this._provider=e}async provideImplementation(t,e,n){let o=this._documents.getDocument(t),i=ct.to(e),s=await this._provider.provideImplementation(o,i,n);return Ow(s)}},Sw=class{constructor(t,e){this._documents=t;this._provider=e}async provideTypeDefinition(t,e,n){let o=this._documents.getDocument(t),i=ct.to(e),s=await this._provider.provideTypeDefinition(o,i,n);return Ow(s)}},ey=class r{constructor(t,e){this._documents=t;this._provider=e;this._hoverCounter=0;this._hoverMap=new Map}static{this.HOVER_MAP_MAX_SIZE=10}async provideHover(t,e,n,o){let i=this._documents.getDocument(t),s=ct.to(e),a;if(n&&n.verbosityRequest){let u=n.verbosityRequest.previousHover.id,m=this._hoverMap.get(u);if(!m)throw new Error(`Hover with id ${u} not found`);let g={verbosityDelta:n.verbosityRequest.verbosityDelta,previousHover:m};a=await this._provider.provideHover(i,s,o,g)}else a=await this._provider.provideHover(i,s,o);if(!a||sh(a.contents))return;a.range||(a.range=i.getWordRangeAtPosition(s)),a.range||(a.range=new fe(s,s));let l=$m.from(a),d=this._hoverCounter;if(this._hoverMap.size===r.HOVER_MAP_MAX_SIZE){let u=Math.min(...this._hoverMap.keys());this._hoverMap.delete(u)}return this._hoverMap.set(d,a),this._hoverCounter+=1,{...l,id:d}}releaseHover(t){this._hoverMap.delete(t)}},Cw=class{constructor(t,e){this._documents=t;this._provider=e}async provideEvaluatableExpression(t,e,n){let o=this._documents.getDocument(t),i=ct.to(e),s=await this._provider.provideEvaluatableExpression(o,i,n);if(s)return eM.from(s)}},Tw=class{constructor(t,e){this._documents=t;this._provider=e}async provideInlineValues(t,e,n,o){let i=this._documents.getDocument(t),s=await this._provider.provideInlineValues(i,j.to(e),eb.to(n),o);if(Array.isArray(s))return s.map(a=>Zv.from(a))}},Ew=class{constructor(t,e){this._documents=t;this._provider=e}async provideDocumentHighlights(t,e,n){let o=this._documents.getDocument(t),i=ct.to(e),s=await this._provider.provideDocumentHighlights(o,i,n);if(Array.isArray(s))return s.map(ou.from)}},ww=class{constructor(t,e,n){this._documents=t;this._provider=e;this._logService=n}async provideMultiDocumentHighlights(t,e,n,o){let i=this._documents.getDocument(t),s=n.map(d=>{try{return this._documents.getDocument(d)}catch(c){this._logService.error("Error: Unable to retrieve document from URI: "+d+". Error message: "+c);return}}).filter(d=>d!==void 0),a=ct.to(e),l=await this._provider.provideMultiDocumentHighlights(i,a,s,o);if(Array.isArray(l))return l.map(tM.from)}},kw=class{constructor(t,e){this._documents=t;this._provider=e}async provideLinkedEditingRanges(t,e,n){let o=this._documents.getDocument(t),i=ct.to(e),s=await this._provider.provideLinkedEditingRanges(o,i,n);if(s&&Array.isArray(s.ranges))return{ranges:tt(s.ranges.map(j.from)),wordPattern:s.wordPattern}}},Pw=class{constructor(t,e){this._documents=t;this._provider=e}async provideReferences(t,e,n,o){let i=this._documents.getDocument(t),s=ct.to(e),a=await this._provider.provideReferences(i,s,n,o);if(Array.isArray(a))return a.map(po.from)}},bf=class r{constructor(t,e,n,o,i,s,a){this._documents=t;this._commands=e;this._diagnostics=n;this._provider=o;this._logService=i;this._extension=s;this._apiDeprecation=a;this._cache=new qo("CodeAction");this._disposables=new Map}static{this._maxCodeActionsPerFile=1e3}async provideCodeActions(t,e,n,o){let i=this._documents.getDocument(t),s=vw.isISelection(e)?Eo.to(e):j.to(e),a=[];for(let g of this._diagnostics.getDiagnostics(t))if(s.intersection(g.range)&&a.push(g)>r._maxCodeActionsPerFile)break;let l={diagnostics:a,only:n.only?new St(n.only):void 0,triggerKind:mM.to(n.trigger)},d=await this._provider.provideCodeActions(i,s,l,o);if(!tl(d)||o.isCancellationRequested)return;let c=this._cache.add(d),u=new $;this._disposables.set(c,u);let m=[];for(let g=0;g<d.length;g++){let h=d[g];if(h)if(r._isCommand(h)&&!(h instanceof xs))this._apiDeprecation.report("CodeActionProvider.provideCodeActions - return commands",this._extension,"Return 'CodeAction' instances instead."),m.push({_isSynthetic:!0,title:h.title,command:this._commands.toInternal(h,u)});else{let f=h;l.only&&(f.kind?l.only.contains(f.kind)||this._logService.warn(`${this._extension.identifier.value} - Code actions of kind '${l.only.value}' requested but returned code action is of kind '${f.kind.value}'. Code action will be dropped. Please check 'CodeActionContext.only' to only return requested code actions.`):this._logService.warn(`${this._extension.identifier.value} - Code actions of kind '${l.only.value}' requested but returned code action does not have a 'kind'. Code action will be dropped. Please set 'CodeAction.kind'.`));let I=f.ranges??[];m.push({cacheId:[c,g],title:f.title,command:f.command&&this._commands.toInternal(f.command,u),diagnostics:f.diagnostics&&f.diagnostics.map(Fa.from),edit:f.edit&&mo.from(f.edit,void 0),kind:f.kind&&f.kind.value,isPreferred:f.isPreferred,isAI:He(this._extension,"codeActionAI")?f.isAI:!1,ranges:He(this._extension,"codeActionRanges")?tt(I.map(j.from)):void 0,disabled:f.disabled?.reason})}}return{cacheId:c,actions:m}}async resolveCodeAction(t,e){let[n,o]=t,i=this._cache.get(n,o);if(!i||r._isCommand(i))return{};if(!this._provider.resolveCodeAction)return{};let s=await this._provider.resolveCodeAction(i,e)??i,a;s.edit&&(a=mo.from(s.edit,void 0));let l;if(s.command){let d=this._disposables.get(n);d&&(l=this._commands.toInternal(s.command,d))}return{edit:a,command:l}}releaseCodeActions(t){this._disposables.get(t)?.dispose(),this._disposables.delete(t),this._cache.delete(t)}static _isCommand(t){return typeof t.command=="string"&&typeof t.title=="string"}},Au=class{constructor(t,e,n,o,i){this._proxy=t;this._documents=e;this._provider=n;this._handle=o;this._extension=i;this._editsCache=new qo("DocumentPasteEdit.edits")}async prepareDocumentPaste(t,e,n,o){if(!this._provider.prepareDocumentPaste)return;this._cachedPrepare=void 0;let i=this._documents.getDocument(t),s=e.map(u=>j.to(u)),a=cu.toDataTransfer(n,()=>{throw new Wy});if(await this._provider.prepareDocumentPaste(i,s,a,o),o.isCancellationRequested)return;let l=Array.from(a).filter(([,u])=>!(u instanceof Yl)),d=new Map,c=await Promise.all(Array.from(l,async([u,m])=>{let g=Ae();return d.set(g,m),[u,await nu.from(u,m,g)]}));return this._cachedPrepare=d,{items:c}}async providePasteEdits(t,e,n,o,i,s){if(!this._provider.provideDocumentPasteEdits)return[];let a=this._documents.getDocument(e),l=n.map(g=>j.to(g)),d=o.items.map(([g,h])=>{let f=this._cachedPrepare?.get(h.id);return f?[g,f]:[g,nu.to(g,h,async I=>(await this._proxy.$resolvePasteFileData(this._handle,t,I)).buffer)]}),c=new Zr(d),u=await this._provider.provideDocumentPasteEdits(a,l,c,{only:i.only?new ei(i.only):void 0,triggerKind:i.triggerKind},s);if(!u||s.isCancellationRequested)return[];let m=this._editsCache.add(u);return u.map((g,h)=>({_cacheId:[m,h],title:g.title??p(3491,null,this._extension.displayName||this._extension.name),kind:g.kind,yieldTo:g.yieldTo?.map(f=>f.value),insertText:typeof g.insertText=="string"?g.insertText:{snippet:g.insertText.value},additionalEdit:g.additionalEdit?mo.from(g.additionalEdit,void 0):void 0}))}async resolvePasteEdit(t,e){let[n,o]=t,i=this._editsCache.get(n,o);if(!i||!this._provider.resolveDocumentPasteEdit)return{};let s=await this._provider.resolveDocumentPasteEdit(i,e)??i;return{insertText:s.insertText,additionalEdit:s.additionalEdit?mo.from(s.additionalEdit,void 0):void 0}}releasePasteEdits(t){this._editsCache.delete(t)}},_w=class{constructor(t,e){this._documents=t;this._provider=e}async provideDocumentFormattingEdits(t,e,n){let o=this._documents.getDocument(t),i=await this._provider.provideDocumentFormattingEdits(o,e,n);if(Array.isArray(i))return i.map(Pn.from)}},ty=class{constructor(t,e){this._documents=t;this._provider=e}async provideDocumentRangeFormattingEdits(t,e,n,o){let i=this._documents.getDocument(t),s=j.to(e),a=await this._provider.provideDocumentRangeFormattingEdits(i,s,n,o);if(Array.isArray(a))return a.map(Pn.from)}async provideDocumentRangesFormattingEdits(t,e,n,o){ep(typeof this._provider.provideDocumentRangesFormattingEdits=="function","INVALID invocation of `provideDocumentRangesFormattingEdits`");let i=this._documents.getDocument(t),s=e.map(j.to),a=await this._provider.provideDocumentRangesFormattingEdits(i,s,n,o);if(Array.isArray(a))return a.map(Pn.from)}},Dw=class{constructor(t,e){this._documents=t;this._provider=e;this.autoFormatTriggerCharacters=[]}async provideOnTypeFormattingEdits(t,e,n,o,i){let s=this._documents.getDocument(t),a=ct.to(e),l=await this._provider.provideOnTypeFormattingEdits(s,a,n,o,i);if(Array.isArray(l))return l.map(Pn.from)}},yf=class{constructor(t,e){this._provider=t;this._logService=e;this._cache=new qo("WorkspaceSymbols")}async provideWorkspaceSymbols(t,e){let n=await this._provider.provideWorkspaceSymbols(t,e);if(!tl(n))return{symbols:[]};let o=this._cache.add(n),i={cacheId:o,symbols:[]};for(let s=0;s<n.length;s++){let a=n[s];if(!a||!a.name){this._logService.warn("INVALID SymbolInformation",a);continue}i.symbols.push({...cd.from(a),cacheId:[o,s]})}return i}async resolveWorkspaceSymbol(t,e){if(typeof this._provider.resolveWorkspaceSymbol!="function"||!t.cacheId)return t;let n=this._cache.get(...t.cacheId);if(n){let o=await this._provider.resolveWorkspaceSymbol(n,e);return o&&Qo(t,cd.from(o),!0)}}releaseWorkspaceSymbols(t){this._cache.delete(t)}},If=class r{constructor(t,e,n){this._documents=t;this._provider=e;this._logService=n}static supportsResolving(t){return typeof t.prepareRename=="function"}async provideRenameEdits(t,e,n,o){let i=this._documents.getDocument(t),s=ct.to(e);try{let a=await this._provider.provideRenameEdits(i,s,n,o);return a?mo.from(a):void 0}catch(a){let l=r._asMessage(a);return l?{rejectReason:l,edits:void 0}:Promise.reject(a)}}async resolveRenameLocation(t,e,n){if(typeof this._provider.prepareRename!="function")return Promise.resolve(void 0);let o=this._documents.getDocument(t),i=ct.to(e);try{let s=await this._provider.prepareRename(o,i,n),a,l;if(fe.isRange(s)?(a=s,l=o.getText(s)):it(s)&&(a=s.range,l=s.placeholder),!a||!l)return;if(a.start.line>i.line||a.end.line<i.line){this._logService.warn("INVALID rename location: position line must be within range start/end lines");return}return{range:j.from(a),text:l}}catch(s){let a=r._asMessage(s);return a?{rejectReason:a,range:void 0,text:void 0}:Promise.reject(s)}}static _asMessage(t){return typeof t=="string"?t:t instanceof Error&&typeof t.message=="string"?t.message:void 0}},ny=class r{constructor(t,e,n){this._documents=t;this._provider=e;this._logService=n}static{this.languageTriggerKindToVSCodeTriggerKind={0:0,1:1}}async supportsAutomaticNewSymbolNamesTriggerKind(){return this._provider.supportsAutomaticTriggerKind}async provideNewSymbolNames(t,e,n,o){let i=this._documents.getDocument(t),s=j.to(e);try{let a=r.languageTriggerKindToVSCodeTriggerKind[n],l=await this._provider.provideNewSymbolNames(i,s,a,o);return l?l.map(d=>typeof d=="string"?{newSymbolName:d}:{newSymbolName:d.newSymbolName,tags:d.tags}):void 0}catch(a){this._logService.error(r._asMessage(a)??JSON.stringify(a,null,"	"));return}}static _asMessage(t){return typeof t=="string"?t:t instanceof Error&&typeof t.message=="string"?t.message:void 0}},oy=class{constructor(t,e){this.resultId=t;this.tokens=e}},ry=class r{constructor(t,e){this._documents=t;this._provider=e;this._nextResultId=1;this._previousResults=new Map}async provideDocumentSemanticTokens(t,e,n){let o=this._documents.getDocument(t),i=e!==0?this._previousResults.get(e):null,s=typeof i?.resultId=="string"&&typeof this._provider.provideDocumentSemanticTokensEdits=="function"?await this._provider.provideDocumentSemanticTokensEdits(o,i.resultId,n):await this._provider.provideDocumentSemanticTokens(o,n);return i&&this._previousResults.delete(e),s?(s=r._fixProvidedSemanticTokens(s),this._send(r._convertToEdits(i,s),s)):null}async releaseDocumentSemanticColoring(t){this._previousResults.delete(t)}static _fixProvidedSemanticTokens(t){return r._isSemanticTokens(t)?r._isCorrectSemanticTokens(t)?t:new Oi(new Uint32Array(t.data),t.resultId):r._isSemanticTokensEdits(t)?r._isCorrectSemanticTokensEdits(t)?t:new Xl(t.edits.map(e=>new pm(e.start,e.deleteCount,e.data?new Uint32Array(e.data):e.data)),t.resultId):t}static _isSemanticTokens(t){return t&&!!t.data}static _isCorrectSemanticTokens(t){return t.data instanceof Uint32Array}static _isSemanticTokensEdits(t){return t&&Array.isArray(t.edits)}static _isCorrectSemanticTokensEdits(t){for(let e of t.edits)if(!(e.data instanceof Uint32Array))return!1;return!0}static _convertToEdits(t,e){if(!r._isSemanticTokens(e)||!t||!t.tokens)return e;let n=t.tokens,o=n.length,i=e.data,s=i.length,a=0,l=Math.min(o,s);for(;a<l&&n[a]===i[a];)a++;if(a===o&&a===s)return new Xl([],e.resultId);let d=0,c=l-a;for(;d<c&&n[o-d-1]===i[s-d-1];)d++;return new Xl([{start:a,deleteCount:o-a-d,data:i.subarray(a,s-d)}],e.resultId)}_send(t,e){if(r._isSemanticTokens(t)){let n=this._nextResultId++;return this._previousResults.set(n,new oy(t.resultId,t.data)),VE({id:n,type:"full",data:t.data})}if(r._isSemanticTokensEdits(t)){let n=this._nextResultId++;return r._isSemanticTokens(e)?this._previousResults.set(n,new oy(e.resultId,e.data)):this._previousResults.set(n,new oy(t.resultId)),VE({id:n,type:"delta",deltas:(t.edits||[]).map(o=>({start:o.start,deleteCount:o.deleteCount,data:o.data}))})}return null}},Rw=class{constructor(t,e){this._documents=t;this._provider=e}async provideDocumentRangeSemanticTokens(t,e,n){let o=this._documents.getDocument(t),i=await this._provider.provideDocumentRangeSemanticTokens(o,j.to(e),n);return i?this._send(i):null}_send(t){return VE({id:0,type:"full",data:t.data})}},Mu=class r{constructor(t,e,n,o,i){this._documents=t;this._commands=e;this._provider=n;this._apiDeprecation=o;this._extension=i;this._cache=new qo("CompletionItem");this._disposables=new Map}static supportsResolving(t){return typeof t.resolveCompletionItem=="function"}async provideCompletionItems(t,e,n,o){let i=this._documents.getDocument(t),s=ct.to(e),a=i.getWordRangeAtPosition(s)||new fe(s,s),l=a.with({end:s}),d=new an,c=await this._provider.provideCompletionItems(i,s,o,nM.to(n));if(!c||o.isCancellationRequested)return;let u=Array.isArray(c)?new Pi(c):c,m=r.supportsResolving(this._provider)?this._cache.add(u.items):this._cache.add([]),g=new $;this._disposables.set(m,g);let h=[],f={x:m,b:h,a:{replace:j.from(a),insert:j.from(l)},c:u.isIncomplete||void 0,d:d.elapsed()};for(let I=0;I<u.items.length;I++){let S=u.items[I],T=this._convertCompletionItem(S,[m,I],l,a);h.push(T)}return f}async resolveCompletionItem(t,e){if(typeof this._provider.resolveCompletionItem!="function")return;let n=this._cache.get(...t);if(!n)return;let o=this._convertCompletionItem(n,t),i=await this._provider.resolveCompletionItem(n,e);if(!i)return;let s=this._convertCompletionItem(i,t);return(o.h!==s.h||o.i!==s.i)&&this._apiDeprecation.report("CompletionItem.insertText",this._extension,"extension MAY NOT change 'insertText' of a CompletionItem during resolve"),(o.n!==s.n||o.o!==s.o||!qt(o.p,s.p))&&this._apiDeprecation.report("CompletionItem.command",this._extension,"extension MAY NOT change 'command' of a CompletionItem during resolve"),{...o,d:s.d,c:s.c,l:s.l,h:s.h,i:s.i,n:s.n,o:s.o,p:s.p}}releaseCompletionItems(t){this._disposables.get(t)?.dispose(),this._disposables.delete(t),this._cache.delete(t)}_convertCompletionItem(t,e,n,o){let i=this._disposables.get(e[0]);if(!i)throw Error("DisposableStore is missing...");let s=this._commands.toInternal(t.command,i),a={x:e,a:t.label,b:t.kind!==void 0?oT.from(t.kind):void 0,m:t.tags&&t.tags.map(nT.from),c:t.detail,d:typeof t.documentation>"u"?void 0:ue.fromStrict(t.documentation),e:t.sortText!==t.label?t.sortText:void 0,f:t.filterText!==t.label?t.filterText:void 0,g:t.preselect||void 0,i:t.keepWhitespace?1:0,k:t.commitCharacters?.join(""),l:t.additionalTextEdits&&t.additionalTextEdits.map(Pn.from),n:s?.$ident,o:s?.id,p:s?.$ident?void 0:s?.arguments};t.textEdit?(this._apiDeprecation.report("CompletionItem.textEdit",this._extension,"Use 'CompletionItem.insertText' and 'CompletionItem.range' instead."),a.h=t.textEdit.newText):typeof t.insertText=="string"?a.h=t.insertText:t.insertText instanceof Yn&&(a.h=t.insertText.value,a.i|=4);let l;return t.textEdit?l=t.textEdit.range:t.range&&(l=t.range),fe.isRange(l)?a.j=j.from(l):l&&(!n?.isEqual(l.inserting)||!o?.isEqual(l.replacing))&&(a.j={insert:j.from(l.inserting),replace:j.from(l.replacing)}),a}},qi=class{constructor(t,e,n,o){this._extension=t;this._documents=e;this._provider=n;this._commands=o;this._references=new QL;this.languageTriggerKindToVSCodeTriggerKind={0:1,1:0};this._isAdditionsProposedApiEnabled=He(this._extension,"inlineCompletionsAdditions")}get supportsHandleEvents(){return He(this._extension,"inlineCompletionsAdditions")&&(typeof this._provider.handleDidShowCompletionItem=="function"||typeof this._provider.handleDidPartiallyAcceptCompletionItem=="function"||typeof this._provider.handleDidRejectCompletionItem=="function"||typeof this._provider.handleEndOfLifetime=="function")}get supportsSetModelId(){return He(this._extension,"inlineCompletionsAdditions")&&typeof this._provider.setCurrentModelId=="function"}get supportsSetProviderOption(){return He(this._extension,"inlineCompletionsAdditions")&&typeof this._provider.setProviderOptionValue=="function"}get modelInfo(){if(this._isAdditionsProposedApiEnabled)return this._provider.modelInfo?{models:this._provider.modelInfo.models,currentModelId:this._provider.modelInfo.currentModelId}:void 0}setCurrentModelId(t){this._isAdditionsProposedApiEnabled&&this._provider.setCurrentModelId?.(t)}get providerOptions(){if(this._isAdditionsProposedApiEnabled)return this._provider.providerOptions?.map(t=>({id:t.id,label:t.label,values:t.values.map(e=>({id:e.id,label:e.label})),currentValueId:t.currentValueId}))}setProviderOption(t,e){this._isAdditionsProposedApiEnabled&&this._provider.setProviderOptionValue?.(t,e)}async provideInlineCompletions(t,e,n,o){let i=this._documents.getDocument(t),s=ct.to(e),a=await this._provider.provideInlineCompletionItems(i,s,{selectedCompletionInfo:n.selectedSuggestionInfo?{range:j.to(n.selectedSuggestionInfo.range),text:n.selectedSuggestionInfo.text}:void 0,triggerKind:this.languageTriggerKindToVSCodeTriggerKind[n.triggerKind],requestUuid:n.requestUuid,requestIssuedDateTime:n.requestIssuedDateTime,earliestShownDateTime:n.earliestShownDateTime,changeHint:n.changeHint},o);if(!a)return;let{resultItems:l,list:d}=Array.isArray(a)?{resultItems:a,list:void 0}:{resultItems:a.items,list:a},c=this._isAdditionsProposedApiEnabled?Array.isArray(a)?[]:a.commands||[]:[],u=this._isAdditionsProposedApiEnabled&&!Array.isArray(a)?a.enableForwardStability:void 0,m;return{pid:this._references.createReferenceId({dispose(){m?.dispose()},items:l,list:d}),languageId:i.languageId,items:l.map((f,I)=>{let S;f.command&&(m||(m=new $),S=this._commands.toInternal(f.command,m));let T;f.action&&(m||(m=new $),T=this._commands.toInternal(f.action,m));let P=f.insertText;return{insertText:P===void 0?void 0:typeof P=="string"?P:{snippet:P.value},range:f.range?j.from(f.range):void 0,showRange:this._isAdditionsProposedApiEnabled&&f.showRange?j.from(f.showRange):void 0,command:S,gutterMenuLinkAction:T,idx:I,completeBracketPairs:this._isAdditionsProposedApiEnabled?f.completeBracketPairs:!1,isInlineEdit:this._isAdditionsProposedApiEnabled?f.isInlineEdit:!1,showInlineEditMenu:this._isAdditionsProposedApiEnabled?f.showInlineEditMenu:!1,hint:f.displayLocation&&this._isAdditionsProposedApiEnabled?{range:j.from(f.displayLocation.range),content:f.displayLocation.label,style:f.displayLocation.kind?xM.from(f.displayLocation.kind):1}:void 0,warning:f.warning&&this._isAdditionsProposedApiEnabled?{message:ue.from(f.warning.message),icon:f.warning.icon?Hi.fromThemeIcon(f.warning.icon):void 0}:void 0,correlationId:this._isAdditionsProposedApiEnabled?f.correlationId:void 0,suggestionId:void 0,uri:this._isAdditionsProposedApiEnabled&&f.uri?f.uri:void 0,supportsRename:this._isAdditionsProposedApiEnabled?f.supportsRename:!1,jumpToPosition:this._isAdditionsProposedApiEnabled&&f.jumpToPosition?ct.from(f.jumpToPosition):void 0}}),commands:c.map(f=>(m||(m=new $),oM.from(f,this._commands,m))),suppressSuggestions:!1,enableForwardStability:u}}disposeCompletions(t,e){let n=this._references.get(t);if(this._provider.handleListEndOfLifetime&&this._isAdditionsProposedApiEnabled&&n?.list){let i=function(s){switch(s.kind){case"lostRace":return{kind:3};case"tokenCancellation":return{kind:2};case"other":return{kind:0};case"empty":return{kind:1};case"notTaken":return{kind:4};default:return{kind:0}}};this._provider.handleListEndOfLifetime(n.list,i(e))}this._references.disposeReferenceId(t)?.dispose()}handleDidShowCompletionItem(t,e,n){let o=this._references.get(t)?.items[e];o&&this._provider.handleDidShowCompletionItem&&this._isAdditionsProposedApiEnabled&&this._provider.handleDidShowCompletionItem(o,n)}handlePartialAccept(t,e,n,o){let i=this._references.get(t)?.items[e];i&&this._provider.handleDidPartiallyAcceptCompletionItem&&this._isAdditionsProposedApiEnabled&&(this._provider.handleDidPartiallyAcceptCompletionItem(i,n),this._provider.handleDidPartiallyAcceptCompletionItem(i,yM.to(o)))}handleEndOfLifetime(t,e,n){let o=this._references.get(t)?.items[e];if(o&&this._provider.handleEndOfLifetime&&this._isAdditionsProposedApiEnabled){let i=IM.to(n,s=>this._references.get(s.pid)?.items[s.idx]);this._provider.handleEndOfLifetime(o,i)}}handleRejection(t,e){let n=this._references.get(t)?.items[e];n&&this._provider.handleDidRejectCompletionItem&&this._isAdditionsProposedApiEnabled&&this._provider.handleDidRejectCompletionItem(n)}},QL=class{constructor(){this._references=new Map;this._idPool=1}createReferenceId(t){let e=this._idPool++;return this._references.set(e,t),e}disposeReferenceId(t){let e=this._references.get(t);return this._references.delete(t),e}get(t){return this._references.get(t)}},iy=class{constructor(t,e){this._documents=t;this._provider=e;this._cache=new qo("SignatureHelp")}async provideSignatureHelp(t,e,n,o){let i=this._documents.getDocument(t),s=ct.to(e),a=this.reviveContext(n),l=await this._provider.provideSignatureHelp(i,s,o,a);if(l){let d=this._cache.add([l]);return{...zm.from(l),id:d}}}reviveContext(t){let e;if(t.activeSignatureHelp){let n=zm.to(t.activeSignatureHelp),o=this._cache.get(t.activeSignatureHelp.id,0);o?(e=o,e.activeSignature=n.activeSignature,e.activeParameter=n.activeParameter):e=n}return{...t,activeSignatureHelp:e}}releaseSignatureHelp(t){this._cache.delete(t)}},xf=class{constructor(t,e,n,o,i){this._documents=t;this._commands=e;this._provider=n;this._logService=o;this._extension=i;this._cache=new qo("InlayHints");this._disposables=new Map}async provideInlayHints(t,e,n){let o=this._documents.getDocument(t),i=j.to(e),s=await this._provider.provideInlayHints(o,i,n);if(!Array.isArray(s)||s.length===0){this._logService.trace(`[InlayHints] NO inlay hints from '${this._extension.identifier.value}' for range ${JSON.stringify(e)}`);return}if(n.isCancellationRequested)return;let a=this._cache.add(s);this._disposables.set(a,new $);let l={hints:[],cacheId:a};for(let d=0;d<s.length;d++)this._isValidInlayHint(s[d],i)&&l.hints.push(this._convertInlayHint(s[d],[a,d]));return this._logService.trace(`[InlayHints] ${l.hints.length} inlay hints from '${this._extension.identifier.value}' for range ${JSON.stringify(e)}`),l}async resolveInlayHint(t,e){if(typeof this._provider.resolveInlayHint!="function")return;let n=this._cache.get(...t);if(!n)return;let o=await this._provider.resolveInlayHint(n,e);if(o&&this._isValidInlayHint(o))return this._convertInlayHint(o,t)}releaseHints(t){this._disposables.get(t)?.dispose(),this._disposables.delete(t),this._cache.delete(t)}_isValidInlayHint(t,e){return t.label.length===0||Array.isArray(t.label)&&t.label.every(n=>n.value.length===0)?(console.log("INVALID inlay hint, empty label",t),!1):!(e&&!e.contains(t.position))}_convertInlayHint(t,e){let n=this._disposables.get(e[0]);if(!n)throw Error("DisposableStore is missing...");let o={label:"",cacheId:e,tooltip:ue.fromStrict(t.tooltip),position:ct.from(t.position),textEdits:t.textEdits&&t.textEdits.map(Pn.from),kind:t.kind&&rT.from(t.kind),paddingLeft:t.paddingLeft,paddingRight:t.paddingRight};if(typeof t.label=="string")o.label=t.label;else{let i=[];o.label=i;for(let s of t.label){if(!s.value){console.warn("INVALID inlay hint, empty label part",this._extension.identifier.value);continue}let a={label:s.value,tooltip:ue.fromStrict(s.tooltip)};en.isLocation(s.location)&&(a.location=po.from(s.location)),s.command&&(a.command=this._commands.toInternal(s.command,n)),i.push(a)}}return o}},Sf=class r{constructor(t,e){this._documents=t;this._provider=e;this._cache=new qo("DocumentLink")}async provideLinks(t,e){let n=this._documents.getDocument(t),o=await this._provider.provideDocumentLinks(n,e);if(!(!Array.isArray(o)||o.length===0)&&!e.isCancellationRequested){if(typeof this._provider.resolveDocumentLink!="function")return{links:o.filter(r._validateLink).map(Wa.from)};{let i=this._cache.add(o),s={links:[],cacheId:i};for(let a=0;a<o.length;a++){if(!r._validateLink(o[a]))continue;let l=Wa.from(o[a]);l.cacheId=[i,a],s.links.push(l)}return s}}}static _validateLink(t){return t.target&&t.target.path.length>5e4?(console.warn("DROPPING link because it is too long"),!1):!0}async resolveLink(t,e){if(typeof this._provider.resolveDocumentLink!="function")return;let n=this._cache.get(...t);if(!n)return;let o=await this._provider.resolveDocumentLink(n,e);if(!(!o||!r._validateLink(o)))return Wa.from(o)}releaseLinks(t){this._cache.delete(t)}},sy=class{constructor(t,e){this._documents=t;this._provider=e}async provideColors(t,e){let n=this._documents.getDocument(t),o=await this._provider.provideDocumentColors(n,e);return Array.isArray(o)?o.map(s=>({color:lu.from(s.color),range:j.from(s.range)})):[]}async provideColorPresentations(t,e,n){let o=this._documents.getDocument(t),i=j.to(e.range),s=lu.to(e.color),a=await this._provider.provideColorPresentations(s,{document:o,range:i},n);if(Array.isArray(a))return a.map(tb.from)}},Aw=class{constructor(t,e){this._documents=t;this._provider=e}async provideFoldingRanges(t,e,n){let o=this._documents.getDocument(t),i=await this._provider.provideFoldingRanges(o,e,n);if(Array.isArray(i))return i.map(ob.from)}},Mw=class{constructor(t,e,n){this._documents=t;this._provider=e;this._logService=n}async provideSelectionRanges(t,e,n){let o=this._documents.getDocument(t),i=e.map(ct.to),s=await this._provider.provideSelectionRanges(o,i,n);if(!tl(s))return[];if(s.length!==i.length)return this._logService.warn("BAD selection ranges, provider must return ranges for each position"),[];let a=[];for(let l=0;l<i.length;l++){let d=[];a.push(d);let c=i[l],u=s[l];for(;;){if(!u.range.contains(c))throw new Error("INVALID selection range, must contain the previous range");if(d.push(sM.from(u)),!u.parent)break;c=u.range,u=u.parent}}return a}},Lu=class{constructor(t,e){this._documents=t;this._provider=e;this._idPool=new wd("");this._cache=new Map}async prepareSession(t,e,n){let o=this._documents.getDocument(t),i=ct.to(e),s=await this._provider.prepareCallHierarchy(o,i,n);if(!s)return;let a=this._idPool.nextId();return this._cache.set(a,new Map),Array.isArray(s)?s.map(l=>this._cacheAndConvertItem(a,l)):[this._cacheAndConvertItem(a,s)]}async provideCallsTo(t,e,n){let o=this._itemFromCache(t,e);if(!o)throw new Error("missing call hierarchy item");let i=await this._provider.provideCallHierarchyIncomingCalls(o,n);if(i)return i.map(s=>({from:this._cacheAndConvertItem(t,s.from),fromRanges:s.fromRanges.map(a=>j.from(a))}))}async provideCallsFrom(t,e,n){let o=this._itemFromCache(t,e);if(!o)throw new Error("missing call hierarchy item");let i=await this._provider.provideCallHierarchyOutgoingCalls(o,n);if(i)return i.map(s=>({to:this._cacheAndConvertItem(t,s.to),fromRanges:s.fromRanges.map(a=>j.from(a))}))}releaseSession(t){this._cache.delete(t)}_cacheAndConvertItem(t,e){let n=this._cache.get(t),o=Ha.from(e,t,n.size.toString(36));return n.set(o._itemId,e),o}_itemFromCache(t,e){return this._cache.get(t)?.get(e)}},Ou=class{constructor(t,e){this._documents=t;this._provider=e;this._idPool=new wd("");this._cache=new Map}async prepareSession(t,e,n){let o=this._documents.getDocument(t),i=ct.to(e),s=await this._provider.prepareTypeHierarchy(o,i,n);if(!s)return;let a=this._idPool.nextId();return this._cache.set(a,new Map),Array.isArray(s)?s.map(l=>this._cacheAndConvertItem(a,l)):[this._cacheAndConvertItem(a,s)]}async provideSupertypes(t,e,n){let o=this._itemFromCache(t,e);if(!o)throw new Error("missing type hierarchy item");let i=await this._provider.provideTypeHierarchySupertypes(o,n);if(i)return i.map(s=>this._cacheAndConvertItem(t,s))}async provideSubtypes(t,e,n){let o=this._itemFromCache(t,e);if(!o)throw new Error("missing type hierarchy item");let i=await this._provider.provideTypeHierarchySubtypes(o,n);if(i)return i.map(s=>this._cacheAndConvertItem(t,s))}releaseSession(t){this._cache.delete(t)}_cacheAndConvertItem(t,e){let n=this._cache.get(t),o=Va.from(e,t,n.size.toString(36));return n.set(o._itemId,e),o}_itemFromCache(t,e){return this._cache.get(t)?.get(e)}},Cf=class{constructor(t,e,n,o,i){this._proxy=t;this._documents=e;this._provider=n;this._handle=o;this._extension=i;this._cache=new qo("DocumentDropEdit")}async provideDocumentOnDropEdits(t,e,n,o,i){let s=this._documents.getDocument(e),a=ct.to(n),l=cu.toDataTransfer(o,async m=>(await this._proxy.$resolveDocumentOnDropFileData(this._handle,t,m)).buffer),d=await this._provider.provideDocumentDropEdits(s,a,l,i);if(!d)return;let c=Dn(d),u=this._cache.add(c);return c.map((m,g)=>({_cacheId:[u,g],title:m.title??p(3490,null,this._extension.displayName||this._extension.name),kind:m.kind?.value,yieldTo:m.yieldTo?.map(h=>h.value),insertText:typeof m.insertText=="string"?m.insertText:{snippet:m.insertText.value},additionalEdit:m.additionalEdit?mo.from(m.additionalEdit,void 0):void 0}))}async resolveDropEdit(t,e){let[n,o]=t,i=this._cache.get(n,o);if(!i||!this._provider.resolveDocumentDropEdit)return{};let s=await this._provider.resolveDocumentDropEdit(i,e)??i;return{additionalEdit:s.additionalEdit?mo.from(s.additionalEdit,void 0):void 0}}releaseDropEdits(t){this._cache.delete(t)}},Nu=class{constructor(t,e){this.adapter=t;this.extension=e}},Lw=class r extends O{constructor(e,n,o,i,s,a,l,d){super();this._uriTransformer=n;this._documents=o;this._commands=i;this._diagnostics=s;this._logService=a;this._apiDeprecation=l;this._extensionTelemetry=d;this._adapter=new Map;this._onDidChangeInlineCompletionsUnificationState=this._register(new E);this.onDidChangeInlineCompletionsUnificationState=this._onDidChangeInlineCompletionsUnificationState.event;this._proxy=e.getProxy(F.MainThreadLanguageFeatures),this._inlineCompletionsUnificationState={codeUnification:!1,modelUnification:!1,extensionUnification:!1,expAssignments:[]}}static{this._handlePool=0}get inlineCompletionsUnificationState(){return this._inlineCompletionsUnificationState}_transformDocumentSelector(e,n){return Fi.from(e,this._uriTransformer,n)}_createDisposable(e){return new be(()=>{this._adapter.delete(e),this._proxy.$unregister(e)})}_nextHandle(){return r._handlePool++}async _withAdapter(e,n,o,i,s,a=!1){let l=this._adapter.get(e);if(!l||!(l.adapter instanceof n))return i;let d=Date.now();a||this._logService.trace(`[${l.extension.identifier.value}] INVOKE provider '${o.toString().replace(/[\r\n]/g,"")}'`);let c=o(l.adapter,l.extension);return Promise.resolve(c).catch(u=>{Qt(u)||(this._logService.error(`[${l.extension.identifier.value}] provider FAILED`),this._logService.error(u),this._extensionTelemetry.onExtensionError(l.extension.identifier,u))}).finally(()=>{a||this._logService.trace(`[${l.extension.identifier.value}] provider DONE after ${Date.now()-d}ms`)}),ve.isCancellationToken(s)?ml(c,s):c}_addNewAdapter(e,n){let o=this._nextHandle();return this._adapter.set(o,new Nu(e,n)),o}static _extLabel(e){return e.displayName||e.name}static _extId(e){return e.identifier.value}registerDocumentSymbolProvider(e,n,o,i){let s=this._addNewAdapter(new bw(this._documents,o),e),a=i&&i.label||r._extLabel(e);return this._proxy.$registerDocumentSymbolProvider(s,this._transformDocumentSelector(n,e),a),this._createDisposable(s)}$provideDocumentSymbols(e,n,o){return this._withAdapter(e,bw,i=>i.provideDocumentSymbols(b.revive(n),o),void 0,o)}registerCodeLensProvider(e,n,o){let i=this._nextHandle(),s=typeof o.onDidChangeCodeLenses=="function"?this._nextHandle():void 0;this._adapter.set(i,new Nu(new vf(this._documents,this._commands.converter,o,e,this._extensionTelemetry,this._logService),e)),this._proxy.$registerCodeLensSupport(i,this._transformDocumentSelector(n,e),s);let a=this._createDisposable(i);if(s!==void 0){let l=o.onDidChangeCodeLenses(d=>this._proxy.$emitCodeLensEvent(s));a=be.from(a,l)}return a}$provideCodeLenses(e,n,o){return this._withAdapter(e,vf,i=>i.provideCodeLenses(b.revive(n),o),void 0,o,n.scheme==="output")}$resolveCodeLens(e,n,o){return this._withAdapter(e,vf,i=>i.resolveCodeLens(n,o),void 0,void 0,!0)}$releaseCodeLenses(e,n){this._withAdapter(e,vf,o=>Promise.resolve(o.releaseCodeLenses(n)),void 0,void 0,!0)}registerDefinitionProvider(e,n,o){let i=this._addNewAdapter(new yw(this._documents,o),e);return this._proxy.$registerDefinitionSupport(i,this._transformDocumentSelector(n,e)),this._createDisposable(i)}$provideDefinition(e,n,o,i){return this._withAdapter(e,yw,s=>s.provideDefinition(b.revive(n),o,i),[],i)}registerDeclarationProvider(e,n,o){let i=this._addNewAdapter(new Iw(this._documents,o),e);return this._proxy.$registerDeclarationSupport(i,this._transformDocumentSelector(n,e)),this._createDisposable(i)}$provideDeclaration(e,n,o,i){return this._withAdapter(e,Iw,s=>s.provideDeclaration(b.revive(n),o,i),[],i)}registerImplementationProvider(e,n,o){let i=this._addNewAdapter(new xw(this._documents,o),e);return this._proxy.$registerImplementationSupport(i,this._transformDocumentSelector(n,e)),this._createDisposable(i)}$provideImplementation(e,n,o,i){return this._withAdapter(e,xw,s=>s.provideImplementation(b.revive(n),o,i),[],i)}registerTypeDefinitionProvider(e,n,o){let i=this._addNewAdapter(new Sw(this._documents,o),e);return this._proxy.$registerTypeDefinitionSupport(i,this._transformDocumentSelector(n,e)),this._createDisposable(i)}$provideTypeDefinition(e,n,o,i){return this._withAdapter(e,Sw,s=>s.provideTypeDefinition(b.revive(n),o,i),[],i)}registerHoverProvider(e,n,o,i){let s=this._addNewAdapter(new ey(this._documents,o),e);return this._proxy.$registerHoverProvider(s,this._transformDocumentSelector(n,e)),this._createDisposable(s)}$provideHover(e,n,o,i,s){return this._withAdapter(e,ey,a=>a.provideHover(b.revive(n),o,i,s),void 0,s)}$releaseHover(e,n){this._withAdapter(e,ey,o=>Promise.resolve(o.releaseHover(n)),void 0,void 0)}registerEvaluatableExpressionProvider(e,n,o,i){let s=this._addNewAdapter(new Cw(this._documents,o),e);return this._proxy.$registerEvaluatableExpressionProvider(s,this._transformDocumentSelector(n,e)),this._createDisposable(s)}$provideEvaluatableExpression(e,n,o,i){return this._withAdapter(e,Cw,s=>s.provideEvaluatableExpression(b.revive(n),o,i),void 0,i)}registerInlineValuesProvider(e,n,o,i){let s=typeof o.onDidChangeInlineValues=="function"?this._nextHandle():void 0,a=this._addNewAdapter(new Tw(this._documents,o),e);this._proxy.$registerInlineValuesProvider(a,this._transformDocumentSelector(n,e),s);let l=this._createDisposable(a);if(s!==void 0){let d=o.onDidChangeInlineValues(c=>this._proxy.$emitInlineValuesEvent(s));l=be.from(l,d)}return l}$provideInlineValues(e,n,o,i,s){return this._withAdapter(e,Tw,a=>a.provideInlineValues(b.revive(n),o,i,s),void 0,s)}registerDocumentHighlightProvider(e,n,o){let i=this._addNewAdapter(new Ew(this._documents,o),e);return this._proxy.$registerDocumentHighlightProvider(i,this._transformDocumentSelector(n,e)),this._createDisposable(i)}registerMultiDocumentHighlightProvider(e,n,o){let i=this._addNewAdapter(new ww(this._documents,o,this._logService),e);return this._proxy.$registerMultiDocumentHighlightProvider(i,this._transformDocumentSelector(n,e)),this._createDisposable(i)}$provideDocumentHighlights(e,n,o,i){return this._withAdapter(e,Ew,s=>s.provideDocumentHighlights(b.revive(n),o,i),void 0,i)}$provideMultiDocumentHighlights(e,n,o,i,s){return this._withAdapter(e,ww,a=>a.provideMultiDocumentHighlights(b.revive(n),o,i.map(l=>b.revive(l)),s),void 0,s)}registerLinkedEditingRangeProvider(e,n,o){let i=this._addNewAdapter(new kw(this._documents,o),e);return this._proxy.$registerLinkedEditingRangeProvider(i,this._transformDocumentSelector(n,e)),this._createDisposable(i)}$provideLinkedEditingRanges(e,n,o,i){return this._withAdapter(e,kw,async s=>{let a=await s.provideLinkedEditingRanges(b.revive(n),o,i);if(a)return{ranges:a.ranges,wordPattern:a.wordPattern?r._serializeRegExp(a.wordPattern):void 0}},void 0,i)}registerReferenceProvider(e,n,o){let i=this._addNewAdapter(new Pw(this._documents,o),e);return this._proxy.$registerReferenceSupport(i,this._transformDocumentSelector(n,e)),this._createDisposable(i)}$provideReferences(e,n,o,i,s){return this._withAdapter(e,Pw,a=>a.provideReferences(b.revive(n),o,i,s),void 0,s)}registerCodeActionProvider(e,n,o,i){let s=new $,a=this._addNewAdapter(new bf(this._documents,this._commands.converter,this._diagnostics,o,this._logService,e,this._apiDeprecation),e);return this._proxy.$registerCodeActionSupport(a,this._transformDocumentSelector(n,e),{providedKinds:i?.providedCodeActionKinds?.map(l=>l.value),documentation:i?.documentation?.map(l=>({kind:l.kind.value,command:this._commands.converter.toInternal(l.command,s)}))},r._extLabel(e),r._extId(e),!!o.resolveCodeAction),s.add(this._createDisposable(a)),s}$provideCodeActions(e,n,o,i,s){return this._withAdapter(e,bf,a=>a.provideCodeActions(b.revive(n),o,i,s),void 0,s)}$resolveCodeAction(e,n,o){return this._withAdapter(e,bf,i=>i.resolveCodeAction(n,o),{},void 0)}$releaseCodeActions(e,n){this._withAdapter(e,bf,o=>Promise.resolve(o.releaseCodeActions(n)),void 0,void 0)}registerDocumentFormattingEditProvider(e,n,o){let i=this._addNewAdapter(new _w(this._documents,o),e);return this._proxy.$registerDocumentFormattingSupport(i,this._transformDocumentSelector(n,e),e.identifier,e.displayName||e.name),this._createDisposable(i)}$provideDocumentFormattingEdits(e,n,o,i){return this._withAdapter(e,_w,s=>s.provideDocumentFormattingEdits(b.revive(n),o,i),void 0,i)}registerDocumentRangeFormattingEditProvider(e,n,o){let i=typeof o.provideDocumentRangesFormattingEdits=="function",s=this._addNewAdapter(new ty(this._documents,o),e);return this._proxy.$registerRangeFormattingSupport(s,this._transformDocumentSelector(n,e),e.identifier,e.displayName||e.name,i),this._createDisposable(s)}$provideDocumentRangeFormattingEdits(e,n,o,i,s){return this._withAdapter(e,ty,a=>a.provideDocumentRangeFormattingEdits(b.revive(n),o,i,s),void 0,s)}$provideDocumentRangesFormattingEdits(e,n,o,i,s){return this._withAdapter(e,ty,a=>a.provideDocumentRangesFormattingEdits(b.revive(n),o,i,s),void 0,s)}registerOnTypeFormattingEditProvider(e,n,o,i){let s=this._addNewAdapter(new Dw(this._documents,o),e);return this._proxy.$registerOnTypeFormattingSupport(s,this._transformDocumentSelector(n,e),i,e.identifier),this._createDisposable(s)}$provideOnTypeFormattingEdits(e,n,o,i,s,a){return this._withAdapter(e,Dw,l=>l.provideOnTypeFormattingEdits(b.revive(n),o,i,s,a),void 0,a)}registerWorkspaceSymbolProvider(e,n){let o=this._addNewAdapter(new yf(n,this._logService),e);return this._proxy.$registerNavigateTypeSupport(o,typeof n.resolveWorkspaceSymbol=="function"),this._createDisposable(o)}$provideWorkspaceSymbols(e,n,o){return this._withAdapter(e,yf,i=>i.provideWorkspaceSymbols(n,o),{symbols:[]},o)}$resolveWorkspaceSymbol(e,n,o){return this._withAdapter(e,yf,i=>i.resolveWorkspaceSymbol(n,o),void 0,void 0)}$releaseWorkspaceSymbols(e,n){this._withAdapter(e,yf,o=>o.releaseWorkspaceSymbols(n),void 0,void 0)}registerRenameProvider(e,n,o){let i=this._addNewAdapter(new If(this._documents,o,this._logService),e);return this._proxy.$registerRenameSupport(i,this._transformDocumentSelector(n,e),If.supportsResolving(o)),this._createDisposable(i)}$provideRenameEdits(e,n,o,i,s){return this._withAdapter(e,If,a=>a.provideRenameEdits(b.revive(n),o,i,s),void 0,s)}$resolveRenameLocation(e,n,o,i){return this._withAdapter(e,If,s=>s.resolveRenameLocation(b.revive(n),o,i),void 0,i)}registerNewSymbolNamesProvider(e,n,o){let i=this._addNewAdapter(new ny(this._documents,o,this._logService),e);return this._proxy.$registerNewSymbolNamesProvider(i,this._transformDocumentSelector(n,e)),this._createDisposable(i)}$supportsAutomaticNewSymbolNamesTriggerKind(e){return this._withAdapter(e,ny,n=>n.supportsAutomaticNewSymbolNamesTriggerKind(),!1,void 0)}$provideNewSymbolNames(e,n,o,i,s){return this._withAdapter(e,ny,a=>a.provideNewSymbolNames(b.revive(n),o,i,s),void 0,s)}registerDocumentSemanticTokensProvider(e,n,o,i){let s=this._addNewAdapter(new ry(this._documents,o),e),a=typeof o.onDidChangeSemanticTokens=="function"?this._nextHandle():void 0;this._proxy.$registerDocumentSemanticTokensProvider(s,this._transformDocumentSelector(n,e),i,a);let l=this._createDisposable(s);if(a){let d=o.onDidChangeSemanticTokens(c=>this._proxy.$emitDocumentSemanticTokensEvent(a));l=be.from(l,d)}return l}$provideDocumentSemanticTokens(e,n,o,i){return this._withAdapter(e,ry,s=>s.provideDocumentSemanticTokens(b.revive(n),o,i),null,i)}$releaseDocumentSemanticTokens(e,n){this._withAdapter(e,ry,o=>o.releaseDocumentSemanticColoring(n),void 0,void 0)}registerDocumentRangeSemanticTokensProvider(e,n,o,i){let s=this._addNewAdapter(new Rw(this._documents,o),e),a=typeof o.onDidChangeSemanticTokens=="function"?this._nextHandle():void 0;this._proxy.$registerDocumentRangeSemanticTokensProvider(s,this._transformDocumentSelector(n,e),i,a);let l=this._createDisposable(s);if(a){let d=o.onDidChangeSemanticTokens(c=>this._proxy.$emitDocumentRangeSemanticTokensEvent(a));l=be.from(l,d)}return l}$provideDocumentRangeSemanticTokens(e,n,o,i){return this._withAdapter(e,Rw,s=>s.provideDocumentRangeSemanticTokens(b.revive(n),o,i),null,i)}registerCompletionItemProvider(e,n,o,i){let s=this._addNewAdapter(new Mu(this._documents,this._commands.converter,o,this._apiDeprecation,e),e);return this._proxy.$registerCompletionsProvider(s,this._transformDocumentSelector(n,e),i,Mu.supportsResolving(o),e.identifier),this._createDisposable(s)}$provideCompletionItems(e,n,o,i,s){return this._withAdapter(e,Mu,a=>a.provideCompletionItems(b.revive(n),o,i,s),void 0,s)}$resolveCompletionItem(e,n,o){return this._withAdapter(e,Mu,i=>i.resolveCompletionItem(n,o),void 0,o)}$releaseCompletionItems(e,n){this._withAdapter(e,Mu,o=>o.releaseCompletionItems(n),void 0,void 0)}registerInlineCompletionsProvider(e,n,o,i){let s=new qi(e,this._documents,o,this._commands.converter),a=this._addNewAdapter(s,e),l=this._createDisposable(a),d=He(e,"inlineCompletionsAdditions")&&typeof o.onDidChange=="function";if(d){let m=o.onDidChange(g=>this._proxy.$emitInlineCompletionsChange(a,g?{data:g.data}:void 0));l=be.from(l,m)}let c=He(e,"inlineCompletionsAdditions")&&typeof o.onDidChangeModelInfo=="function";if(c){let m=o.onDidChangeModelInfo(g=>this._proxy.$emitInlineCompletionModelInfoChange(a,s.modelInfo));l=be.from(l,m)}let u=He(e,"inlineCompletionsAdditions")&&typeof o.onDidChangeProviderOptions=="function";if(u){let m=o.onDidChangeProviderOptions(g=>this._proxy.$emitInlineCompletionProviderOptionsChange(a,s.providerOptions));l=be.from(l,m)}return this._proxy.$registerInlineCompletionsSupport(a,this._transformDocumentSelector(n,e),s.supportsHandleEvents,Ee.toKey(e.identifier.value),e.version,i?.groupId?Ee.toKey(i.groupId):void 0,i?.yieldTo?.map(m=>Ee.toKey(m))||[],i?.displayName,i?.debounceDelayMs,i?.excludes?.map(m=>Ee.toKey(m))||[],d,s.supportsSetModelId,s.modelInfo,c,s.supportsSetProviderOption,s.providerOptions,u),l}$provideInlineCompletions(e,n,o,i,s){return this._withAdapter(e,qi,a=>a.provideInlineCompletions(b.revive(n),o,i,s),void 0,void 0)}$handleInlineCompletionDidShow(e,n,o,i){this._withAdapter(e,qi,async s=>{s.handleDidShowCompletionItem(n,o,i)},void 0,void 0)}$handleInlineCompletionPartialAccept(e,n,o,i,s){this._withAdapter(e,qi,async a=>{a.handlePartialAccept(n,o,i,s)},void 0,void 0)}$handleInlineCompletionEndOfLifetime(e,n,o,i){this._withAdapter(e,qi,async s=>{s.handleEndOfLifetime(n,o,i)},void 0,void 0)}$handleInlineCompletionRejection(e,n,o){this._withAdapter(e,qi,async i=>{i.handleRejection(n,o)},void 0,void 0)}$freeInlineCompletionsList(e,n,o){this._withAdapter(e,qi,async i=>{i.disposeCompletions(n,o)},void 0,void 0)}$acceptInlineCompletionsUnificationState(e){this._inlineCompletionsUnificationState=e,this._onDidChangeInlineCompletionsUnificationState.fire()}$handleInlineCompletionSetCurrentModelId(e,n){this._withAdapter(e,qi,async o=>{o.setCurrentModelId(n)},void 0,void 0)}$handleInlineCompletionSetProviderOption(e,n,o){this._withAdapter(e,qi,async i=>{i.setProviderOption(n,o)},void 0,void 0)}registerSignatureHelpProvider(e,n,o,i){let s=Array.isArray(i)?{triggerCharacters:i,retriggerCharacters:[]}:i,a=this._addNewAdapter(new iy(this._documents,o),e);return this._proxy.$registerSignatureHelpProvider(a,this._transformDocumentSelector(n,e),s),this._createDisposable(a)}$provideSignatureHelp(e,n,o,i,s){return this._withAdapter(e,iy,a=>a.provideSignatureHelp(b.revive(n),o,i,s),void 0,s)}$releaseSignatureHelp(e,n){this._withAdapter(e,iy,o=>o.releaseSignatureHelp(n),void 0,void 0)}registerInlayHintsProvider(e,n,o){let i=typeof o.onDidChangeInlayHints=="function"?this._nextHandle():void 0,s=this._addNewAdapter(new xf(this._documents,this._commands.converter,o,this._logService,e),e);this._proxy.$registerInlayHintsProvider(s,this._transformDocumentSelector(n,e),typeof o.resolveInlayHint=="function",i,r._extLabel(e));let a=this._createDisposable(s);if(i!==void 0){let l=o.onDidChangeInlayHints(d=>this._proxy.$emitInlayHintsEvent(i));a=be.from(a,l)}return a}$provideInlayHints(e,n,o,i){return this._withAdapter(e,xf,s=>s.provideInlayHints(b.revive(n),o,i),void 0,i)}$resolveInlayHint(e,n,o){return this._withAdapter(e,xf,i=>i.resolveInlayHint(n,o),void 0,o)}$releaseInlayHints(e,n){this._withAdapter(e,xf,o=>o.releaseHints(n),void 0,void 0)}registerDocumentLinkProvider(e,n,o){let i=this._addNewAdapter(new Sf(this._documents,o),e);return this._proxy.$registerDocumentLinkProvider(i,this._transformDocumentSelector(n,e),typeof o.resolveDocumentLink=="function"),this._createDisposable(i)}$provideDocumentLinks(e,n,o){return this._withAdapter(e,Sf,i=>i.provideLinks(b.revive(n),o),void 0,o,n.scheme==="output")}$resolveDocumentLink(e,n,o){return this._withAdapter(e,Sf,i=>i.resolveLink(n,o),void 0,void 0,!0)}$releaseDocumentLinks(e,n){this._withAdapter(e,Sf,o=>o.releaseLinks(n),void 0,void 0,!0)}registerColorProvider(e,n,o){let i=this._addNewAdapter(new sy(this._documents,o),e);return this._proxy.$registerDocumentColorProvider(i,this._transformDocumentSelector(n,e)),this._createDisposable(i)}$provideDocumentColors(e,n,o){return this._withAdapter(e,sy,i=>i.provideColors(b.revive(n),o),[],o)}$provideColorPresentations(e,n,o,i){return this._withAdapter(e,sy,s=>s.provideColorPresentations(b.revive(n),o,i),void 0,i)}registerFoldingRangeProvider(e,n,o){let i=this._nextHandle(),s=typeof o.onDidChangeFoldingRanges=="function"?this._nextHandle():void 0;this._adapter.set(i,new Nu(new Aw(this._documents,o),e)),this._proxy.$registerFoldingRangeProvider(i,this._transformDocumentSelector(n,e),e.identifier,s);let a=this._createDisposable(i);if(s!==void 0){let l=o.onDidChangeFoldingRanges(()=>this._proxy.$emitFoldingRangeEvent(s));a=be.from(a,l)}return a}$provideFoldingRanges(e,n,o,i){return this._withAdapter(e,Aw,s=>s.provideFoldingRanges(b.revive(n),o,i),void 0,i)}registerSelectionRangeProvider(e,n,o){let i=this._addNewAdapter(new Mw(this._documents,o,this._logService),e);return this._proxy.$registerSelectionRangeProvider(i,this._transformDocumentSelector(n,e)),this._createDisposable(i)}$provideSelectionRanges(e,n,o,i){return this._withAdapter(e,Mw,s=>s.provideSelectionRanges(b.revive(n),o,i),[],i)}registerCallHierarchyProvider(e,n,o){let i=this._addNewAdapter(new Lu(this._documents,o),e);return this._proxy.$registerCallHierarchyProvider(i,this._transformDocumentSelector(n,e)),this._createDisposable(i)}$prepareCallHierarchy(e,n,o,i){return this._withAdapter(e,Lu,s=>Promise.resolve(s.prepareSession(b.revive(n),o,i)),void 0,i)}$provideCallHierarchyIncomingCalls(e,n,o,i){return this._withAdapter(e,Lu,s=>s.provideCallsTo(n,o,i),void 0,i)}$provideCallHierarchyOutgoingCalls(e,n,o,i){return this._withAdapter(e,Lu,s=>s.provideCallsFrom(n,o,i),void 0,i)}$releaseCallHierarchy(e,n){this._withAdapter(e,Lu,o=>Promise.resolve(o.releaseSession(n)),void 0,void 0)}registerTypeHierarchyProvider(e,n,o){let i=this._addNewAdapter(new Ou(this._documents,o),e);return this._proxy.$registerTypeHierarchyProvider(i,this._transformDocumentSelector(n,e)),this._createDisposable(i)}$prepareTypeHierarchy(e,n,o,i){return this._withAdapter(e,Ou,s=>Promise.resolve(s.prepareSession(b.revive(n),o,i)),void 0,i)}$provideTypeHierarchySupertypes(e,n,o,i){return this._withAdapter(e,Ou,s=>s.provideSupertypes(n,o,i),void 0,i)}$provideTypeHierarchySubtypes(e,n,o,i){return this._withAdapter(e,Ou,s=>s.provideSubtypes(n,o,i),void 0,i)}$releaseTypeHierarchy(e,n){this._withAdapter(e,Ou,o=>Promise.resolve(o.releaseSession(n)),void 0,void 0)}registerDocumentOnDropEditProvider(e,n,o,i){let s=this._nextHandle();return this._adapter.set(s,new Nu(new Cf(this._proxy,this._documents,o,s,e),e)),this._proxy.$registerDocumentOnDropEditProvider(s,this._transformDocumentSelector(n,e),i?{supportsResolve:!!o.resolveDocumentDropEdit,dropMimeTypes:i.dropMimeTypes,providedDropKinds:i.providedDropEditKinds?.map(a=>a.value)}:void 0),this._createDisposable(s)}$provideDocumentOnDropEdits(e,n,o,i,s,a){return this._withAdapter(e,Cf,l=>Promise.resolve(l.provideDocumentOnDropEdits(n,b.revive(o),i,s,a)),void 0,void 0)}$resolveDropEdit(e,n,o){return this._withAdapter(e,Cf,i=>i.resolveDropEdit(n,o),{},void 0)}$releaseDocumentOnDropEdits(e,n){this._withAdapter(e,Cf,o=>Promise.resolve(o.releaseDropEdits(n)),void 0,void 0)}registerDocumentPasteEditProvider(e,n,o,i){let s=this._nextHandle();return this._adapter.set(s,new Nu(new Au(this._proxy,this._documents,o,s,e),e)),this._proxy.$registerPasteEditProvider(s,this._transformDocumentSelector(n,e),{supportsCopy:!!o.prepareDocumentPaste,supportsPaste:!!o.provideDocumentPasteEdits,supportsResolve:!!o.resolveDocumentPasteEdit,providedPasteEditKinds:i.providedPasteEditKinds?.map(a=>a.value),copyMimeTypes:i.copyMimeTypes,pasteMimeTypes:i.pasteMimeTypes}),this._createDisposable(s)}$prepareDocumentPaste(e,n,o,i,s){return this._withAdapter(e,Au,a=>a.prepareDocumentPaste(b.revive(n),o,i,s),void 0,s)}$providePasteEdits(e,n,o,i,s,a,l){return this._withAdapter(e,Au,d=>d.providePasteEdits(n,b.revive(o),i,s,a,l),void 0,l)}$resolvePasteEdit(e,n,o){return this._withAdapter(e,Au,i=>i.resolvePasteEdit(n,o),{},void 0)}$releasePasteEdits(e,n){this._withAdapter(e,Au,o=>Promise.resolve(o.releasePasteEdits(n)),void 0,void 0)}static _serializeRegExp(e){return{pattern:e.source,flags:e.flags}}static _serializeIndentationRule(e){return{decreaseIndentPattern:r._serializeRegExp(e.decreaseIndentPattern),increaseIndentPattern:r._serializeRegExp(e.increaseIndentPattern),indentNextLinePattern:e.indentNextLinePattern?r._serializeRegExp(e.indentNextLinePattern):void 0,unIndentedLinePattern:e.unIndentedLinePattern?r._serializeRegExp(e.unIndentedLinePattern):void 0}}static _serializeOnEnterRule(e){return{beforeText:r._serializeRegExp(e.beforeText),afterText:e.afterText?r._serializeRegExp(e.afterText):void 0,previousLineText:e.previousLineText?r._serializeRegExp(e.previousLineText):void 0,action:e.action}}static _serializeOnEnterRules(e){return e.map(r._serializeOnEnterRule)}static _serializeAutoClosingPair(e){return{open:e.open,close:e.close,notIn:e.notIn?e.notIn.map(n=>tu.toString(n)):void 0}}static _serializeAutoClosingPairs(e){return e.map(r._serializeAutoClosingPair)}setLanguageConfiguration(e,n,o){let{wordPattern:i}=o;if(i&&cI(i))throw new Error(`Invalid language configuration: wordPattern '${i}' is not allowed to match the empty string.`);i?this._documents.setWordDefinitionFor(n,i):this._documents.setWordDefinitionFor(n,void 0),o.__electricCharacterSupport&&this._apiDeprecation.report("LanguageConfiguration.__electricCharacterSupport",e,"Do not use."),o.__characterPairSupport&&this._apiDeprecation.report("LanguageConfiguration.__characterPairSupport",e,"Do not use.");let s=this._nextHandle(),a={comments:o.comments,brackets:o.brackets,wordPattern:o.wordPattern?r._serializeRegExp(o.wordPattern):void 0,indentationRules:o.indentationRules?r._serializeIndentationRule(o.indentationRules):void 0,onEnterRules:o.onEnterRules?r._serializeOnEnterRules(o.onEnterRules):void 0,__electricCharacterSupport:o.__electricCharacterSupport,__characterPairSupport:o.__characterPairSupport,autoClosingPairs:o.autoClosingPairs?r._serializeAutoClosingPairs(o.autoClosingPairs):void 0};return this._proxy.$setLanguageConfiguration(s,n,a),this._createDisposable(s)}$setWordDefinitions(e){for(let n of e)this._documents.setWordDefinitionFor(n.languageId,new RegExp(n.regexSource,n.regexFlags))}};async function UB(r,t){let e=r+":"+JSON.stringify(t),n=new TextEncoder().encode(e),o=await crypto.subtle.digest("SHA-256",n),i=Array.from(new Uint8Array(o)).map(s=>s.toString(16).padStart(2,"0")).join("");return r+":combination:"+i}var pZe=R("ILanguageModelToolsConfirmationService");var FB=R("notebookService");var HB=R("codeMapperService");var JL="vscode_editFile",Nw="vscode_editFile_internal",WB={id:Nw,displayName:"",modelDescription:"",source:kn.Internal},Tf=class{constructor(t,e,n){this.chatService=t;this.codeMapperService=e;this.notebookService=n}async invoke(t,e,n,o){if(!t.context)throw new Error("toolInvocationToken is required for this tool");let i=t.parameters,s=b.revive(i.uri),a=Mv.parse(s)?.notebook||s,l=this.chatService.getSession(t.context.sessionResource),d=l.getRequests().at(-1);l.acceptResponseProgress(d,{kind:"markdownContent",content:new Bt("\n````\n")}),l.acceptResponseProgress(d,{kind:"codeblockUri",uri:a,isEdit:!0}),l.acceptResponseProgress(d,{kind:"markdownContent",content:new Bt("\n````\n")}),this.notebookService.hasSupportedNotebooks(a)&&this.notebookService.getNotebookTextModel(a)?l.acceptResponseProgress(d,{kind:"notebookEdit",edits:[],uri:a}):l.acceptResponseProgress(d,{kind:"textEdit",edits:[],uri:a});let c=l.editingSession;if(!c)throw new Error("This tool must be called from within an editing session");let u=await this.codeMapperService.mapCode({codeBlocks:[{code:i.code,resource:a,markdownBeforeBlock:i.explanation}],location:"tool",chatRequestId:t.chatRequestId,chatRequestModel:t.modelId,chatSessionResource:t.context.sessionResource},{textEdit:(g,h)=>{l.acceptResponseProgress(d,{kind:"textEdit",uri:g,edits:h})},notebookEdit(g,h){l.acceptResponseProgress(d,{kind:"notebookEdit",uri:g,edits:h})}},o);if(this.notebookService.hasSupportedNotebooks(a)&&this.notebookService.getNotebookTextModel(a)?l.acceptResponseProgress(d,{kind:"notebookEdit",uri:a,edits:[],done:!0}):l.acceptResponseProgress(d,{kind:"textEdit",uri:a,edits:[],done:!0}),u?.errorMessage)throw new Error(u.errorMessage);let m;return await new Promise(g=>{let h=!1;m=Vo(f=>{let S=c.entries.read(f)?.find(T=>Ro(T.modifiedURI,a));S&&(S.isCurrentlyBeingModifiedBy.read(f)?h=!0:h&&g(!0))})}).finally(()=>{m.dispose()}),{content:[{kind:"text",value:"The file was edited successfully"}]}}async prepareToolInvocation(t,e){return{presentation:"hidden"}}};Tf=_([C(0,$s),C(1,HB),C(2,FB)],Tf);var Uw=class{constructor(t,e,n,o,i,s,a){this.questions=t;this.allowSkip=e;this.resolveId=n;this.data=o;this.isUsed=i;this.message=s;this.source=a;this.kind="questionCarousel";this.completion=new Jt}toJSON(){return{kind:this.kind,questions:this.questions,allowSkip:this.allowSkip,resolveId:this.resolveId,data:this.data,isUsed:this.isUsed,message:this.message,source:this.source}}};var VB="The user is not available to respond and will review your work later. Work autonomously and make good decisions.",BB="vscode_askQuestions",$B={header:50,question:200},zB={header:75,question:300};function qB(r,t){if(r!==void 0)return r.length>t?r.slice(0,t-3)+"...":r}function rG(){let t={type:"object",properties:{questions:{type:"array",description:"List of questions to ask the user. Order is preserved.",items:{type:"object",properties:{header:{type:"string",description:"Short identifier for the question. Must be unique so answers can be mapped back to the question.",maxLength:$B.header},question:{type:"string",description:"The question text to display to the user. Keep it concise, ideally one sentence.",maxLength:$B.question},multiSelect:{type:"boolean",description:"Allow selecting multiple options when options are provided."},allowFreeformInput:{type:"boolean",description:"Allow freeform text answers in addition to option selection. Defaults to true; set to false to restrict to predefined options only."},options:{type:"array",description:"Optional list of selectable answers. If omitted, the question is free text.",items:{type:"object",properties:{label:{type:"string",description:"Display label and value for the option."},description:{type:"string",description:"Optional secondary text shown with the option."},recommended:{type:"boolean",description:"Mark this option as the recommended default."}},required:["label"]}}},required:["header","question"]},minItems:1}},required:["questions"]};return{id:BB,toolReferenceName:"askQuestions",legacyToolReferenceFullNames:[BB,"vscode/askQuestions"],canBeReferencedInPrompt:!1,icon:ut.fromId(ce.question.id),displayName:p(8626,null),userDescription:p(8627,null),modelDescription:"Use this tool to ask the user a small number of clarifying questions before proceeding. Provide the questions array with concise headers and prompts. Use options for fixed choices, set multiSelect when multiple selections are allowed. Users can always provide a freeform text answer alongside options unless you set allowFreeformInput to false.",source:kn.Internal,inputSchema:t}}var YL=rG(),Ef=class extends O{constructor(e,n,o,i){super();this.chatService=e;this.telemetryService=n;this.logService=o;this.configService=i}async invoke(e,n,o,i){let s=an.create(!0),a=e.parameters,{questions:l}=a;if(this.logService.trace(`[AskQuestionsTool] Invoking with ${l?.length??0} question(s)`),!l||l.length===0)throw new Error(p(8624,null));let d=e.context?.sessionResource,c=e.chatRequestId,{request:u,sessionResource:m}=this.getRequest(d,c);if(!m||!u)return this.logService.warn("[AskQuestionsTool] Missing chat context; marking all questions as skipped."),this.createSkippedResult(l);if(u.modeInfo?.permissionLevel==="autopilot"||this.configService.getValue("chat.autoReply")){let B=u.modeInfo?.permissionLevel==="autopilot"?"Autopilot mode":"Auto-reply enabled";this.logService.info(`[AskQuestionsTool] ${B}: auto-responding to questions`);let{carousel:G,idToHeaderMap:J}=this.toQuestionCarousel(l);return G.data=this.buildAutopilotCarouselAnswers(l,G,J),G.isUsed=!0,this.chatService.appendProgress(u,G),this.createAutopilotResult(l)}let{carousel:g,idToHeaderMap:h}=this.toQuestionCarousel(l);this.chatService.appendProgress(u,g);let f=await gp(g.completion.p,i);if(i.isCancellationRequested)throw new Be;o.report({message:p(8625,null)});let I=this.convertCarouselAnswers(l,f?.answers,h),{answeredCount:S,skippedCount:T,freeTextCount:P,recommendedAvailableCount:L,recommendedSelectedCount:q}=this.collectMetrics(l,I);this.sendTelemetry(e.chatRequestId,l.length,S,T,P,L,q,s.elapsed());let N=JSON.stringify(I);return this.logService.trace(`[AskQuestionsTool] Returning tool result with metrics: questions=${l.length}, answered=${S}, skipped=${T}, freeText=${P}, recommendedAvailable=${L}, recommendedSelected=${q}`),{content:[{kind:"text",value:N}]}}async prepareToolInvocation(e,n){let o=e.parameters,{questions:i}=o;if(!i||i.length===0)throw new Error(p(8624,null));for(let c of i){if(c.options&&c.options.length===1)throw new Error(p(8619,null,c.header));c.question=qB(c.question,zB.question)??c.question}let s=i.length,a=i.map(c=>c.header).join(", "),l=s===1?p(8622,null,a):p(8620,null,s,a),d=s===1?p(8623,null,a):p(8621,null,s,a);return{invocationMessage:new Bt(l),pastTenseMessage:new Bt(d)}}getRequest(e,n){if(!e)return{request:void 0,sessionResource:void 0};let o=this.chatService.getSession(e),i;return o&&(n&&(i=o.getRequests().find(s=>s.id===n)),i||(i=o.getRequests().at(-1))),i?{request:i,sessionResource:e}:{request:void 0,sessionResource:e}}toQuestionCarousel(e){let n=new Map,o=e.map(i=>this.toChatQuestion(i,n));return{carousel:new Uw(o,!0,Ae()),idToHeaderMap:n}}toChatQuestion(e,n){let o;!e.options||e.options.length===0?o="text":e.multiSelect?o="multiSelect":o="singleSelect";let i;if(e.options){let l=e.options.filter(d=>d.recommended);l.length>0&&(i=e.multiSelect?l.map(d=>d.label):l[0].label)}let s=Ae();n.set(s,e.header);let a=qB(e.header,zB.header)??e.header;return{id:s,type:o,title:a,message:e.question,options:e.options?.map(l=>({id:l.label,label:l.description?`${l.label} - ${l.description}`:l.label,value:l.label})),defaultValue:i,allowFreeformInput:e.allowFreeformInput??!0}}convertCarouselAnswers(e,n,o){let i={answers:{}};n&&(this.logService.trace(`[AskQuestionsTool] Carousel answer keys: ${Object.keys(n).join(", ")}`),this.logService.trace(`[AskQuestionsTool] Question headers: ${e.map(a=>a.header).join(", ")}`));let s=new Map;for(let[a,l]of o)s.set(l,a);for(let a of e){if(!n){i.answers[a.header]={selected:[],freeText:null,skipped:!0};continue}let l=s.get(a.header),d=l?n[l]:void 0;if(this.logService.trace(`[AskQuestionsTool] Processing question "${a.header}" (internal ID: ${l}), raw answer: ${JSON.stringify(d)}, type: ${typeof d}`),d===void 0)i.answers[a.header]={selected:[],freeText:null,skipped:!0};else if(typeof d=="string")a.options?.some(c=>c.label===d)?i.answers[a.header]={selected:[d],freeText:null,skipped:!1}:i.answers[a.header]={selected:[],freeText:d,skipped:!1};else if(Array.isArray(d))i.answers[a.header]={selected:d.map(c=>String(c)),freeText:null,skipped:!1};else if(typeof d=="object"&&so(d,{selectedValues:!0})){let{selectedValues:c,freeformValue:u}=d;i.answers[a.header]={selected:c,freeText:u??null,skipped:!1}}else if(typeof d=="object"&&(so(d,{selectedValue:!0})||so(d,{freeformValue:!0}))){let{selectedValue:c,freeformValue:u}=d;u?i.answers[a.header]={selected:[],freeText:u,skipped:!1}:c!==void 0?a.options?.some(m=>m.label===c)?i.answers[a.header]={selected:[c],freeText:null,skipped:!1}:i.answers[a.header]={selected:[],freeText:c,skipped:!1}:i.answers[a.header]={selected:[],freeText:null,skipped:!0}}else this.logService.warn(`[AskQuestionsTool] Unknown answer format for "${a.header}": ${JSON.stringify(d)}`),i.answers[a.header]={selected:[],freeText:null,skipped:!0}}return i}collectMetrics(e,n){let o=Object.values(n.answers),i=o.filter(c=>!c.skipped).length,s=o.filter(c=>c.skipped).length,a=o.filter(c=>c.freeText!==null).length,l=e.filter(c=>c.options?.some(u=>u.recommended)).length,d=e.filter(c=>{let u=n.answers[c.header],m=c.options?.find(g=>g.recommended);return u&&!u.skipped&&m&&u.selected.includes(m.label)}).length;return{answeredCount:i,skippedCount:s,freeTextCount:a,recommendedAvailableCount:l,recommendedSelectedCount:d}}createSkippedResult(e){let n={};for(let o of e)n[o.header]={selected:[],freeText:null,skipped:!0};return{content:[{kind:"text",value:JSON.stringify({answers:n})}]}}createAutopilotResult(e){let n={};for(let o of e){let i=o.options?.find(l=>l.recommended),s=o.options?.[0],a=i?.label??s?.label;n[o.header]={selected:a?[a]:[],freeText:a?null:VB,skipped:!1}}return{content:[{kind:"text",value:JSON.stringify({answers:n})}]}}buildAutopilotCarouselAnswers(e,n,o){let i={},s=new Map;for(let[a,l]of o)s.set(l,a);for(let a of e){let l=s.get(a.header);if(!l)continue;let d=n.questions.find(g=>g.id===l);if(!d)continue;let c=a.options?.find(g=>g.recommended),u=a.options?.[0],m=c?.label??u?.label;d.type==="text"||!m?i[l]=VB:d.type==="multiSelect"?i[l]={selectedValues:[m]}:i[l]={selectedValue:m}}return i}sendTelemetry(e,n,o,i,s,a,l,d){this.telemetryService.publicLog2("askQuestionsToolInvoked",{requestId:e,questionCount:n,answeredCount:o,skippedCount:i,freeTextCount:s,recommendedAvailableCount:a,recommendedSelectedCount:l,duration:d})}};Ef=_([C(0,$s),C(1,gs),C(2,oe),C(3,Kt)],Ef);var iG="vscode_get_confirmation",sG="vscode_get_confirmation_with_options",aG="vscode_get_modified_files_confirmation",KB={id:iG,displayName:"Confirmation Tool",modelDescription:"A tool that demonstrates different types of confirmations. Takes a title, message, and confirmation type (basic or terminal).",source:kn.Internal,inputSchema:{type:"object",properties:{title:{type:"string",description:"Title for the confirmation dialog"},message:{type:"string",description:"Message to show in the confirmation dialog"},confirmationType:{type:"string",enum:["basic","terminal"],description:"Type of confirmation to show - basic for simple confirmation, terminal for terminal command confirmation"},terminalCommand:{type:"string",description:'Terminal command to show (only used when confirmationType is "terminal")'}},required:["title","message","confirmationType"],additionalProperties:!1}},jB={id:sG,displayName:"Confirmation Tool with Options",modelDescription:"A tool that demonstrates different types of confirmations. Takes a title, message, and buttons.",source:kn.Internal,inputSchema:{type:"object",properties:{title:{type:"string",description:"Title for the confirmation dialog"},message:{type:"string",description:"Message to show in the confirmation dialog"},buttons:{type:"array",items:{type:"string"},description:"Custom button labels to display."}},required:["title","message","buttons"],additionalProperties:!1}},GB={id:aG,displayName:"Modified Files Confirmation Tool",modelDescription:"A tool that shows a modified-files confirmation UI with a split primary button and a hardcoded cancel action.",source:kn.Internal,inputSchema:{type:"object",properties:{title:{type:"string",description:"Title for the confirmation dialog"},message:{type:"string",description:"Message to show in the confirmation dialog"},options:{type:"array",items:{type:"string"},minItems:1,description:"Selectable option labels. The first option is used for the primary split button and the remaining options are placed in the dropdown menu."},modifiedFiles:{type:"array",items:{type:"object",properties:{uri:{type:"string",description:"URI of the modified file."},originalUri:{type:"string",description:"Optional original URI used when opening a diff."},insertions:{type:"number",description:"Optional number of lines added."},deletions:{type:"number",description:"Optional number of lines removed."},title:{type:"string",description:"Optional title shown in the file tooltip."},description:{type:"string",description:"Optional secondary label shown for the file entry."}},required:["uri"],additionalProperties:!1},description:"Modified files to show in the confirmation UI."}},required:["title","message","options","modifiedFiles"],additionalProperties:!1}},Fw=class{async prepareToolInvocation(t,e){let n=t.parameters;if(!n.title||!n.message)throw new Error("Missing required parameters for ConfirmationTool");let o=n.confirmationType??"basic",i;return o==="terminal"?i={kind:"terminal",commandLine:{original:n.terminalCommand??""},language:"bash"}:i=void 0,{confirmationMessages:{title:n.title,message:new Bt(n.message),allowAutoConfirm:!(n.buttons||[]).length,customButtons:n.buttons},toolSpecificData:i,presentation:"hiddenAfterComplete"}}async invoke(t,e,n,o){return t.selectedCustomButton?{content:[{kind:"text",value:t.selectedCustomButton}]}:{content:[{kind:"text",value:"yes"}]}}},Hw=class{async prepareToolInvocation(t,e){let n=t.parameters;if(!n.title||!n.message)throw new Error("Missing required parameters for ModifiedFilesConfirmationTool");if(!n.options?.length)throw new Error("ModifiedFilesConfirmationTool requires at least one option");let o={kind:"modifiedFilesConfirmation",options:n.options,modifiedFiles:n.modifiedFiles.map(i=>({uri:b.parse(i.uri).toJSON(),originalUri:i.originalUri?b.parse(i.originalUri).toJSON():void 0,insertions:i.insertions,deletions:i.deletions,title:i.title,description:i.description}))};return{confirmationMessages:{title:n.title,message:new Bt(n.message),allowAutoConfirm:!1},toolSpecificData:o,presentation:"hiddenAfterComplete"}}async invoke(t,e,n,o){return t.selectedCustomButton?{content:[{kind:"text",value:t.selectedCustomButton}]}:{content:[{kind:"text",value:"yes"}]}}};var wf=class r{constructor(t,e){this.storageService=e;this.id=r.COMMON_PREFIX+t}static{this.applicationMementos=new Map}static{this.profileMementos=new Map}static{this.workspaceMementos=new Map}static{this.COMMON_PREFIX="memento/"}getMemento(t,e){switch(t){case 1:{let n=r.workspaceMementos.get(this.id);return n||(n=new ly(this.id,t,e,this.storageService),r.workspaceMementos.set(this.id,n)),n.getMemento()}case 0:{let n=r.profileMementos.get(this.id);return n||(n=new ly(this.id,t,e,this.storageService),r.profileMementos.set(this.id,n)),n.getMemento()}case-1:{let n=r.applicationMementos.get(this.id);return n||(n=new ly(this.id,t,e,this.storageService),r.applicationMementos.set(this.id,n)),n.getMemento()}}}onDidChangeValue(t,e){return this.storageService.onDidChangeValue(t,this.id,e)}saveMemento(){r.workspaceMementos.get(this.id)?.save(),r.profileMementos.get(this.id)?.save(),r.applicationMementos.get(this.id)?.save()}reloadMemento(t){let e;switch(t){case-1:e=r.applicationMementos.get(this.id);break;case 0:e=r.profileMementos.get(this.id);break;case 1:e=r.workspaceMementos.get(this.id);break}e?.reload()}static clear(t){switch(t){case 1:r.workspaceMementos.clear();break;case 0:r.profileMementos.clear();break;case-1:r.applicationMementos.clear();break}}},ly=class{constructor(t,e,n,o){this.id=t;this.scope=e;this.target=n;this.storageService=o;this.mementoObj=this.doLoad()}doLoad(){try{return this.storageService.getObject(this.id,this.scope,{})}catch(t){ze(`[memento]: failed to parse contents: ${t} (id: ${this.id}, scope: ${this.scope}, contents: ${this.storageService.get(this.id,this.scope)})`)}return{}}getMemento(){return this.mementoObj}reload(){for(let t of Object.getOwnPropertyNames(this.mementoObj))delete this.mementoObj[t];Object.assign(this.mementoObj,this.doLoad())}save(){tp(this.mementoObj)?this.storageService.remove(this.id,this.scope):this.storageService.store(this.id,this.mementoObj,this.scope,this.target)}};var QB=R("chatTodoListService"),dy=class{constructor(t){this.memento=new wf("chat-todo-list",t)}getSessionData(t){return this.memento.getMemento(1,1)[this.toKey(t)]||[]}setSessionData(t,e){let n=this.memento.getMemento(1,1);n[this.toKey(t)]=e,this.memento.saveMemento()}getTodoList(t){return this.getSessionData(t)}setTodoList(t,e){this.setSessionData(t,e)}migrateTodoList(t,e){let n=this.getSessionData(t);if(n.length>0){this.setSessionData(e,n);let o=this.memento.getMemento(1,1);delete o[this.toKey(t)],this.memento.saveMemento()}}toKey(t){return wl(t)}};dy=_([C(0,Sr)],dy);var Ww=class extends O{constructor(e){super();this._onDidUpdateTodos=this._register(new E);this.onDidUpdateTodos=this._onDidUpdateTodos.event;this.todoListStorage=new dy(e)}getTodos(e){return this.todoListStorage.getTodoList(e)}setTodos(e,n){this.todoListStorage.setTodoList(e,n),this._onDidUpdateTodos.fire(e)}migrateTodos(e,n){this.todoListStorage.migrateTodoList(e,n),this._onDidUpdateTodos.fire(n)}};Ww=_([C(0,Sr)],Ww);var XL="manage_todo_list";function ZL(){let r={type:"object",properties:{todoList:{type:"array",description:"Complete array of all todo items. Must include ALL items - both existing and new.",items:{type:"object",properties:{id:{type:"number",description:"Unique identifier for the todo. Use sequential numbers starting from 1."},title:{type:"string",description:"Concise action-oriented todo label (3-7 words). Displayed in UI."},status:{type:"string",enum:["not-started","in-progress","completed"],description:"not-started: Not begun | in-progress: Currently working (max 1) | completed: Fully finished with no blockers"}},required:["id","title","status"]}}},required:["todoList"]};return{id:XL,toolReferenceName:"todo",legacyToolReferenceFullNames:["todos"],canBeReferencedInPrompt:!0,icon:ut.fromId(ce.checklist.id),displayName:p(8663,null),userDescription:p(8664,null),modelDescription:`Manage a structured todo list to track progress and plan tasks throughout your coding session. Use this tool VERY frequently to ensure task visibility and proper planning.

When to use this tool:
- Complex multi-step work requiring planning and tracking
- When user provides multiple tasks or requests (numbered/comma-separated)
- After receiving new instructions that require multiple steps
- BEFORE starting work on any todo (mark as in-progress)
- IMMEDIATELY after completing each todo (mark completed individually)
- When breaking down larger tasks into smaller actionable steps
- To give users visibility into your progress and planning

When NOT to use:
- Single, trivial tasks that can be completed in one step
- Purely conversational/informational requests
- When just reading files or performing simple searches

CRITICAL workflow:
1. Plan tasks by writing todo list with specific, actionable items
2. Mark ONE todo as in-progress before starting work
3. Complete the work for that specific todo
4. Mark that todo as completed IMMEDIATELY
5. Move to next todo and repeat

Todo states:
- not-started: Todo not yet begun
- in-progress: Currently working (limit ONE at a time)
- completed: Finished successfully

IMPORTANT: Mark todos completed as soon as they are done. Do not batch completions.`,source:kn.Internal,inputSchema:r}}var utt=ZL(),kf=class extends O{constructor(e,n,o){super();this.chatTodoListService=e;this.logService=n;this.telemetryService=o}async invoke(e,n,o,i){let s=e.parameters,a=e.context?.sessionResource;if(!a&&s.operation==="read"&&s.chatSessionResource)try{a=b.parse(s.chatSessionResource)}catch(l){this.logService.error("ManageTodoListTool: Invalid chatSessionResource URI",l)}if(!a)return{content:[{kind:"text",value:"Error: No session resource available"}]};this.logService.debug(`ManageTodoListTool: Invoking with options ${JSON.stringify(s)}`);try{return s.operation==="read"?this.handleReadOperation(a):this.handleWriteOperation(s,a)}catch(l){return{content:[{kind:"text",value:`Error: ${l instanceof Error?l.message:"Unknown error"}`}]}}}async prepareToolInvocation(e,n){let o=e.parameters,i=e.chatSessionResource;if(!i)return;let s=this.chatTodoListService.getTodos(i),a;o.operation==="read"?a=p(8658,null):o.todoList&&(a=this.generatePastTenseMessage(s,o.todoList));let d=(o.todoList??s).map(m=>({id:m.id.toString(),title:m.title,status:m.status})),c=a?.replace(/^(Starting|Completed): /i,"")??p(8662,null);return{invocationMessage:new Bt(c),pastTenseMessage:new Bt(a??p(8661,null)),toolSpecificData:{kind:"todoList",todoList:d}}}generatePastTenseMessage(e,n){if(e.length===0)return n.length===1?p(8657,null):p(8656,null,n.length);let o=new Map(e.map(l=>[l.id,l])),i=n.filter(l=>{let d=o.get(l.id);return d&&d.status!=="in-progress"&&l.status==="in-progress"});if(i.length>0){let l=i[0],d=n.length,c=n.findIndex(u=>u.id===l.id)+1;return p(8659,null,l.title,c,d)}let s=n.filter(l=>{let d=o.get(l.id);return d&&d.status!=="completed"&&l.status==="completed"});if(s.length>0){let l=s[0],d=n.length,c=n.findIndex(u=>u.id===l.id)+1;return p(8655,null,l.title,c,d)}let a=n.filter(l=>!o.has(l.id));return a.length>0?a.length===1?p(8654,null):p(8653,null,a.length):p(8660,null)}handleRead(e,n){return e.length===0?"No todo list found.":`# Todo List

${this.formatTodoListAsMarkdownTaskList(e)}`}handleReadOperation(e){let n=this.chatTodoListService.getTodos(e),o=this.handleRead(n,e),i=this.calculateStatusCounts(n);return this.telemetryService.publicLog2("todoListToolInvoked",{operation:"read",notStartedCount:i.notStartedCount,inProgressCount:i.inProgressCount,completedCount:i.completedCount}),{content:[{kind:"text",value:o}]}}handleWriteOperation(e,n){if(!e.todoList)return{content:[{kind:"text",value:"Error: todoList is required for write operation"}]};let o=e.todoList.map(d=>({id:d.id,title:d.title,status:d.status})),i=this.chatTodoListService.getTodos(n),s=this.calculateTodoChanges(i,o);this.chatTodoListService.setTodos(n,o);let a=this.calculateStatusCounts(o),l=[];return o.length<3?l.push("Warning: Small todo list (<3 items). This task might not need a todo list."):o.length>10&&l.push("Warning: Large todo list (>10 items). Consider keeping the list focused and actionable."),s>3&&l.push("Warning: Did you mean to update so many todos at the same time? Consider working on them one by one."),this.telemetryService.publicLog2("todoListToolInvoked",{operation:"write",notStartedCount:a.notStartedCount,inProgressCount:a.inProgressCount,completedCount:a.completedCount}),{content:[{kind:"text",value:`Successfully wrote todo list${l.length?`

`+l.join(`
`):""}`}],toolMetadata:{warnings:l}}}calculateStatusCounts(e){let n=e.filter(s=>s.status==="not-started").length,o=e.filter(s=>s.status==="in-progress").length,i=e.filter(s=>s.status==="completed").length;return{notStartedCount:n,inProgressCount:o,completedCount:i}}formatTodoListAsMarkdownTaskList(e){return e.length===0?"":e.map(n=>{let o;switch(n.status){case"completed":o="[x]";break;case"in-progress":o="[-]";break;default:o="[ ]";break}return[`- ${o} ${n.title}`].join(`
`)}).join(`
`)}calculateTodoChanges(e,n){let o=0,i=Math.min(e.length,n.length);for(let d=0;d<i;d++){let c=e[d],u=n[d];(c.title!==u.title||c.status!==u.status)&&o++}let s=Math.max(0,n.length-e.length),a=Math.max(0,e.length-n.length);return s+a+o}};kf=_([C(0,QB),C(1,oe),C(2,gs)],kf);var lG="code/chat/",cy={RequestStart:"request/start",RequestUiUpdated:"request/uiUpdated",WillCollectInstructions:"request/willCollectInstructions",DidCollectInstructions:"request/didCollectInstructions",FirstToken:"request/firstToken",RequestComplete:"request/complete",AgentWillInvoke:"agent/willInvoke",AgentDidInvoke:"agent/didInvoke"};function uy(r,t){Ft(`${lG}${wl(r)}/${t}`)}var $w=R("chatAgentService"),Vw=class extends O{constructor(e,n){super();this.contextKeyService=e;this.configurationService=n;this._agents=new Map;this._onDidChangeAgents=this._register(new E);this.onDidChangeAgents=this._onDidChangeAgents.event;this._agentsContextKeys=new Set;this._hasToolsAgent=!1;this._chatParticipantDetectionProviders=new Map;this._agentCompletionProviders=new Map;this._hasDefaultAgent=ki.enabled.bindTo(this.contextKeyService),this._extensionAgentRegistered=ki.extensionParticipantRegistered.bindTo(this.contextKeyService),this._defaultAgentRegistered=ki.panelParticipantRegistered.bindTo(this.contextKeyService),this._register(e.onDidChangeContext(o=>{o.affectsSome(this._agentsContextKeys)&&this._updateContextKeys()}))}static{this.AGENT_LEADER="@"}registerAgent(e,n){if(this.getAgent(e))throw new Error(`Agent already registered: ${JSON.stringify(e)}`);let i=this,s=n.slashCommands;n={...n,get slashCommands(){return s.filter(l=>!l.when||i.contextKeyService.contextMatchesRules(Wt.deserialize(l.when)))}};let a={data:n};return this._agents.set(e,a),this._updateAgentsContextKeys(),this._updateContextKeys(),this._onDidChangeAgents.fire(void 0),K(()=>{this._agents.delete(e),this._updateAgentsContextKeys(),this._updateContextKeys(),this._onDidChangeAgents.fire(void 0)})}_updateAgentsContextKeys(){this._agentsContextKeys.clear();for(let e of this._agents.values())if(e.data.when){let n=Wt.deserialize(e.data.when);for(let o of n?.keys()||[])this._agentsContextKeys.add(o)}}_updateContextKeys(){let e=!1,n=!1,o=!1;for(let i of this.getAgents())i.isDefault&&(i.isCore||(e=!0),i.id==="chat.setup"||i.id==="github.copilot.editsAgent"?o=!0:n=!0);this._defaultAgentRegistered.set(n),this._extensionAgentRegistered.set(e),o!==this._hasToolsAgent&&(this._hasToolsAgent=o,this._onDidChangeAgents.fire(this.getDefaultAgent("panel","agent")))}registerAgentImplementation(e,n){let o=this._agents.get(e);if(!o)throw new Error(`Unknown agent: ${JSON.stringify(e)}`);if(o.impl)throw new Error(`Agent already has implementation: ${JSON.stringify(e)}`);return o.data.isDefault&&this._hasDefaultAgent.set(!0),o.impl=n,this._onDidChangeAgents.fire(new Pf(o.data,n)),K(()=>{o.impl=void 0,this._onDidChangeAgents.fire(void 0),o.data.isDefault&&this._hasDefaultAgent.set(Nt.some(this._agents.values(),i=>i.data.isDefault&&!!i.impl))})}registerDynamicAgent(e,n){e.isDynamic=!0;let o={data:e,impl:n};return this._agents.set(e.id,o),this._onDidChangeAgents.fire(new Pf(e,n)),K(()=>{this._agents.delete(e.id),this._onDidChangeAgents.fire(void 0)})}registerAgentCompletionProvider(e,n){return this._agentCompletionProviders.set(e,n),{dispose:()=>{this._agentCompletionProviders.delete(e)}}}async getAgentCompletionItems(e,n,o){return await this._agentCompletionProviders.get(e)?.(n,o)??[]}updateAgent(e,n){let o=this._agents.get(e);if(!o?.impl)throw new Error(`No activated agent with id ${JSON.stringify(e)} registered`);o.data.metadata={...o.data.metadata,...n},this._onDidChangeAgents.fire(new Pf(o.data,o.impl))}getDefaultAgent(e,n="ask"){return this._preferExtensionAgent(this.getActivatedAgents().filter(o=>n&&!o.modes.includes(n)?!1:!!o.isDefault&&o.locations.includes(e)))}get hasToolsAgent(){return!!this.configurationService.getValue("chat.agent.enabled")}getContributedDefaultAgent(e){return this._preferExtensionAgent(this.getAgents().filter(n=>!!n.isDefault&&n.locations.includes(e)))}_preferExtensionAgent(e){return LN(e,n=>!n.isCore)??e.at(-1)}getAgent(e,n=!1){if(!(!this._agentIsEnabled(e)&&!n))return this._agents.get(e)?.data}_agentIsEnabled(e){let n=typeof e=="string"?this._agents.get(e):e;return!n?.data.when||this.contextKeyService.contextMatchesRules(Wt.deserialize(n.data.when))}getAgentByFullyQualifiedId(e){let n=Nt.find(this._agents.values(),o=>dG(o.data)===e)?.data;if(!(n&&!this._agentIsEnabled(n.id)))return n}getAgents(){return Array.from(this._agents.values()).map(e=>e.data).filter(e=>this._agentIsEnabled(e.id))}getActivatedAgents(){return Array.from(this._agents.values()).filter(e=>!!e.impl).filter(e=>this._agentIsEnabled(e.data.id)).map(e=>new Pf(e.data,e.impl))}getAgentsByName(e){return this._preferExtensionAgents(this.getAgents().filter(n=>n.name===e))}_preferExtensionAgents(e){let n=e.filter(o=>!o.isCore);return n.length>0?n:e}agentHasDupeName(e){let n=this.getAgent(e);return n?this.getAgentsByName(n.name).filter(o=>o.extensionId.value!==n.extensionId.value).length>0:!1}async invokeAgent(e,n,o,i,s){uy(n.sessionResource,cy.AgentWillInvoke);let a=this._agents.get(e);if(!a?.impl)throw new Error(`No activated agent with id "${e}"`);let l=await a.impl.invoke(n,o,i,s);return uy(n.sessionResource,cy.AgentDidInvoke),l}setRequestTools(e,n,o){let i=this._agents.get(e);if(!i?.impl)throw new Error(`No activated agent with id "${e}"`);i.impl.setRequestTools?.(n,o)}setYieldRequested(e,n,o){let i=this._agents.get(e);i?.impl&&i.impl.setYieldRequested?.(n,o)}async getFollowups(e,n,o,i,s){let a=this._agents.get(e);return a?.impl?.provideFollowups?a.impl.provideFollowups(n,o,i,s):[]}async getChatTitle(e,n,o){let i=this._agents.get(e);if(i?.impl?.provideChatTitle)return i.impl.provideChatTitle(n,o)}async getChatSummary(e,n,o){let i=this._agents.get(e);if(i?.impl?.provideChatSummary)return i.impl.provideChatSummary(n,o)}registerChatParticipantDetectionProvider(e,n){return this._chatParticipantDetectionProviders.set(e,n),K(()=>{this._chatParticipantDetectionProviders.delete(e)})}hasChatParticipantDetectionProviders(){return this._chatParticipantDetectionProviders.size>0}async detectAgentOrCommand(e,n,o,i){let s=Nt.first(this._chatParticipantDetectionProviders.values());if(!s)return;let a=this.getAgents().reduce((u,m)=>{if(m.locations.includes(o.location)){u.push({participant:m.id,disambiguation:m.disambiguation??[]});for(let g of m.slashCommands)u.push({participant:m.id,command:g.name,disambiguation:g.disambiguation??[]})}return u},[]),l=await s.provideParticipantDetection(e,n,{...o,participants:a},i);if(!l)return;let d=this.getAgent(l.participant);if(!d)return;if(!l.command)return{agent:d};let c=d?.slashCommands.find(u=>u.name===l.command);if(c)return{agent:d,command:c}}};Vw=_([C(0,Oo),C(1,Kt)],Vw);var Pf=class{constructor(t,e){this.data=t;this.impl=e}get id(){return this.data.id}get name(){return this.data.name??""}get fullName(){return this.data.fullName??""}get description(){return this.data.description??""}get extensionId(){return this.data.extensionId}get extensionVersion(){return this.data.extensionVersion}get extensionPublisherId(){return this.data.extensionPublisherId}get extensionPublisherDisplayName(){return this.data.publisherDisplayName}get extensionDisplayName(){return this.data.extensionDisplayName}get isDefault(){return this.data.isDefault}get isCore(){return this.data.isCore}get metadata(){return this.data.metadata}get slashCommands(){return this.data.slashCommands}get locations(){return this.data.locations}get modes(){return this.data.modes}get disambiguation(){return this.data.disambiguation}async invoke(t,e,n,o){return this.impl.invoke(t,e,n,o)}setRequestTools(t,e){this.impl.setRequestTools?.(t,e)}setYieldRequested(t,e){this.impl.setYieldRequested?.(t,e)}async provideFollowups(t,e,n,o){return this.impl.provideFollowups?this.impl.provideFollowups(t,e,n,o):[]}toJSON(){return this.data}},Ntt=R("chatAgentNameService"),Bw=class{constructor(t){this.languageModelsService=t}getAgentNameRestriction(t){if(t.isCore)return!0;let e=this.checkAgentNameRestriction(t.name,t).get(),n=!t.fullName||this.checkAgentNameRestriction(t.fullName.replace(/\s/g,""),t).get();return e&&n}checkAgentNameRestriction(t,e){return this.languageModelsService.restrictedChatParticipants.map(o=>o[t.toLowerCase()]).map(o=>o?o.some(i=>wn(i,i.includes(".")?e.extensionId.value:e.extensionPublisherId)):!0)}};Bw=_([C(0,rS)],Bw);function dG(r){return`${r.extensionId.value}.${r.id}`}function cG(r){return r.name!==void 0}function zw(r){let t=cG(r)?r:{...r,name:r.id};return t.extensionPublisherId||(t.extensionPublisherId=r.extensionPublisher??""),t.extensionDisplayName||(t.extensionDisplayName=""),t.extensionId||(t.extensionId=new Ee("")),ht(t)}var JB=R("labelService");var qw=R("IPromptsService");var pG=".prompt.md",mG=".instructions.md",gG=".chatmode.md",fG=".agent.md",hG="SKILL.md";var vG="copilot-instructions.md";var bG=".github/prompts",yG=".github/instructions";var XB=".github/agents",Kw=".claude/agents",ZB="~/.copilot/agents",eO=".claude/rules";var IG=[{path:".github/skills",source:"github-workspace",storage:"local"},{path:".agents/skills",source:"agents-workspace",storage:"local"},{path:".claude/skills",source:"claude-workspace",storage:"local"},{path:"~/.copilot/skills",source:"copilot-personal",storage:"user"},{path:"~/.agents/skills",source:"agents-personal",storage:"user"},{path:"~/.claude/skills",source:"claude-personal",storage:"user"}],xG=[{path:yG,source:"github-workspace",storage:"local"},{path:eO,source:"claude-workspace",storage:"local"},{path:"~/.copilot/instructions",source:"copilot-personal",storage:"user"},{path:"~/"+eO,source:"claude-personal",storage:"user"}],SG=[{path:bG,source:"github-workspace",storage:"local"}],CG=[{path:XB,source:"github-workspace",storage:"local"},{path:Kw,source:"claude-workspace",storage:"local"},{path:"~/"+Kw,source:"claude-personal",storage:"user"},{path:ZB,source:"copilot-personal",storage:"user"}],TG=[{path:".github/hooks",source:"github-workspace",storage:"local"},{path:".claude/settings.local.json",source:"claude-workspace-local",storage:"local"},{path:".claude/settings.json",source:"claude-workspace",storage:"local"},{path:"~/.copilot/hooks",source:"copilot-personal",storage:"user"},{path:"~/.claude/settings.json",source:"claude-personal",storage:"user"}];function EG(r){let t=Go(r).path;return t.endsWith("/"+XB)||t.endsWith("/"+Kw)||wG(r)}function e5(r){return Go(r).path.endsWith("/"+Kw)}function wG(r){return Go(r).path.endsWith(ZB.substring(1))}function jw(r){return r.path.includes("/"+eO+"/")}function kG(r){let t=Tt(r);if(t.endsWith(pG))return"prompt";if(t.endsWith(mG)||t===vG)return"instructions";if(t.endsWith(gG)||t.endsWith(fG))return"agent";if(t.toLowerCase()===hG.toLowerCase())return"skill";if(t.endsWith(".md")&&t!=="README.md"&&EG(r))return"agent";if(t.endsWith(".md")&&t!=="README.md"&&jw(r))return"instructions";if(t.toLowerCase().endsWith(".json"))return"hook"}function tO(r){return kG(r)!==void 0}function t5(r){switch(r){case"instructions":return xG;case"prompt":return SG;case"agent":return CG;case"skill":return IG;case"hook":return TG;default:throw new Error("Unknown prompt type")}}var Ki;(N=>{N.PROMPT_LOCATIONS_KEY="chat.promptFilesLocations",N.INSTRUCTIONS_LOCATION_KEY="chat.instructionsFilesLocations",N.MODE_LOCATION_KEY="chat.modeFilesLocations",N.AGENTS_LOCATION_KEY="chat.agentFilesLocations",N.SKILLS_LOCATION_KEY="chat.agentSkillsLocations",N.HOOKS_LOCATION_KEY="chat.hookFilesLocations",N.PROMPT_FILES_SUGGEST_KEY="chat.promptFilesRecommendations",N.USE_COPILOT_INSTRUCTION_FILES="github.copilot.chat.codeGeneration.useInstructionFiles",N.USE_AGENT_MD="chat.useAgentsMdFile",N.USE_NESTED_AGENT_MD="chat.useNestedAgentsMdFiles",N.USE_CLAUDE_MD="chat.useClaudeMdFile",N.USE_AGENT_SKILLS="chat.useAgentSkills",N.USE_CHAT_HOOKS="chat.useHooks",N.USE_CLAUDE_HOOKS="chat.useClaudeHooks",N.USE_CUSTOM_AGENT_HOOKS="chat.useCustomAgentHooks",N.USE_SKILL_ADHERENCE_PROMPT="chat.experimental.useSkillAdherencePrompt",N.INCLUDE_APPLYING_INSTRUCTIONS="chat.includeApplyingInstructions",N.INCLUDE_REFERENCED_INSTRUCTIONS="chat.includeReferencedInstructions",N.USE_CUSTOMIZATIONS_IN_PARENT_REPOS="chat.useCustomizationsInParentRepositories";function P(B,G){let J=PG(G),Y=B.getValue(J);if(!(Y==null||Array.isArray(Y))&&typeof Y=="object"){let re={};for(let[Pe,ot]of Object.entries(Y)){let rt=Pe.trim(),ne=n5(ot);ne!==void 0&&rt&&(re[rt]=ne)}return re}}N.getLocationsValue=P;function L(B,G){let J=P(B,G),Y=t5(G);if(J&&typeof J=="object"){let re=[],Pe=new Set(Y.map(ot=>ot.path));for(let ot of Y)J[ot.path]!==!1&&re.push(ot);for(let[ot,rt]of Object.entries(J)){if(rt===!1||Pe.has(ot))continue;let ne=_G(ot)?"user":"local";re.push({path:ot,source:ne==="local"?"config-personal":"config-workspace",storage:ne})}return re}return[]}N.promptSourceFolders=L;function q(B,G){let J=B.getValue(N.PROMPT_FILES_SUGGEST_KEY,{resource:G});if(!J||typeof J!="object"||Array.isArray(J))return;let Y={};for(let[re,Pe]of Object.entries(J)){let ot=re.trim();if(!ot)continue;if(typeof Pe=="boolean"){Y[ot]=Pe;continue}if(typeof Pe=="string"){let ne=Pe.trim();ne&&(Y[ot]=ne);continue}let rt=n5(Pe);rt!==void 0&&(Y[ot]=rt)}return Object.keys(Y).length>0?Y:void 0}N.getPromptFilesRecommendationsValue=q})(Ki||={});function PG(r){switch(r){case"instructions":return Ki.INSTRUCTIONS_LOCATION_KEY;case"prompt":return Ki.PROMPT_LOCATIONS_KEY;case"agent":return Ki.AGENTS_LOCATION_KEY;case"skill":return Ki.SKILLS_LOCATION_KEY;case"hook":return Ki.HOOKS_LOCATION_KEY;default:throw new Error("Unknown prompt type")}}function n5(r){if(typeof r=="boolean")return r;if(typeof r=="string"){let t=r.trim().toLowerCase();return t==="true"?!0:t==="false"?!1:void 0}}function _G(r){return r.startsWith("~/")}var ko=class r{constructor(t,e){this.start=t;this.endExclusive=e;if(t>e)throw new Pt(`Invalid range: ${this.toString()}`)}static fromTo(t,e){return new r(t,e)}static equals(t,e){return t.start===e.start&&t.endExclusive===e.endExclusive}static addRange(t,e){let n=0;for(;n<e.length&&e[n].endExclusive<t.start;)n++;let o=n;for(;o<e.length&&e[o].start<=t.endExclusive;)o++;if(n===o)e.splice(n,0,t);else{let i=Math.min(t.start,e[n].start),s=Math.max(t.endExclusive,e[o-1].endExclusive);e.splice(n,o-n,new r(i,s))}}static tryCreate(t,e){if(!(t>e))return new r(t,e)}static ofLength(t){return new r(0,t)}static ofStartAndLength(t,e){return new r(t,t+e)}static emptyAt(t){return new r(t,t)}get isEmpty(){return this.start===this.endExclusive}delta(t){return new r(this.start+t,this.endExclusive+t)}deltaStart(t){return new r(this.start+t,this.endExclusive)}deltaEnd(t){return new r(this.start,this.endExclusive+t)}get length(){return this.endExclusive-this.start}toString(){return`[${this.start}, ${this.endExclusive})`}equals(t){return this.start===t.start&&this.endExclusive===t.endExclusive}containsRange(t){return this.start<=t.start&&t.endExclusive<=this.endExclusive}contains(t){return this.start<=t&&t<this.endExclusive}join(t){return new r(Math.min(this.start,t.start),Math.max(this.endExclusive,t.endExclusive))}intersect(t){let e=Math.max(this.start,t.start),n=Math.min(this.endExclusive,t.endExclusive);if(e<=n)return new r(e,n)}intersectionLength(t){let e=Math.max(this.start,t.start),n=Math.min(this.endExclusive,t.endExclusive);return Math.max(0,n-e)}intersects(t){let e=Math.max(this.start,t.start),n=Math.min(this.endExclusive,t.endExclusive);return e<n}intersectsOrTouches(t){let e=Math.max(this.start,t.start),n=Math.min(this.endExclusive,t.endExclusive);return e<=n}isBefore(t){return this.endExclusive<=t.start}isAfter(t){return this.start>=t.endExclusive}slice(t){return t.slice(this.start,this.endExclusive)}substring(t){return t.substring(this.start,this.endExclusive)}clip(t){if(this.isEmpty)throw new Pt(`Invalid clipping range: ${this.toString()}`);return Math.max(this.start,Math.min(this.endExclusive-1,t))}clipCyclic(t){if(this.isEmpty)throw new Pt(`Invalid clipping range: ${this.toString()}`);return t<this.start?this.endExclusive-(this.start-t)%this.length:t>=this.endExclusive?this.start+(t-this.start)%this.length:t}map(t){let e=[];for(let n=this.start;n<this.endExclusive;n++)e.push(t(n));return e}forEach(t){for(let e=this.start;e<this.endExclusive;e++)t(e)}joinRightTouching(t){if(this.endExclusive!==t.start)throw new Pt(`Invalid join: ${this.toString()} and ${t.toString()}`);return new r(this.start,t.endExclusive)}withMargin(t,e){return e===void 0&&(e=t),new r(this.start-t,this.endExclusive+e)}};var o5=R("agentPluginService");var nO=class{constructor(){this._discovery=[]}register(t){this._discovery.push(t)}getAll(){return this._discovery}},nnt=new nO;function DG(){return{applyingInstructionsCount:0,referencedInstructionsCount:0,agentInstructionsCount:0,listedInstructionsCount:0,totalInstructionsCount:0,claudeRulesCount:0,claudeMdCount:0,claudeAgentsCount:0}}var _f=class{constructor(t,e,n,o,i,s,a,l,d,c,u,m,g,h,f){this._modeKind=t;this._enabledTools=e;this._enabledSubagents=n;this._sessionResource=o;this._promptsService=i;this._logService=s;this._labelService=a;this._configurationService=l;this._contextKeyService=d;this._workspaceService=c;this._fileService=u;this._remoteAgentService=m;this._telemetryService=g;this._languageModelToolsService=h;this._agentPluginService=f;this._parseResults=new Ke}async _parseInstructionsFile(t,e){if(this._parseResults.has(t))return this._parseResults.get(t);try{let n=await this._promptsService.parseNew(t,e);return this._parseResults.set(t,n),n}catch(n){this._logService.error(`[InstructionsContextComputer] Failed to parse instruction file: ${t}`,n);return}}async collect(t,e){let n=await this._promptsService.getInstructionFiles(e,this._sessionResource);this._logService.trace(`[InstructionsContextComputer] ${n.length} instruction files available.`);let o=DG(),i=this._getContext(t);await this.addApplyingInstructions(n,i,t,o,e),await this._addReferencedInstructions(t,o,e),await this._addAgentInstructions(t,o,e);let s=await this._getCustomizationsIndex(n,t,o,e);s&&(t.add(s),o.listedInstructionsCount++),this.sendTelemetry(o)}sendTelemetry(t){t.totalInstructionsCount=t.agentInstructionsCount+t.referencedInstructionsCount+t.applyingInstructionsCount+t.listedInstructionsCount,this._telemetryService.publicLog2("instructionsCollected",t)}async _logSkillLoadedTelemetry(t){try{let e=new Ke,n=this._agentPluginService.plugins.get();for(let i of n)e.set(i.uri,i);let o=i=>i!==void 0?String(Gn(i)):"";for(let i of t){let s=i.pluginUri?e.get(i.pluginUri):void 0;this._telemetryService.publicLog2("skillLoadedIntoContext",{skillNameHash:o(i.name),skillStorage:i.storage,extensionIdHash:o(i.extension?.identifier.value),extensionVersion:i.extension?.version??"",pluginNameHash:o(s?.label),pluginVersion:s?.fromMarketplace?.version??""})}}catch(e){this._logService.error("[InstructionsContextComputer] Failed to log skill telemetry",e)}}async addApplyingInstructions(t,e,n,o,i){if(!this._configurationService.getValue(Ki.INCLUDE_APPLYING_INSTRUCTIONS)&&this._modeKind!=="edit"){this._logService.trace("[InstructionsContextComputer] includeApplyingInstructions is disabled and agent kind is not Edit. No applying instructions will be added.");return}for(let{uri:a}of t){let l=await this._parseInstructionsFile(a,i);if(!l){this._logService.trace(`[InstructionsContextComputer] Unable to read: ${a}`);continue}let d=l.header?.applyTo,c=l.header?.paths,u=jw(a),m=u?c?.join(", ")??"**":d;if(!m){this._logService.trace(`[InstructionsContextComputer] No 'applyTo' found: ${a}`);continue}if(e.instructions.has(a)){this._logService.trace(`[InstructionsContextComputer] Skipping already processed instruction file: ${a}`);continue}let g=this._matches(e.files,m);if(g){this._logService.trace(`[InstructionsContextComputer] Match for ${a} with ${g.pattern}${g.file?` for file ${g.file}`:""}`);let h=g.file?p(8285,null,m,this._labelService.getUriLabel(g.file,{relative:!0})):p(8283,null);n.add(Pl(a,"vscode.instructions.file.root",h,!0)),o.applyingInstructionsCount++,u&&o.claudeRulesCount++}else this._logService.trace(`[InstructionsContextComputer] No match for ${a} with ${m}`)}}_getContext(t){let e=new kr,n=new kr;for(let o of t.asArray())if(av(o))n.add(o.value);else{let i=kl.toUri(o);i&&e.add(i)}return{files:e,instructions:n}}async _addAgentInstructions(t,e,n){let o={logInfo:l=>this._logService.trace(`[InstructionsContextComputer] ${l}`)},i=await this._promptsService.listAgentInstructions(n,o),s=new Ic,a=new Ic;for(let{uri:l,type:d}of i){let c=Pl(l,"vscode.instructions.file.root",void 0,!0);s.add(c),d==="copilotInstructionsMd"&&a.add(c),e.agentInstructionsCount++,d==="claudeMd"&&e.claudeMdCount++,o.logInfo(`Agent instruction file added: ${l.toString()}`)}if(a.length>0){await this._addReferencedInstructions(a,e,n);for(let l of a.asArray())t.add(l)}for(let l of s.asArray())t.add(l)}_matches(t,e){let n=va(e,","),o=i=>{if(i=i.trim(),i.length!==0){if(i==="**"||i==="**/*"||i==="*")return{pattern:i};!i.startsWith("/")&&!i.startsWith("**/")&&(i="**/"+i);for(let s of t)if(nr(i,s.path,{ignoreCase:!0}))return{pattern:i,file:s}}};for(let i of n){let s=o(i);if(s)return s}}_getTool(t){if(!this._enabledTools)return;let e=this._languageModelToolsService.getToolByName(t);if(e&&this._enabledTools[e.id])return{tool:e,variable:`#tool:${this._languageModelToolsService.getFullReferenceName(e)}`}}async _getCustomizationsIndex(t,e,n,o){let i=this._getTool("readFile"),s=this._getTool(bv.runSubagent),l=(await this._remoteAgentService.getEnvironment())?.os,d=h=>RG(h,l),c=[];if(i){let f=this._configurationService.getValue(Ki.USE_NESTED_AGENT_MD)?this._promptsService.listNestedAgentMDs(o):Promise.resolve([]);c.push("<instructions>"),c.push("Here is a list of instruction files that contain rules for working with this codebase."),c.push("These files are important for understanding the codebase structure, conventions, and best practices."),c.push("Please make sure to follow the rules specified in these files when working with the codebase."),c.push(`If the file is not already available as attachment, use the ${i.variable} tool to acquire it.`),c.push("Make sure to acquire the instructions before working with the codebase.");let I=!1;for(let{uri:N}of t){let B=await this._parseInstructionsFile(N,o);if(B){if(c.push("<instruction>"),B.header){let{description:G}=B.header;G&&c.push(`<description>${G}</description>`),c.push(`<file>${d(N)}</file>`);let J=AG(B.header,jw(N));J&&c.push(`<applyTo>${J}</applyTo>`)}else c.push(`<file>${d(N)}</file>`);c.push("</instruction>"),I=!0}}let S=await f;for(let{uri:N}of S){let B=this._labelService.getUriLabel(Go(N),{relative:!0}),G=B.trim().length===0?p(8282,null):p(8281,null,B);c.push("<instruction>"),c.push(`<description>${G}</description>`),c.push(`<file>${d(N)}</file>`),c.push("</instruction>"),I=!0}I?c.push("</instructions>","",""):c.length=0;let T=await this._promptsService.findAgentSkills(o,this._sessionResource),P=this._configurationService.getValue(dH),L=this._configurationService.getValue(cH),q=T?.filter(N=>!(N.disableModelInvocation||N.when&&!this._contextKeyService.contextMatchesRules(N.when)||(!P||!L)&&N.uri.path.includes(uH)));if(q&&q.length>0){this._logSkillLoadedTelemetry(q);let N=this._configurationService.getValue(Ki.USE_SKILL_ADHERENCE_PROMPT);c.push("<skills>"),N?(c.push("Skills provide specialized capabilities, domain knowledge, and refined workflows for producing high-quality outputs. Each skill folder contains tested instructions for specific domains like testing strategies, API design, or performance optimization. Multiple skills can be combined when a task spans different domains."),c.push(`BLOCKING REQUIREMENT: When a skill applies to the user's request, you MUST load and read the SKILL.md file IMMEDIATELY as your first action, BEFORE generating any other response or taking action on the task. Use ${i.variable} to load the relevant skill(s).`),c.push("NEVER just mention or reference a skill in your response without actually reading it first. If a skill is relevant, load it before proceeding."),c.push("How to determine if a skill applies:"),c.push("1. Review the available skills below and match their descriptions against the user's request"),c.push("2. If any skill's domain overlaps with the task, load that skill immediately"),c.push("3. When multiple skills apply (e.g., a flowchart in documentation), load all relevant skills"),c.push("Examples:"),c.push(`- "Help me write unit tests for this module" -> Load the testing skill via ${i.variable} FIRST, then proceed`),c.push(`- "Optimize this slow function" -> Load the performance-profiling skill via ${i.variable} FIRST, then proceed`),c.push('- "Add a discount code field to checkout" -> Load both the checkout-flow and form-validation skills FIRST'),c.push("Available skills:")):(c.push("Here is a list of skills that contain domain specific knowledge on a variety of topics."),c.push("Each skill comes with a description of the topic and a file path that contains the detailed instructions."),c.push(`When a user asks you to perform a task that falls within the domain of a skill, use the ${i.variable} tool to acquire the full instructions from the file URI.`));for(let B of q)c.push("<skill>"),c.push(`<name>${B.name}</name>`),B.description&&c.push(`<description>${B.description}</description>`),c.push(`<file>${d(B.uri)}</file>`),c.push("</skill>");c.push("</skills>","","")}}if(s&&this._configurationService.getValue("chat.customAgentInSubagent.enabled")){let h=(()=>{if(!this._enabledSubagents||this._enabledSubagents.includes("*"))return I=>I.visibility.agentInvocable;{let I=this._enabledSubagents;return S=>I.includes(S.name)}})(),f=await this._promptsService.getCustomAgents(o,this._sessionResource);if(f.length>0){c.push("<agents>"),c.push("Here is a list of agents that can be used when running a subagent."),c.push("Each agent has optionally a description with the agent's purpose and expertise. When asked to run a subagent, choose the most appropriate agent from this list."),c.push(`Use the ${s.variable} tool with the agent name to run the subagent.`);for(let I of f)h(I)&&(c.push("<agent>"),c.push(`<name>${I.name}</name>`),I.description&&c.push(`<description>${I.description}</description>`),I.argumentHint&&c.push(`<argumentHint>${I.argumentHint}</argumentHint>`),c.push("</agent>"),e5(I.uri)&&n.claudeAgentsCount++);c.push("</agents>","","")}}if(c.length===0)return;let u=c.join(`
`),m=[],g=h=>{if(h){let f=u.indexOf(h.variable);for(;f>=0;)m.push(sH(h.tool,new ko(f,f+h.variable.length))),f=u.indexOf(h.variable,f+1)}};return g(i),g(s),iH(u,!0,m)}async _addReferencedInstructions(t,e,n){if(!this._configurationService.getValue(Ki.INCLUDE_REFERENCED_INSTRUCTIONS)&&this._modeKind!=="edit"){this._logService.trace("[InstructionsContextComputer] includeReferencedInstructions is disabled and agent kind is not Edit. No referenced instructions will be added.");return}let i=new kr,s=[];for(let l of t.asArray())av(l)&&(i.has(l.value)||(s.push(l.value),i.add(l.value)));let a=s.pop();for(;a;){let l=await this._parseInstructionsFile(a,n);if(l&&l.body){let d=[];for(let c of l.body.fileReferences){let u=l.body.resolveFilePath(c.content);u&&!i.has(u)&&(tO(u)||this._workspaceService.getWorkspaceFolder(u)!==void 0)&&(d.push({resource:u}),i.add(u))}if(d.length>0){let c=await this._fileService.resolveAll(d);for(let u=0;u<c.length;u++){let m=c[u],g=d[u].resource;if(m.success&&m.stat?.isFile){tO(g)&&s.push(g);let h=p(8284,null,Tt(a));t.add(Pl(g,"vscode.instructions.file.reference",h,!0)),e.referencedInstructionsCount++,this._logService.trace(`[InstructionsContextComputer] ${g.toString()} added, referenced by ${a.toString()}`)}}}}a=s.pop()}}};_f=_([C(4,qw),C(5,oe),C(6,JB),C(7,Kt),C(8,Oo),C(9,cs),C(10,da),C(11,kg),C(12,gs),C(13,wc),C(14,o5)],_f);function RG(r,t){if(r.scheme===V.file||r.scheme===V.vscodeRemote){let e=r.fsPath;return t!==void 0?t===1?e.replace(/\//g,"\\"):e.replace(/\\/g,"/"):e}return r.toString()}function AG(r,t){return t?r?.paths?.join(", ")??"**":r?.applyTo??void 0}function MG(r,t,e){let n=e.defaultChatAgent?.chatExtensionId;if(!n)return!1;let o=Ee.equals(t,n),i=r.path.includes("/github/");return o&&i}function r5(r,t,e){if(r.storage!=="extension")return!1;let n=e.defaultChatAgent?.chatExtensionId;return!n||!Ee.equals(r.extensionId,n)?!1:!MG(t,r.extensionId,e)}function Gw(r){return{content:[{kind:"text",value:r}]}}var LG=`Launch a new agent to handle complex, multi-step tasks autonomously. This tool is good at researching complex questions, searching for code, and executing multi-step tasks. When you are searching for a keyword or file and are not confident that you will find the right match in the first few tries, use this agent to perform the search for you.

- Agents do not run async or in the background, you will wait for the agent's result.
- When the agent is done, it will return a single message back to you. The result returned by the agent is not visible to the user. To show the user the result, you should send a text message back to the user with a concise summary of the result.
- Each agent invocation is stateless. You will not be able to send additional messages to the agent, nor will the agent be able to communicate with you outside of its final report. Therefore, your prompt should contain a highly detailed task description for the agent to perform autonomously and you should specify exactly what information the agent should return back to you in its final and only message to you.
- The agent's outputs should generally be trusted
- Clearly tell the agent whether you expect it to write code or just to do research (search, file reads, web fetches, etc.), since it is not aware of the user's intent`,OG=5,ji=class extends O{constructor(e,n,o,i,s,a,l,d,c,u){super();this.chatAgentService=e;this.chatService=n;this.languageModelToolsService=o;this.languageModelsService=i;this.logService=s;this.toolsService=a;this.configurationService=l;this.promptsService=d;this.instantiationService=c;this.productService=u;this._resolvedModels=new Map;this._sessionDepth=new Map;this.onDidUpdateToolData=he.filter(this.configurationService.onDidChangeConfiguration,m=>m.affectsConfiguration("chat.customAgentInSubagent.enabled"))}static{this.Id="runSubagent"}getToolData(){let e=LG,n={type:"object",properties:{prompt:{type:"string",description:"A detailed description of the task for the agent to perform"},description:{type:"string",description:"A short (3-5 word) description of the task"}},required:["prompt","description"]};return this.configurationService.getValue("chat.customAgentInSubagent.enabled")&&(n.properties.agentName={type:"string",description:"Optional name of a specific agent to invoke. If not provided, uses the current agent."},e+=`
- If the user asks for a certain agent, you MUST provide that EXACT agent name (case-sensitive) to invoke that specific agent.`),{id:ji.Id,toolReferenceName:bv.runSubagent,icon:ut.fromId(ce.organization.id),displayName:p(8665,null),userDescription:p(8666,null),modelDescription:e,source:kn.Internal,inputSchema:n}}async invoke(e,n,o,i){let s=e.parameters;if(this.logService.debug(`RunSubagentTool: Invoking with prompt: ${s.prompt.substring(0,100)}...`),!e.context)throw new Error("toolInvocationToken is required for this tool");let a=this.chatService.getSession(e.context.sessionResource);if(!a)throw new Error("Chat model not found for session");let l=a.getRequests().at(-1),d=new $;try{let c=this.chatAgentService.getDefaultAgent("panel","agent");if(!c)return Gw("Error: No default agent available");let u=e.modelId,m=e.userSelectedTools,g,h,f,I=s.agentName;if(I)if(h=await this.getSubAgentByName(I),h){let te=this._resolvedModels.get(e.callId);if(te)this._resolvedModels.delete(e.callId),u=te.modeModelId,f=te.resolvedModelName;else{let ge=this.resolveSubagentModel(h,e.modelId);u=ge.modeModelId,f=ge.resolvedModelName}let X=h.tools;if(X){let ge=this.languageModelToolsService.toToolAndToolSetEnablementMap(X,void 0);m={};for(let[Le,gt]of ge)HH(Le)||(m[Le.id]=gt)}let de=h.agentInstructions;g=de&&{name:I,content:de.content,toolReferences:this.toolsService.toToolReferences(de.toolReferences),metadata:de.metadata,isBuiltin:r5(h.source,h.uri,this.productService)}}else throw new Error(`Requested agent '${I}' not found. Try again with the correct agent name, or omit the agentName to use the current agent.`);else{let te=this._resolvedModels.get(e.callId);te?(this._resolvedModels.delete(e.callId),f=te.resolvedModelName):f=(u?this.languageModelsService.lookupLanguageModel(u):void 0)?.name}let S=[],T=e.chatStreamToolCallId??e.callId??`subagent-${Ae()}`,P=!1,L=te=>{for(let X of te)X.kind==="textEdit"||X.kind==="notebookEdit"||X.kind==="codeblockUri"?(X.kind==="codeblockUri"&&!P&&(P=!0,a.acceptResponseProgress(l,{kind:"markdownContent",content:new Bt("```\n")})),X.kind==="codeblockUri"?a.acceptResponseProgress(l,{...X,subAgentInvocationId:T}):a.acceptResponseProgress(l,X)):X.kind==="hook"?a.acceptResponseProgress(l,{...X,subAgentInvocationId:T}):X.kind==="markdownContent"&&(P&&(a.acceptResponseProgress(l,{kind:"markdownContent",content:new Bt("\n```\n\n")}),P=!1),S.push(X.content.value))},q=this.configurationService.getValue("chat.subagents.allowInvocationsFromSubagents")??!1,N=q?OG:0,B=e.context.sessionResource.toString(),G=this._sessionDepth.get(B)??0,J=G+1<=N;m||(m={}),m[ji.Id]!==!1&&(m[ji.Id]=J),m[XL]=!1,m.copilot_askQuestions=!1,N>0&&this.logService.debug(`RunSubagentTool: Nested subagents enabling ${m[ji.Id]}: session ${B}, currentDepth: ${G}, maxDepth: ${N}, allowInvocationsFromSubagents: ${q}`);let re=new Ic;await this.instantiationService.createInstance(_f,"agent",m,void 0,e.context.sessionResource).collect(re,i);let ot;try{ot=(await this.promptsService.getHooks(i,e.context.sessionResource))?.hooks}catch(te){this.logService.warn("[ChatService] Failed to collect hooks:",te)}if(h?.hooks){let te={...h.hooks};if(te.Stop){let X=te.Stop;te.SubagentStop=te.SubagentStop?[...te.SubagentStop,...X]:X,te.Stop=void 0}ot=gH(ot,te)}let rt={sessionResource:e.context.sessionResource,requestId:e.callId??`subagent-${Date.now()}`,agentId:c.id,message:s.prompt,variables:{variables:re.asArray()},location:"panel",subAgentInvocationId:T,subAgentName:I,userSelectedModelId:u,modelConfiguration:u?this.languageModelsService.getModelConfiguration(u):void 0,userSelectedTools:m,modeInstructions:g,parentRequestId:e.chatRequestId,hooks:ot,hasHooksEnabled:!!ot&&Object.values(ot).some(te=>te&&te.length>0)};d.add(this.languageModelToolsService.onDidInvokeTool(te=>{te.subagentInvocationId===T&&(S.length=0)})),this._sessionDepth.set(B,G+1);let ne;try{ne=await this.chatAgentService.invokeAgent(c.id,rt,L,[],i)}finally{let te=(this._sessionDepth.get(B)??1)-1;te<=0?this._sessionDepth.delete(B):this._sessionDepth.set(B,te)}if(ne?.errorDetails)return Gw(`Agent error: ${ne.errorDetails.message}`);let ee=S.join("").replace(/^\n*```\n+```\n*/g,"").trim()||"Agent completed with no output";return e.toolSpecificData?.kind==="subagent"&&(e.toolSpecificData.result=ee,e.toolSpecificData.modelName=f),{content:[{kind:"text",value:ee}],toolMetadata:{subAgentInvocationId:T,description:s.description,agentName:rt.subAgentName,modelName:f}}}catch(c){let u=`Error invoking subagent: ${c instanceof Error?c.message:"Unknown error"}`;return this.logService.error(u,c),Gw(u)}finally{d.dispose()}}async getSubAgentByName(e){return(await this.promptsService.getCustomAgents(ve.None)).find(o=>o.name===e)}resolveSubagentModel(e,n){let o=n;if(e){let s=e.model;if(s)e:for(let a of s){let l=this.languageModelsService.lookupLanguageModelByQualifiedName(a);if(l?.identifier){o=l.identifier;break e}}if(o&&o!==n){let a=n?this.languageModelsService.lookupLanguageModel(n):void 0,l=this.languageModelsService.lookupLanguageModel(o),d=a?.multiplierNumeric,c=l?.multiplierNumeric;d!==void 0&&c!==void 0&&c>d&&(this.logService.warn(`[RunSubagentTool] Subagent '${e.name}' requested model '${l?.name}' (multiplier: ${c}) which has a larger multiplier than the main agent model '${a?.name}' (multiplier: ${d}). Falling back to the main agent model.`),o=n)}}let i=o?this.languageModelsService.lookupLanguageModel(o):void 0;return{modeModelId:o,resolvedModelName:i?.name}}async prepareToolInvocation(e,n){let o=e.parameters,i=o.agentName?await this.getSubAgentByName(o.agentName):void 0,s=this.resolveSubagentModel(i,e.modelId);return this._resolvedModels.set(e.toolCallId,s),{invocationMessage:o.description,toolSpecificData:{kind:"subagent",description:o.description,agentName:i?.name,prompt:o.prompt,modelName:s.resolvedModelName}}}};ji=_([C(0,$w),C(1,$s),C(2,wc),C(3,rS),C(4,oe),C(5,wc),C(6,Kt),C(7,qw),C(8,Jo),C(9,ms)],ji);var i5=R("chatEditingService");var Wot=new w("chatEditingWidgetFileState",void 0,p(8213,null)),Vot=new w("chatEditingAgentSupportsReadonlyReferences",void 0,p(8212,null)),Bot=new w("decidedChatEditingResource",[]),$ot=new w("chatEditingResource",void 0),zot=new w("inChatEditingSession",void 0),qot=new w("hasUndecidedChatEditingResource",!1),Kot=new w("hasAppliedChatEdits",!1),jot=new w("applyingChatEditsFailed",!1);function s5(r){return wB(r)&&(r={kind:"terminal",commandLine:{original:r.command,toolEdited:void 0,userEdited:void 0},language:r.language}),r}var Qw=class r{constructor(t,e,n,o,i,s={},a){this.toolCallId=n;this.kind="toolInvocation";this.isAttachedToThinking=!1;this._progress=to(this,{progress:0});this._partialInput=to(this,void 0);this._streamingMessage=to(this,void 0);let l="";s.startInStreaming?l=e.displayName:s.startInCancelled&&(l=s.cancelReasonMessage??p(8246,null,e.displayName)),this.invocationMessage=t?.invocationMessage??l,this.pastTenseMessage=t?.pastTenseMessage,this.originMessage=t?.originMessage,this.confirmationMessages=t?.confirmationMessages,this.presentation=t?.presentation,this.toolSpecificData=t?.toolSpecificData,this.toolId=e.id,this.icon=t?.icon??(e.icon&&ut.isThemeIcon(e.icon)?e.icon:void 0),this.source=e.source,this.subAgentInvocationId=o,this.parameters=i,this.chatRequestId=a,s.startInCancelled?this._state=to(this,{type:_t.StateKind.Cancelled,reason:s.cancelReason??0,reasonMessage:s.cancelReasonMessage,parameters:this.parameters,confirmationMessages:this.confirmationMessages}):s.startInStreaming?this._state=to(this,{type:_t.StateKind.Streaming,partialInput:this._partialInput,streamingMessage:this._streamingMessage}):this.confirmationMessages?.title?this._state=to(this,{type:_t.StateKind.WaitingForConfirmation,parameters:this.parameters,confirmationMessages:this.confirmationMessages,confirm:d=>{d.type===0||d.type===5?this._state.set({type:_t.StateKind.Cancelled,reason:d.type,parameters:this.parameters,confirmationMessages:this.confirmationMessages},void 0):this._state.set({type:_t.StateKind.Executing,confirmed:d,progress:this._progress,parameters:this.parameters,confirmationMessages:this.confirmationMessages},void 0)}}):this._state=to(this,{type:_t.StateKind.Executing,confirmed:{type:1,reason:this.confirmationMessages?.confirmationNotNeededReason},progress:this._progress,parameters:this.parameters,confirmationMessages:this.confirmationMessages})}get state(){return this._state}static createStreaming(t){return new r(void 0,t.toolData,t.toolCallId,t.subagentInvocationId,void 0,{startInStreaming:!0},t.chatRequestId)}static createCancelled(t,e,n,o){return new r(void 0,t.toolData,t.toolCallId,t.subagentInvocationId,e,{startInCancelled:!0,cancelReason:n,cancelReasonMessage:o},t.chatRequestId)}updatePartialInput(t){this._state.get().type===_t.StateKind.Streaming&&this._partialInput.set(t,void 0)}updateStreamingMessage(t){this._state.get().type===_t.StateKind.Streaming&&this._streamingMessage.set(t,void 0)}cancelFromStreaming(t,e){return this._state.get().type!==_t.StateKind.Streaming?!1:(this._state.set({type:_t.StateKind.Cancelled,reason:t,reasonMessage:e,parameters:this.parameters,confirmationMessages:this.confirmationMessages},void 0),!0)}transitionFromStreaming(t,e,n){if(this._state.get().type!==_t.StateKind.Streaming)return;let i=this._streamingMessage.get();i&&!t?.invocationMessage&&(this.invocationMessage=i),this.parameters=e,t&&(t.invocationMessage&&(this.invocationMessage=t.invocationMessage),this.pastTenseMessage=t.pastTenseMessage,this.confirmationMessages=t.confirmationMessages,this.presentation=t.presentation,this.toolSpecificData=t.toolSpecificData);let s=a=>{a.type===0||a.type===5?this._state.set({type:_t.StateKind.Cancelled,reason:a.type,parameters:this.parameters,confirmationMessages:this.confirmationMessages},void 0):this._state.set({type:_t.StateKind.Executing,confirmed:a,progress:this._progress,parameters:this.parameters,confirmationMessages:this.confirmationMessages},void 0)};n?s(n):this.confirmationMessages?.title?this._state.set({type:_t.StateKind.WaitingForConfirmation,parameters:this.parameters,confirmationMessages:this.confirmationMessages,confirm:s},void 0):this._state.set({type:_t.StateKind.Executing,confirmed:{type:1,reason:this.confirmationMessages?.confirmationNotNeededReason},progress:this._progress,parameters:this.parameters,confirmationMessages:this.confirmationMessages},void 0)}_setCompleted(t,e){if(e&&(e.type===0||e.type===5)){this._state.set({type:_t.StateKind.Cancelled,reason:e.type,parameters:this.parameters,confirmationMessages:this.confirmationMessages},void 0);return}this._state.set({type:_t.StateKind.Completed,confirmed:_t.executionConfirmedOrDenied(this)||{type:1},resultDetails:t?.toolResultDetails,postConfirmed:e,contentForModel:t?.content||[],parameters:this.parameters,confirmationMessages:this.confirmationMessages},void 0)}async didExecuteTool(t,e,n){if(t?.toolResultMessage?this.pastTenseMessage=t.toolResultMessage:this._progress.get().message&&(this.pastTenseMessage=this._progress.get().message),this.confirmationMessages?.confirmResults&&!t?.toolResultError&&t?.confirmResults!==!1&&!e){let o=await n?.();o?this._setCompleted(t,o):this._state.set({type:_t.StateKind.WaitingForPostApproval,confirmed:_t.executionConfirmedOrDenied(this)||{type:1},resultDetails:t?.toolResultDetails,contentForModel:t?.content||[],confirm:i=>this._setCompleted(t,i),parameters:this.parameters,confirmationMessages:this.confirmationMessages},void 0)}else this._setCompleted(t);return this._state.get()}acceptProgress(t){let e=this._progress.get();this._progress.set({progress:t.progress||e.progress||0,message:t.message},void 0)}toJSON(){let t=this.state.get().type===_t.StateKind.WaitingForPostApproval,e=t?void 0:_t.resultDetails(this);return{kind:"toolInvocationSerialized",presentation:this.presentation,invocationMessage:this.invocationMessage,pastTenseMessage:this.pastTenseMessage,originMessage:this.originMessage,isConfirmed:t?{type:5}:_t.executionConfirmedOrDenied(this),isComplete:!0,source:this.source,resultDetails:FH(e)?{output:{type:"data",mimeType:e.output.mimeType,base64Data:Ao(e.output.value)}}:e,toolSpecificData:this.toolSpecificData,toolCallId:this.toolCallId,toolId:this.toolId,subAgentInvocationId:this.subAgentInvocationId,generatedTitle:this.generatedTitle}}};var NG;(t=>{function r(e,n){return e.text===n.text&&qR(e.parts,n.parts,(o,i)=>o.kind===i.kind&&ko.equals(o.range,i.range)&&We.equalsRange(o.editorRange,i.editorRange)&&o.text===i.text)}t.equals=r})(NG||={});var Df=class r{constructor(t,e,n){this.range=t;this.editorRange=e;this.text=n;this.kind=r.Kind}static{this.Kind="text"}get promptText(){return this.text}},rk="#",UG="@",py="/",Jw=class r{constructor(t,e,n,o,i){this.range=t;this.editorRange=e;this.variableName=n;this.variableArg=o;this.variableId=i;this.kind=r.Kind}static{this.Kind="var"}get text(){let t=this.variableArg?`:${this.variableArg}`:"";return`${rk}${this.variableName}${t}`}get promptText(){return this.text}},Yw=class r{constructor(t,e,n,o,i,s){this.range=t;this.editorRange=e;this.toolName=n;this.toolId=o;this.displayName=i;this.icon=s;this.kind=r.Kind}static{this.Kind="tool"}get text(){return`${rk}${this.toolName}`}get promptText(){return this.text}toVariableEntry(){return{kind:"tool",id:this.toolId,name:this.toolName,range:this.range,value:void 0,icon:ut.isThemeIcon(this.icon)?this.icon:void 0,fullName:this.displayName}}},Xw=class r{constructor(t,e,n,o,i,s){this.range=t;this.editorRange=e;this.id=n;this.name=o;this.icon=i;this.tools=s;this.kind=r.Kind}static{this.Kind="toolset"}get text(){return`${rk}${this.name}`}get promptText(){return this.text}toVariableEntry(){return{kind:"toolset",id:this.id,name:this.name,range:this.range,icon:this.icon,value:this.tools}}},Zw=class r{constructor(t,e,n){this.range=t;this.editorRange=e;this.agent=n;this.kind=r.Kind}static{this.Kind="agent"}get text(){return`${UG}${this.agent.name}`}get promptText(){return""}},ek=class r{constructor(t,e,n){this.range=t;this.editorRange=e;this.command=n;this.kind=r.Kind}static{this.Kind="subcommand"}get text(){return`${py}${this.command.name}`}get promptText(){return""}},tk=class r{constructor(t,e,n){this.range=t;this.editorRange=e;this.slashCommand=n;this.kind=r.Kind}static{this.Kind="slash"}get text(){return`${py}${this.slashCommand.command}`}get promptText(){return`${py}${this.slashCommand.command}`}},nk=class r{constructor(t,e,n){this.range=t;this.editorRange=e;this.name=n;this.kind=r.Kind}static{this.Kind="prompt"}get text(){return`${py}${this.name}`}get promptText(){return`${py}${this.name}`}},ok=class r{constructor(t,e,n,o,i,s,a,l,d,c){this.range=t;this.editorRange=e;this.text=n;this.id=o;this.modelDescription=i;this.data=s;this.fullName=a;this.icon=l;this.isFile=d;this.isDirectory=c;this.kind=r.Kind}static{this.Kind="dynamic"}get referenceText(){return this.text.replace(rk,"")}get promptText(){return this.text}toVariableEntry(){return this.id==="vscode.problems"?sv.toEntry(this.data.filter):{kind:this.isDirectory?"directory":this.isFile?"file":"generic",id:this.id,name:this.referenceText,range:this.range,value:this.data,fullName:this.fullName,icon:this.icon}}};function a5(r){return{text:r.text,parts:r.parts.map(t=>{if(t.kind===Df.Kind)return new Df(new ko(t.range.start,t.range.endExclusive),t.editorRange,t.text);if(t.kind===Jw.Kind)return new Jw(new ko(t.range.start,t.range.endExclusive),t.editorRange,t.variableName,t.variableArg,t.variableId||"");if(t.kind===Yw.Kind)return new Yw(new ko(t.range.start,t.range.endExclusive),t.editorRange,t.toolName,t.toolId,t.displayName,t.icon);if(t.kind===Xw.Kind)return new Xw(new ko(t.range.start,t.range.endExclusive),t.editorRange,t.id,t.name,t.icon,t.tools??[]);if(t.kind===Zw.Kind){let e=t.agent;return e=zw(e),new Zw(new ko(t.range.start,t.range.endExclusive),t.editorRange,e)}else{if(t.kind===ek.Kind)return new ek(new ko(t.range.start,t.range.endExclusive),t.editorRange,t.command);if(t.kind===tk.Kind)return new tk(new ko(t.range.start,t.range.endExclusive),t.editorRange,t.slashCommand);if(t.kind===nk.Kind)return new nk(new ko(t.range.start,t.range.endExclusive),t.editorRange,t.name);if(t.kind===ok.Kind)return new ok(new ko(t.range.start,t.range.endExclusive),t.editorRange,t.text,t.id,t.modelDescription,ht(t.data),t.fullName,t.icon,t.isFile,t.isDirectory);throw new Error(`Unknown chat request part: ${t.kind}`)}})}}var c5;(t=>{function r(e){return{variables:e.variables.map(kl.toExport)}}t.toExport=r})(c5||={});var Gi={reason:"other"},ik=class{constructor(t){this._shouldBeBlocked=to(this,!1);this._version=0;this._session=t.session,this.message=t.message,this._variableData=t.variableData,this.timestamp=t.timestamp,this._attempt=t.attempt??0,this.modeInfo=t.modeInfo,this._confirmation=t.confirmation,this._locationData=t.locationData,this._attachedContext=t.attachedContext,this.isCompleteAddedRequest=t.isCompleteAddedRequest??!1,this.modelId=t.modelId,this.id=t.restoredId??"request_"+Ae(),this._editedFileEvents=t.editedFileEvents,this.userSelectedTools=t.userSelectedTools}get shouldBeBlocked(){return this._shouldBeBlocked}setShouldBeBlocked(t){this._shouldBeBlocked.set(t,void 0)}get session(){return this._session}get attempt(){return this._attempt}get variableData(){return this._variableData}set variableData(t){this._version++,this._variableData=t}get confirmation(){return this._confirmation}get locationData(){return this._locationData}get attachedContext(){return this._attachedContext}get editedFileEvents(){return this._editedFileEvents}get version(){return this._version}adoptTo(t){this._session=t}},sk=class{get value(){return this._responseParts}constructor(t){this._responseParts=t}toString(){return this._responseRepr===void 0&&(this._responseRepr=this.computeRepr()),this._responseRepr}getMarkdown(){return this._markdownContent===void 0&&(this._markdownContent=this.computeMarkdownContent()),this._markdownContent}getFinalResponse(){let t=this._responseParts,e=t.length-1;for(;e>=0;){let s=t[e];if(s.kind==="markdownContent"||s.kind==="markdownVuln"){if(s.content.value.length>0)break}else if(s.kind==="inlineReference")break;e--}if(e<0)return"";let n=e;for(;e>=0;){let s=t[e];if(s.kind==="markdownContent"||s.kind==="markdownVuln"||s.kind==="inlineReference")e--;else break}let o=e+1,i=[];for(let s=o;s<=n;s++){let a=t[s];a.kind==="inlineReference"?i.push(this.inlineRefToRepr(a)):(a.kind==="markdownContent"||a.kind==="markdownVuln")&&a.content.value.length>0&&i.push(a.content.value)}return i.join("")}_invalidateRepr(){this._responseRepr=void 0,this._markdownContent=void 0}computeMarkdownContent(){let t=[];for(let e of this._responseParts)e.kind==="inlineReference"?t.push(this.inlineRefToRepr(e)):(e.kind==="markdownContent"||e.kind==="markdownVuln")&&e.content.value.length>0&&t.push(e.content.value);return t.join("")}computeRepr(){return this.partsToRepr(this._responseParts)}partsToRepr(t){let e=[],n=[],o=!1;for(let i of t){let s;switch(i.kind){case"clearToPreviousToolInvocation":n=[],e.length=0,o=!1;continue;case"treeData":case"progressMessage":case"codeblockUri":case"extensions":case"pullRequest":case"undoStop":case"workspaceEdit":case"elicitation2":case"elicitationSerialized":case"thinking":case"hook":case"multiDiffData":case"mcpServersStarting":case"questionCarousel":case"disabledClaudeHooks":continue;case"toolInvocation":case"toolInvocationSerialized":s=this.getToolInvocationText(i);break;case"inlineReference":s={text:this.inlineRefToRepr(i)};break;case"command":s={text:i.command.title,isBlock:!0};break;case"textEditGroup":case"notebookEditGroup":o=!0;continue;case"confirmation":if(i.message instanceof Bt){s={text:`${i.title}
${i.message.value}`,isBlock:!0};break}s={text:`${i.title}
${i.message}`,isBlock:!0};break;case"markdownContent":case"markdownVuln":case"progressTask":case"progressTaskSerialized":case"warning":s={text:i.content.value};break;default:continue}s.isBlock?(n.length&&(e.push(n.join("")),n=[]),e.push(s.text)):n.push(s.text)}return n.length&&e.push(n.join("")),o&&e.push(p(8242,null)),e.join(`

`)}inlineRefToRepr(t){return"uri"in t.inlineReference?this.uriToRepr(t.inlineReference.uri):"name"in t.inlineReference?"`"+t.inlineReference.name+"`":this.uriToRepr(t.inlineReference)}getToolInvocationText(t){let e="",n="";if(t.pastTenseMessage?e=typeof t.pastTenseMessage=="string"?t.pastTenseMessage:t.pastTenseMessage.value:e=typeof t.invocationMessage=="string"?t.invocationMessage:t.invocationMessage.value,t.toolSpecificData&&t.toolSpecificData.kind==="terminal"){e="Ran terminal command";let i=s5(t.toolSpecificData);n=i.commandLine.userEdited??i.commandLine.toolEdited??i.commandLine.original}let o=e;if(n&&(o+=`: ${n}`),t.kind==="toolInvocationSerialized"||t.kind==="toolInvocation"&&_t.isComplete(t)){let i=_t.resultDetails(t);if(i&&"input"in i){let s=t.kind==="toolInvocationSerialized"||_t.isComplete(t)?"Completed":"Errored";o+=`
${s} with input: ${i.input}`}}return{text:o,isBlock:!0}}uriToRepr(t){return t.scheme===V.http||t.scheme===V.https?t.toString(!1):Tt(t)}},oO=class extends sk{constructor(e,n){let o=e.value.findIndex(i=>i.kind==="undoStop"&&i.id===n);e.value[o+1]?.kind==="codeblockUri"&&e.value[o-1]?.kind==="markdownContent"&&o--;super(o===-1?e.value.slice():e.value.slice(0,o));this.undoStop=n}},rO=class extends sk{constructor(e){super(Dn(e).map(n=>"kind"in n?n:Uo(n)?{content:n,kind:"markdownContent"}:{kind:"treeData",treeData:n}));this._onDidChangeValue=new E;this._citations=[]}get onDidChangeValue(){return this._onDidChangeValue.event}dispose(){this._onDidChangeValue.dispose()}clear(){this._responseParts=[],this._contentChanged(!0)}clearToPreviousToolInvocation(e){let n=-1;for(let o=this._responseParts.length-1;o>=0;o--){let i=this._responseParts[o];if(i.kind==="toolInvocation"||i.kind==="toolInvocationSerialized"){n=o;break}}n!==-1?this._responseParts=this._responseParts.slice(0,n+1):this._responseParts=[],e&&this._responseParts.push({kind:"warning",content:new Bt(e)}),this._contentChanged(!0)}updateContent(e,n){if(e.kind==="clearToPreviousToolInvocation"){e.reason===2?this.clearToPreviousToolInvocation(p(8241,null)):e.reason===1?this.clearToPreviousToolInvocation(p(8243,null)):this.clearToPreviousToolInvocation();return}else if(e.kind==="markdownContent"){let o=this._responseParts.filter(i=>i.kind!=="textEditGroup").at(-1);if(!o||o.kind!=="markdownContent"||!l5(o.content,e.content))this._responseParts.push(e);else{let i=this._responseParts.indexOf(o);this._responseParts[i]={...o,content:d5(o.content,e.content)}}this._contentChanged(n)}else if(e.kind==="thinking"){let o=this._responseParts.filter(l=>l.kind!=="textEditGroup").at(-1),i=o&&o.kind==="thinking"?Array.isArray(o.value)?o.value.join(""):o.value||"":"",s=Array.isArray(e.value)?e.value.join(""):e.value||"",a=l=>l.length===0;if(!o||o.kind!=="thinking"||a(s)||a(i)||!l5(new Bt(i),new Bt(s)))this._responseParts.push(e);else{let l=this._responseParts.indexOf(o);this._responseParts[l]={...o,value:d5(new Bt(i),new Bt(s)).value}}this._contentChanged(n)}else if(e.kind==="textEdit"||e.kind==="notebookEdit"){let o=Mv.parse(e.uri)?.notebook,i=o??e.uri,s=e.isExternalEdit;if(e.kind==="textEdit"&&!o)this._mergeOrPushTextEditGroup(i,e.edits,e.done,s);else if(e.kind==="textEdit"){let a=e.edits.map(l=>({uri:e.uri,edit:l}));this._mergeOrPushNotebookEditGroup(i,a,e.done,s)}else this._mergeOrPushNotebookEditGroup(i,e.edits,e.done,s);this._contentChanged(n)}else if(e.kind==="progressTask"){let o=this._responseParts.push(e)-1;this._contentChanged(n);let i=e.onDidAddProgress(()=>{this._contentChanged(!1)});e.task?.().then(s=>{i.dispose(),typeof s=="string"&&(this._responseParts[o].content=new Bt(s)),this._contentChanged(!1)})}else e.kind==="toolInvocation"?(gv(o=>{e.state.read(o),this._contentChanged(!1),_t.isComplete(e,o)&&o.dispose()}),this._responseParts.push(e),this._contentChanged(n)):e.kind==="externalToolInvocationUpdate"?(this._handleExternalToolInvocationUpdate(e),this._contentChanged(n)):(this._responseParts.push(e),this._contentChanged(n))}addCitation(e){this._citations.push(e),this._contentChanged()}_mergeOrPushTextEditGroup(e,n,o,i){for(let s of this._responseParts)if(s.kind==="textEditGroup"&&!s.done&&Ro(s.uri,e)){s.edits.push(n),s.done=o;return}this._responseParts.push({kind:"textEditGroup",uri:e,edits:[n],done:o,isExternalEdit:i})}_mergeOrPushNotebookEditGroup(e,n,o,i){for(let s of this._responseParts)if(s.kind==="notebookEditGroup"&&!s.done&&Ro(s.uri,e)){s.edits.push(n),s.done=o;return}this._responseParts.push({kind:"notebookEditGroup",uri:e,edits:[n],done:o,isExternalEdit:i})}_handleExternalToolInvocationUpdate(e){let n=this._responseParts.findLast(s=>s.kind==="toolInvocation"&&s.toolCallId===e.toolCallId);if(n){e.toolSpecificData!==void 0&&(n.toolSpecificData=e.toolSpecificData),e.isComplete&&n.didExecuteTool({content:[],toolResultMessage:e.pastTenseMessage,toolResultError:e.errorMessage,toolResultDetails:e.resultDetails});return}let o={id:e.toolName,source:kn.External,displayName:e.toolName,modelDescription:e.toolName},i=new Qw({invocationMessage:e.invocationMessage,pastTenseMessage:e.pastTenseMessage,toolSpecificData:e.toolSpecificData},o,e.toolCallId,e.subagentInvocationId,void 0,{},void 0);e.isComplete&&(e.toolSpecificData!==void 0&&(i.toolSpecificData=e.toolSpecificData),i.didExecuteTool({content:[],toolResultMessage:e.pastTenseMessage,toolResultError:e.errorMessage,toolResultDetails:e.resultDetails})),this._responseParts.push(i)}computeRepr(){let e=super.computeRepr();return this._citations.length&&(e+=`

`+HG(this._citations)),e}_contentChanged(e){this._invalidateRepr(),e||this._onDidChangeValue.fire()}},Rf=class extends O{constructor(e){super();this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._modelState=to(this,{value:0});this._shouldBeBlocked=to(this,!1);this._contentReferences=[];this._codeCitations=[];this._progressMessages=[];this._isStale=!1;this._session=e.session,this._agent=e.agent,this._slashCommand=e.slashCommand,this.requestId=e.requestId,this._timestamp=e.timestamp||Date.now(),e.modelState&&this._modelState.set(e.modelState,void 0),this._timeSpentWaitingAccumulator=e.timeSpentWaiting||0,this._vote=e.vote,this._result=e.result,this._followups=e.followups?[...e.followups]:void 0,this.isCompleteAddedRequest=e.isCompleteAddedRequest??!1,this._shouldBeRemovedOnSend=e.shouldBeRemovedOnSend,this._shouldBeBlocked.set(e.shouldBeBlocked??!1,void 0),this._isStale=Array.isArray(e.responseContent)&&(e.responseContent.length!==0||Uo(e.responseContent)&&e.responseContent.value.length!==0),this._response=this._register(new rO(e.responseContent)),this._codeBlockInfos=e.codeBlockInfos?[...e.codeBlockInfos]:void 0;let n=hv(this,this.onDidChange),o=n.map((a,l)=>{n.read(l);for(let d of this._response.value){if(d.kind==="toolInvocation"){let c=d.state.read(l);if(c.type===_t.StateKind.WaitingForConfirmation){let u=c.confirmationMessages?.title;return u?Uo(u)?u.value:u:void 0}if(c.type===_t.StateKind.WaitingForPostApproval)return p(8245,null)}if(d.kind==="confirmation"&&!d.isUsed)return d.title;if(d.kind==="questionCarousel"&&!d.isUsed)return p(8244,null);if(d.kind==="elicitation2"&&d.state.read(l)==="pending"){let c=d.title;return Uo(c)?c.value:c}}}),i=o.map(a=>!!a).map(a=>a?Date.now():void 0);this.isPendingConfirmation=i.map((a,l)=>a?{startedWaitingAt:a,detail:o.read(l)}:void 0),this.isInProgress=n.map((a,l)=>(n.read(l),!o.read(l)&&!this.shouldBeRemovedOnSend&&(this._modelState.read(l).value===0||this._modelState.read(l).value===4))),this._register(this._response.onDidChangeValue(()=>this._onDidChange.fire(Gi))),this.id=e.restoredId??"response_"+Ae();let s;this.confirmationAdjustedTimestamp=Ei(a=>{let l=this.isPendingConfirmation.read(a);return l?(this._modelState.set({value:4},void 0),s||(s=l.startedWaitingAt)):s&&(this._modelState.read(a).value===4&&this._modelState.set({value:0},void 0),this._timeSpentWaitingAccumulator+=Date.now()-s,s=void 0),this._timestamp+this._timeSpentWaitingAccumulator}).recomputeInitiallyAndOnChange(this._store)}get shouldBeBlocked(){return this._shouldBeBlocked}get request(){return this.session.getRequests().find(e=>e.id===this.requestId)}get session(){return this._session}get shouldBeRemovedOnSend(){return this._shouldBeRemovedOnSend}get isComplete(){return this._modelState.get().value!==0&&this._modelState.get().value!==4}get timestamp(){return this._timestamp}set shouldBeRemovedOnSend(e){this._shouldBeRemovedOnSend!==e&&(this._shouldBeRemovedOnSend=e,this._onDidChange.fire(Gi))}get isCanceled(){return this._modelState.get().value===2}get completedAt(){let e=this._modelState.get();if(e.value===1||e.value===2||e.value===3)return e.completedAt}get state(){let e=this._modelState.get().value;return e===1&&this._result?.errorDetails&&this.result?.errorDetails?.code!=="canceled"?3:e}get stateT(){return this._modelState.get()}get vote(){return this._vote}get followups(){return this._followups}get entireResponse(){return this._finalizedResponse||this._response}get result(){return this._result}get usage(){return this._usage}get username(){return this.session.responderUsername}get agent(){return this._agent}get slashCommand(){return this._slashCommand}get agentOrSlashCommandDetected(){return this._agentOrSlashCommandDetected??!1}get usedContext(){return this._usedContext}get contentReferences(){return Array.from(this._contentReferences)}get codeCitations(){return this._codeCitations}get progressMessages(){return this._progressMessages}get isStale(){return this._isStale}get response(){let e=this._shouldBeRemovedOnSend?.afterUndoStop;return e?(this._responseView?.undoStop!==e&&(this._responseView=new oO(this._response,e)),this._responseView):this._finalizedResponse||this._response}get codeBlockInfos(){return this._codeBlockInfos}initializeCodeBlockInfos(e){if(this._codeBlockInfos)throw new Pt("Code block infos have already been initialized");this._codeBlockInfos=[...e]}setBlockedState(e){this._shouldBeBlocked.set(e,void 0)}updateContent(e,n){this._response.updateContent(e,n)}addUndoStop(e){this._onDidChange.fire({reason:"undoStop",id:e.id}),this._response.updateContent(e,!0)}applyReference(e){e.kind==="usedContext"?this._usedContext=e:e.kind==="reference"&&(this._contentReferences.push(e),this._onDidChange.fire(Gi))}applyCodeCitation(e){this._codeCitations.push(e),this._response.addCitation(e),this._onDidChange.fire(Gi)}setAgent(e,n){this._agent=e,this._slashCommand=n,this._agentOrSlashCommandDetected=!e.isDefault||!!n,this._onDidChange.fire(Gi)}setResult(e){this._result=e,this._onDidChange.fire(Gi)}setUsage(e){this._usage=e,this._onDidChange.fire(Gi)}complete(){if(this.isComplete)return;this._result?.errorDetails?.responseIsRedacted&&this._response.clear();let e=this._result?.errorDetails&&this._result.errorDetails.code!=="canceled"?3:1;this._modelState.set({value:e,completedAt:Date.now()},void 0),this._onDidChange.fire({reason:"completedRequest"})}cancel(){this._modelState.set({value:2,completedAt:Date.now()},void 0),this._onDidChange.fire({reason:"completedRequest"})}setFollowups(e){this._followups=e,this._onDidChange.fire(Gi)}setVote(e){this._vote=e,this._onDidChange.fire(Gi)}setEditApplied(e,n){return!this.response.value.includes(e)||!e.state?!1:(e.state.applied=n,this._onDidChange.fire(Gi),!0)}adoptTo(e){this._session=e,this._onDidChange.fire(Gi)}finalizeUndoState(){this._finalizedResponse=this.response,this._responseView=void 0,this._shouldBeRemovedOnSend=void 0}toJSON(){let e=this._modelState.get(),n=this.isPendingConfirmation.get();return{responseId:this.id,result:this.result,responseMarkdownInfo:this.codeBlockInfos?.map(o=>({suggestionId:o.suggestionId})),followups:this.followups,modelState:e.value===0||e.value===4?{value:2,completedAt:Date.now()}:e,vote:this.vote,slashCommand:this.slashCommand,usedContext:this.usedContext,contentReferences:this.contentReferences,codeCitations:this.codeCitations,timestamp:this._timestamp,timeSpentWaiting:(n?Date.now()-n.startedWaitingAt:0)+this._timeSpentWaitingAccumulator}}};function u5(r){return!!r&&Array.isArray(r.requests)&&typeof r.responderUsername=="string"}function FG(r){let t=r;return u5(r)&&typeof t.creationDate=="number"&&typeof t.sessionId=="string"&&r.requests.every(e=>!e.usedContext||EB(e.usedContext))}var iO=class{constructor(t){this._state=Tc({debugName:"inputModelState",equalsFn:qt},t),this.state=this._state}setState(t){let e=this._state.get();this._state.set({attachments:[],mode:{id:"agent",kind:"agent"},selectedModel:void 0,inputText:"",selections:[],contrib:{},...e,...t},void 0)}clearState(){this._state.set(void 0,void 0)}toJSON(){let t=this.state.get();if(!t)return;let e=t.attachments.filter(n=>!(tH(n)||eH(n)&&rH(n.value)));return{contrib:t.contrib,attachments:e.map(kl.toExport),mode:t.mode,selectedModel:t.selectedModel?{identifier:t.selectedModel.identifier,metadata:t.selectedModel.metadata}:void 0,inputText:t.inputText,selections:t.selections,permissionLevel:t.permissionLevel}}},Af=class extends O{constructor(e,n,o,i,s,a){super();this.logService=o;this.chatAgentService=i;this.chatEditingService=s;this.chatService=a;this._onDidDispose=this._register(new E);this.onDidDispose=this._onDidDispose.event;this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._pendingRequests=[];this._onDidChangePendingRequests=this._register(new E);this.onDidChangePendingRequests=this._onDidChangePendingRequests.event;this._isImported=!1;this._canUseTools=!0;this.currentEditedFileEvents=new Ke;this._checkpoint=void 0;let l=e?.value,d=u5(l),c=d&&FG(l);l&&!d&&this.logService.warn(`ChatModel#constructor: Loaded malformed session data: ${JSON.stringify(l)}`),this._isImported=!!l&&d&&!c,n.resource?(this._sessionId=wl(n.resource),this._sessionResource=n.resource):c?(this._sessionId=l.sessionId,this._sessionResource=Qr.forSession(l.sessionId)):(this._sessionId=Ae(),this._sessionResource=Qr.forSession(this._sessionId)),this._disableBackgroundKeepAlive=n.disableBackgroundKeepAlive??!1,this._requests=l?this._deserialize(l):[],this._timestamp=c&&l.creationDate||Date.now(),this._customTitle=c?l.customTitle:void 0;let u=n.inputState||(c&&l.inputState?l.inputState:void 0);if(this.inputModel=new iO(u&&{attachments:(u.attachments??[]).map(kl.fromExport),mode:u.mode,selectedModel:u.selectedModel&&{identifier:u.selectedModel.identifier,metadata:u.selectedModel.metadata},contrib:u.contrib,inputText:u.inputText,selections:u.selections,permissionLevel:u.permissionLevel}),this.dataSerializer=e?.serializer,this._initialResponderUsername=l?.responderUsername,this._repoData=c&&l.repoData?l.repoData:void 0,c&&l.pendingRequests&&(this._pendingRequests=this._deserializePendingRequests(l.pendingRequests)),this._initialLocation=l?.initialLocation??n.initialLocation,this._canUseTools=n.canUseTools,this.lastRequestObs=xo(this,this.onDidChange,()=>this._requests.at(-1)),this._register(Vo(m=>{let g=this.lastRequestObs.read(m);g?.response&&m.store.add(g.response.onDidChange(async h=>{!this._editingSession||h.reason!=="completedRequest"||this._onDidChange.fire({kind:"completedRequest",request:g})}))})),this.requestInProgress=this.lastRequestObs.map((m,g)=>m?.response?.isInProgress.read(g)??!1),this.requestNeedsInput=this.lastRequestObs.map((m,g)=>{let h=m?.response?.isPendingConfirmation.read(g);if(h)return{title:this.title,detail:h.detail}}),this.initialLocation==="panel"&&!n.disableBackgroundKeepAlive){let m=this._register(new sn);this._register(Vo(g=>{let h=this.requestInProgress.read(g),f=this.requestNeedsInput.read(g),I=h||!!f;I&&!m.value?m.value=a.acquireExistingSession(this._sessionResource):!I&&m.value&&m.clear()}))}}static getDefaultTitle(e){let n=e.at(0)?.message??"";return(typeof n=="string"?n:n.text).split(`
`)[0].substring(0,200)}get contributedChatSession(){return this._contributedChatSession}setContributedChatSession(e){this._contributedChatSession=e}get repoData(){return this._repoData}setRepoData(e){this._repoData=e}getPendingRequests(){return this._pendingRequests}setPendingRequests(e){let n=new Map(this._pendingRequests.map(i=>[i.request.id,i])),o=[];for(let{requestId:i,kind:s}of e){let a=n.get(i);a&&o.push(a.kind===s?a:{request:a.request,kind:s,sendOptions:a.sendOptions})}this._pendingRequests.length=0,this._pendingRequests.push(...o),this._onDidChangePendingRequests.fire()}addPendingRequest(e,n,o){let i={request:e,kind:n,sendOptions:o};if(n==="steering"){let s=0;for(let a=0;a<this._pendingRequests.length&&this._pendingRequests[a].kind==="steering";a++)s=a+1;this._pendingRequests.splice(s,0,i)}else this._pendingRequests.push(i);return this._onDidChangePendingRequests.fire(),i}removePendingRequest(e){let n=this._pendingRequests.findIndex(o=>o.request.id===e);n!==-1&&(this._pendingRequests.splice(n,1),this._onDidChangePendingRequests.fire())}dequeuePendingRequest(){let e=this._pendingRequests.shift();return e&&this._onDidChangePendingRequests.fire(),e}dequeueAllSteeringRequests(){let e=[];for(;this._pendingRequests.at(0)?.kind==="steering";)e.push(this._pendingRequests.shift());return e.length>0&&this._onDidChangePendingRequests.fire(),e}clearPendingRequests(){this._pendingRequests.length>0&&(this._pendingRequests.length=0,this._onDidChangePendingRequests.fire())}get sessionId(){return this._sessionId}get sessionResource(){return this._sessionResource}get hasRequests(){return this._requests.length>0}get lastRequest(){return this._requests.at(-1)}get timestamp(){return this._timestamp}get timing(){let e=this._requests.at(-1),n=e?.response,o=e?.timestamp,i=n?.completedAt??n?.timestamp;return{created:this._timestamp,lastRequestStarted:o,lastRequestEnded:i}}get lastMessageDate(){return this._requests.at(-1)?.timestamp??this._timestamp}get _defaultAgent(){return this.chatAgentService.getDefaultAgent("panel","ask")}get responderUsername(){return this._defaultAgent?.fullName??this._initialResponderUsername??""}get isImported(){return this._isImported}get customTitle(){return this._customTitle}get title(){return this._customTitle||Af.getDefaultTitle(this._requests)}get hasCustomTitle(){return this._customTitle!==void 0}get editingSession(){return this._editingSession}get initialLocation(){return this._initialLocation}get canUseTools(){return this._canUseTools}get willKeepAlive(){return!this._disableBackgroundKeepAlive}startEditingSession(e,n){let o=this._editingSession??=this._register(n?this.chatEditingService.transferEditingSession(this,n):e?this.chatEditingService.startOrContinueGlobalEditingSession(this):this.chatEditingService.createEditingSession(this));if(!this._disableBackgroundKeepAlive){let i=this._register(new sn);this._register(Vo(s=>{let a=o.entries.read(s).some(l=>l.state.read(s)===0);a&&!i.value?i.value=this.chatService.acquireExistingSession(this._sessionResource):!a&&i.value&&i.clear()}))}this._register(Vo(i=>{this._setDisabledRequests(o.requestDisablement.read(i))}))}notifyEditingAction(e){let n=e.outcome==="accepted"?1:e.outcome==="rejected"?2:e.outcome==="userModified"?3:null;n!==null&&(!this.currentEditedFileEvents.has(e.uri)||this.currentEditedFileEvents.get(e.uri)?.eventKind===1)&&this.currentEditedFileEvents.set(e.uri,{eventKind:n,uri:e.uri})}_deserialize(e){let n=so(e,{serializer:!0})?e.value.requests:e.requests;if(!Array.isArray(n))return this.logService.error(`Ignoring malformed session data: ${JSON.stringify(e)}`),[];try{return n.map(o=>this._deserializeRequest(o))}catch(o){return this.logService.error("Failed to parse chat data",o),[]}}_deserializeRequest(e){let n=typeof e.message=="string"?this.getParsedRequestFromString(e.message):a5(e.message),o=this.reviveVariableData(e.variableData),i=new ik({session:this,message:n,variableData:o,timestamp:e.timestamp??-1,restoredId:e.requestId,confirmation:e.confirmation,editedFileEvents:e.editedFileEvents,modelId:e.modelId,modeInfo:e.modeInfo});if(i.shouldBeRemovedOnSend=e.isHidden?{requestId:e.requestId}:e.shouldBeRemovedOnSend,e.response||e.result||e.responseErrorDetails){let s=e.agent&&"metadata"in e.agent?zw(e.agent):void 0,a="responseErrorDetails"in e?{errorDetails:e.responseErrorDetails}:e.result,l=e.modelState||{value:e.isCanceled?2:1,completedAt:Date.now()};if((l.value===0||l.value===4)&&(l={value:2,completedAt:Date.now()}),e.response)for(let d of e.response)so(d,{kind:!0})&&d.kind==="questionCarousel"&&(d.isUsed=!0);i.response=new Rf({responseContent:e.response??[new Bt(e.response)],session:this,agent:s,slashCommand:e.slashCommand,requestId:i.id,modelState:l,vote:e.vote,timestamp:e.timestamp,result:a,followups:e.followups,restoredId:e.responseId,timeSpentWaiting:e.timeSpentWaiting,shouldBeBlocked:i.shouldBeBlocked.get(),codeBlockInfos:e.responseMarkdownInfo?.map(d=>({suggestionId:d.suggestionId}))}),i.response.shouldBeRemovedOnSend=e.isHidden?{requestId:e.requestId}:e.shouldBeRemovedOnSend,e.usedContext&&i.response.applyReference(ht(e.usedContext)),e.contentReferences?.forEach(d=>i.response.applyReference(ht(d))),e.codeCitations?.forEach(d=>i.response.applyCodeCitation(ht(d)))}return i}reviveVariableData(e){let n=e&&Array.isArray(e.variables)?e:{variables:[]};return n.variables=n.variables.map(kl.fromExport),n}getParsedRequestFromString(e){let n=[new Df(new ko(0,e.length),{startColumn:1,startLineNumber:1,endColumn:1,endLineNumber:1},e)];return{text:e,parts:n}}_deserializePendingRequests(e){try{return e.map(n=>({id:n.id,request:this._deserializeRequest(n.request),kind:n.kind,sendOptions:{...n.sendOptions,userSelectedTools:n.sendOptions.userSelectedTools?Op(n.sendOptions.userSelectedTools):void 0}}))}catch(n){return this.logService.error("Failed to parse pending chat requests",n),[]}}getRequests(){return this._requests}resetCheckpoint(){for(let e of this._requests)e.setShouldBeBlocked(!1),e.response&&e.response.setBlockedState(!1)}setCheckpoint(e){let n,o=-1;if(!(e!==void 0&&(this._requests.forEach((i,s)=>{i.id===e&&(o=s,n=i,i.setShouldBeBlocked(!0))}),!n))){for(let i=this._requests.length-1;i>=0;i-=1){let s=this._requests[i];this._checkpoint&&!n?(s.setShouldBeBlocked(!1),s.response&&s.response.setBlockedState(!1)):n&&i>=o?(s.setShouldBeBlocked(!0),s.response&&s.response.setBlockedState(!0)):n&&i<o&&(s.setShouldBeBlocked(!1),s.response&&s.response.setBlockedState(!1))}this._checkpoint=n}}get checkpoint(){return this._checkpoint}_setDisabledRequests(e){this._requests.forEach(n=>{let o=e.find(i=>i.requestId===n.id);n.shouldBeRemovedOnSend=o,n.response&&(n.response.shouldBeRemovedOnSend=o)}),this._onDidChange.fire({kind:"setHidden"})}addRequest(e,n,o,i,s,a,l,d,c,u,m,g,h){let f=[...this.currentEditedFileEvents.values()];this.currentEditedFileEvents.clear();let I=new ik({restoredId:h,session:this,message:e,variableData:n,timestamp:Date.now(),attempt:o,modeInfo:i,confirmation:l,locationData:d,attachedContext:c,isCompleteAddedRequest:u,modelId:m,editedFileEvents:f.length?f:void 0,userSelectedTools:g});return I.response=new Rf({responseContent:[],session:this,agent:s,slashCommand:a,requestId:I.id,isCompleteAddedRequest:u,codeBlockInfos:void 0}),this._requests.push(I),uy(this.sessionResource,cy.RequestUiUpdated),this._onDidChange.fire({kind:"addRequest",request:I}),I}setCustomTitle(e){this._customTitle=e,this._onDidChange.fire({kind:"setCustomTitle",title:e})}updateRequest(e,n){e.variableData=n,this._onDidChange.fire({kind:"changedRequest",request:e})}adoptRequest(e){let n=e.session,o=n._requests.findIndex(i=>i.id===e.id);o!==-1&&(n._requests.splice(o,1),e.adoptTo(this),e.response?.adoptTo(this),this._requests.push(e),n._onDidChange.fire({kind:"removeRequest",requestId:e.id,responseId:e.response?.id,reason:2}),this._onDidChange.fire({kind:"addRequest",request:e}))}acceptResponseProgress(e,n,o){if(e.response||(e.response=new Rf({responseContent:[],session:this,requestId:e.id,codeBlockInfos:void 0})),e.response.isComplete)throw new Error("acceptResponseProgress: Adding progress to a completed response");n.kind==="usedContext"||n.kind==="reference"?e.response.applyReference(n):n.kind==="codeCitation"?e.response.applyCodeCitation(n):n.kind==="move"?this._onDidChange.fire({kind:"move",target:n.uri,range:n.range}):n.kind==="codeblockUri"&&n.isEdit?(e.response.addUndoStop({id:n.undoStopId??Ae(),kind:"undoStop"}),e.response.updateContent(n,o)):n.kind==="progressTaskResult"?this.logService.error(`Couldn't handle progress: ${JSON.stringify(n)}`):e.response.updateContent(n,o)}removeRequest(e,n=0){let o=this._requests.findIndex(s=>s.id===e),i=this._requests[o];o!==-1&&(this._onDidChange.fire({kind:"removeRequest",requestId:i.id,responseId:i.response?.id,reason:n}),this._requests.splice(o,1),i.response?.dispose())}cancelRequest(e){e.response&&e.response.cancel()}setResponse(e,n){e.response||(e.response=new Rf({responseContent:[],session:this,requestId:e.id,codeBlockInfos:void 0})),e.response.setResult(n)}setFollowups(e,n){e.response&&e.response.setFollowups(n)}setResponseModel(e,n){e.response=n,this._onDidChange.fire({kind:"addResponse",response:n})}toExport(){return{responderUsername:this.responderUsername,initialLocation:this.initialLocation,requests:this._requests.map(e=>{let n={...e.message,parts:e.message.parts.map(s=>s&&"toJSON"in s?s.toJSON():s)},o=e.response?.agent,i=o&&"toJSON"in o?o.toJSON():o?{...o}:void 0;return{requestId:e.id,message:n,variableData:c5.toExport(e.variableData),response:e.response?e.response.entireResponse.value.map(s=>s.kind==="treeData"?s.treeData:s.kind==="markdownContent"?s.content:s):void 0,shouldBeRemovedOnSend:e.shouldBeRemovedOnSend,agent:i,timestamp:e.timestamp,confirmation:e.confirmation,editedFileEvents:e.editedFileEvents,modelId:e.modelId,modeInfo:e.modeInfo,...e.response?.toJSON()}})}}toJSON(){return{version:3,...this.toExport(),sessionId:this.sessionId,creationDate:this._timestamp,customTitle:this._customTitle,inputState:this.inputModel.toJSON()}}dispose(){this._requests.forEach(e=>e.response?.dispose()),this._onDidDispose.fire(),super.dispose()}};Af=_([C(2,oe),C(3,$w),C(4,i5),C(5,$s)],Af);function l5(r,t){if(r.baseUri&&t.baseUri){if(!(r.baseUri.scheme===t.baseUri.scheme&&r.baseUri.authority===t.baseUri.authority&&r.baseUri.path===t.baseUri.path&&r.baseUri.query===t.baseUri.query&&r.baseUri.fragment===t.baseUri.fragment))return!1}else if(r.baseUri||t.baseUri)return!1;return qt(r.isTrusted,t.isTrusted)&&r.supportHtml===t.supportHtml&&r.supportThemeIcons===t.supportThemeIcons}function d5(r,t){let e=typeof t=="string"?t:t.value;return{value:r.value+e,isTrusted:r.isTrusted,supportThemeIcons:r.supportThemeIcons,supportHtml:r.supportHtml,baseUri:r.baseUri}}function HG(r){if(r.length===0)return"";let t=r.reduce((n,o)=>n.add(o.license),new Set);return t.size===1?p(8239,null,t.size):p(8240,null,t.size)}var ak;(n=>{n.scheme="vscode-chat-response-resource";function t(o,i,s,a){return b.from({scheme:n.scheme,authority:gl(H.fromString(o.toString())),path:`/tool/${i}/${s}`+(a?`/${a}`:"")})}n.createUri=t;function e(o){if(o.scheme!==n.scheme)return;let i=o.path.split("/");if(i.length<4)return;let[,s,a,l]=i;if(s!=="tool")return;let d;try{d=b.parse(kh(o.authority).toString())}catch(c){if(c instanceof SyntaxError)d=Qr.forSession(o.authority);else throw c}return{sessionResource:d,toolCallId:a,index:Number(l)}}n.parseUri=e})(ak||={});function WG(r,t){if(r===t)return!0;let[e,n]=r.split("/"),[o]=t.split("/");return n==="*"&&e===o}function sO(r,t){let e=nt(r);for(let[n,o]of Object.entries(t))if(nr(n,r)||nr(n,e))return o}function p5(r,t){for(let[e,n]of Object.entries(t))if(WG(e,r))return n}function VG(r){return typeof r=="object"&&r!==null&&"output"in r&&typeof r.output=="object"&&r.output?.type==="data"&&typeof r.output?.mimeType=="string"}function m5(r,t,e,n){let o=[],i=new Set;for(let s of r.value){if(s.kind==="codeblockUri"){let a=s.uri,l=a.toString();if(i.has(l))continue;let d=sO(a.path,n);d&&(i.add(l),o.push({label:Tt(a),uri:l,type:"plan",groupName:d.groupName,onlyShowGroup:d.onlyShowGroup}))}if(s.kind==="textEditGroup"){let a=s.uri,l=a.toString();if(i.has(l))continue;let d=sO(a.path,n);d&&(i.add(l),o.push({label:Tt(a),uri:l,type:"plan",groupName:d.groupName,onlyShowGroup:d.onlyShowGroup}))}if(s.kind==="workspaceEdit")for(let a of s.edits){let l=a.newResource??a.oldResource;if(!l)continue;let d=l.toString();if(i.has(d))continue;let c=sO(l.path,n);c&&(i.add(d),o.push({label:Tt(l),uri:d,type:"plan",groupName:c.groupName,onlyShowGroup:c.onlyShowGroup}))}if(s.kind==="toolInvocation"||s.kind==="toolInvocationSerialized"){let a=_t.resultDetails(s);if(!a)continue;if(UH(a))for(let l=0;l<a.output.length;l++){let d=a.output[l];if(d.type==="embed"&&!d.isText&&d.mimeType){let c=p5(d.mimeType,e);if(c){let u=`${s.toolCallId}:${l}`;if(!i.has(u)){i.add(u);let m=_R(d.mimeType),g=m?`file${m}`:"file.bin",h=ak.createUri(t,s.toolCallId,l,g);o.push({label:d.uri?.path.split("/").pop()??`${c.groupName} ${l+1}`,uri:h.toString(),toolCallId:s.toolCallId,dataPartIndex:l,type:"screenshot",groupName:c.groupName,onlyShowGroup:c.onlyShowGroup})}}}}if(VG(a)){let l=p5(a.output.mimeType,e);if(l){let d=`${s.toolCallId}:0`;if(!i.has(d)){i.add(d);let c=_R(a.output.mimeType),u=c?`file${c}`:"file.bin",m=ak.createUri(t,s.toolCallId,0,u);o.push({label:`${l.groupName}`,uri:m.toString(),toolCallId:s.toolCallId,dataPartIndex:0,type:"screenshot",groupName:l.groupName,onlyShowGroup:l.onlyShowGroup})}}}}}return o}var g5=R("chatArtifactsService"),my=class{constructor(t){this._memento=new wf("chat-artifacts",t)}get(t){return this._memento.getMemento(1,1)[t]||[]}set(t,e){let n=this._memento.getMemento(1,1);n[t]=e,this._memento.saveMemento()}delete(t){let e=this._memento.getMemento(1,1);delete e[t],this._memento.saveMemento()}};my=_([C(0,Sr)],my);var aO=class extends O{constructor(e,n,o){super();this.mutable=Op(!1);this._responseCache=new Map;let i=xo(this,o.onDidChangeConfiguration,()=>o.getValue("chat.artifacts.rules.byMimeType")??{}),s=xo(this,o.onDidChangeConfiguration,()=>o.getValue("chat.artifacts.rules.byFilePath")??{}),a=xo(this,n.onDidCreateModel,()=>n.getSession(e));this.artifacts=Ei(l=>{let d=i.read(l),c=s.read(l),u=a.read(l);if(!u)return[];hv(this,u.onDidChange).read(l);let g=u.getRequests(),h=[],f=new Set,I=new Set;for(let S of g){let T=S.response;if(!T)continue;f.add(T.id);let P=T.response,L=P.value.length,q=0;for(let G of P.value)(G.kind==="toolInvocation"||G.kind==="toolInvocationSerialized")&&_t.resultDetails(G)!==void 0&&q++;let N=this._responseCache.get(T.id),B;N&&N.partsLength===L&&N.completedToolCount===q&&N.byMimeType===d&&N.byFilePath===c?B=N.artifacts:(B=m5(P,e,d,c),this._responseCache.set(T.id,{partsLength:L,completedToolCount:q,byMimeType:d,byFilePath:c,artifacts:B}));for(let G of B){let J=G.toolCallId?`${G.toolCallId}:${G.dataPartIndex}`:G.uri;if(I.has(J)){let Y=h.findIndex(re=>re.toolCallId?`${re.toolCallId}:${re.dataPartIndex}`===J:re.uri===J);Y!==-1&&h.splice(Y,1)}I.add(J),h.push(G)}}for(let S of this._responseCache.keys())f.has(S)||this._responseCache.delete(S);return h})}set(){throw new Error("Artifacts are not mutable in rules mode")}clear(){throw new Error("Artifacts are not mutable in rules mode")}migrate(){}},lO=class{constructor(t,e){this._storageKey=t;this._storage=e;this.mutable=Op(!0);this._artifacts=Tc({owner:this,equalsFn:()=>!1},[]);this.artifacts=this._artifacts;this._artifacts.set(this._storage.get(this._storageKey),void 0)}set(t){this._artifacts.set(t,void 0),this._storage.set(this._storageKey,t)}clear(){this._artifacts.set([],void 0),this._storage.set(this._storageKey,[])}migrate(t){let e=this._artifacts.get();e.length>0&&t.mutable.get()&&t.set([...e]),this._artifacts.set([],void 0),this._storage.delete(this._storageKey)}},dO=class extends O{constructor(t,e,n,o,i){super(),this._rules=this._register(new aO(t,o,i)),this._storage=new lO(e,n);let s=xo(this,i.onDidChangeConfiguration,()=>i.getValue("chat.artifacts.mode")??"rules");this._active=Ei(a=>s.read(a)==="tool"?this._storage:this._rules),this.mutable=Ei(a=>this._active.read(a).mutable.read(a)),this.artifacts=Ei(a=>this._active.read(a).artifacts.read(a))}set(t){this._active.get().set(t)}clear(){this._active.get().clear()}migrate(t){this._storage.migrate(t)}},lk=class extends O{constructor(e,n,o){super();this._chatService=n;this._configurationService=o;this._instances=this._register(new Fn);this._storage=new my(e)}getArtifacts(e){let n=wl(e),o=this._instances.get(n);return o||(o=new dO(e,n,this._storage,this._chatService,this._configurationService),this._instances.set(n,o)),o}};lk=_([C(0,Sr),C(1,$s),C(2,Kt)],lk);var BG="setArtifacts",$G={type:"object",properties:{artifacts:{type:"array",description:"The complete list of artifacts for this session. Overwrites any existing artifacts.",items:{type:"object",properties:{label:{type:"string",description:"Display label for the artifact."},uri:{type:"string",description:"Fully qualified URI of the artifact (e.g. https://localhost:3000 or file:///path/to/file). Must include the scheme."},type:{type:"string",enum:["devServer","screenshot","plan"],description:"The type of artifact."}},required:["label"]}}},required:["artifacts"]},f5={id:BG,toolReferenceName:"artifacts",legacyToolReferenceFullNames:["Set Session Artifacts"],displayName:p(8667,null),modelDescription:`Set the list of artifacts for the current session. Each artifact has a label and either a uri or a toolCallId+dataPartIndex reference, plus an optional type (devServer, screenshot, plan). This overwrites the entire artifact list. URIs must be fully qualified with a scheme (e.g. https://localhost:3000, file:///tmp/plan.md). To reference a screenshot or image from a previous tool result, use toolCallId and dataPartIndex instead of uri.

When to use this tool:
- When creating or updating a plan saved to session memory \u2014 set a plan artifact so the user can view it in the artifact panel
- When taking screenshots or producing visual output \u2014 set a screenshot artifact to surface the image
- When starting a dev server \u2014 set a devServer artifact with the URL so the user can access it
- When producing important documents, drafts, or temporary markdown files \u2014 set an artifact to make them easily accessible
- After verification steps that produce visual results \u2014 update artifacts with screenshots showing the outcome

Workflow:
- Prefer artifacts over printing long content inline in chat. Save content to a file or memory, then set an artifact pointing to it.
- When updating plans or documents, update both the underlying file AND the artifact list.
- Keep artifact labels concise and descriptive.`,canBeReferencedInPrompt:!0,source:kn.Internal,inputSchema:$G},Mf=class{constructor(t,e){this._chatArtifactsService=t;this._fileService=e}async prepareToolInvocation(t,e){return{pastTenseMessage:new Bt(p(8668,null)),presentation:"hidden"}}async invoke(t,e,n,o){let i=t.parameters,s=t.context?.sessionResource;if(!s)return{content:[{kind:"text",value:"Error: No session resource available"}]};let a=[];for(let l of i.artifacts??[]){let d=l.uri;if(d||(d=""),d){let c=b.parse(d);if(c.scheme!=="http"&&c.scheme!=="https"&&!await this._fileService.exists(c))throw new Error(p(8670,null,d))}a.push({label:l.label,uri:d,type:l.type})}return this._chatArtifactsService.getArtifacts(s).set(a),{content:[{kind:"text",value:p(8669,null,a.length)}]}}};Mf=_([C(0,g5),C(1,da)],Mf);var zG="task_complete";var h5={id:zG,displayName:"Task Complete",modelDescription:`Signal that the user's task is fully done. You MUST call this tool when your work is complete \u2014 whether you made code changes, answered a question, or completed any other kind of task. Provide a brief summary of what was accomplished. Do not restate the summary in your message text \u2014 it is shown to the user directly.

IMPORTANT: Before calling this tool, you MUST output a brief text message summarizing what was done. The task is not complete until both your summary message AND this tool call are present.

When to call:
- After answering the user's question or completing a conversational request
- After you have completed ALL requested changes
- After verifying results: tests pass, terminal commands succeeded, tool calls returned expected output

When NOT to call:
- If a terminal command failed or produced unexpected output
- If an MCP or external tool call returned an error
- If you encountered errors you have not resolved
- If there are remaining steps to complete
- If you have not verified your changes work`,source:kn.Internal,inputSchema:{type:"object",properties:{summary:{type:"string",description:"Brief summary of what was accomplished. Omit for trivial interactions."}}}},dk=class{async prepareToolInvocation(t,e){return{presentation:"hidden"}}async invoke(t,e,n,o){return{content:[{kind:"text",value:t.parameters?.summary??"All done!"}]}}};var ck=class extends O{static{this.ID="chat.builtinTools"}constructor(t,e,n){super();let o=e.createInstance(Tf);this._register(t.registerTool(WB,o));let i=this._register(e.createInstance(Ef));this._register(t.registerTool(YL,i)),this._register(t.vscodeToolSet.addTool(YL));let s=ZL(),a=this._register(e.createInstance(kf));this._register(t.registerTool(s,a));let l=e.createInstance(Fw);this._register(t.registerTool(KB,l)),this._register(t.registerTool(jB,l));let d=e.createInstance(Hw);this._register(t.registerTool(GB,d));let c=e.createInstance(dk);this._register(t.registerTool(h5,c));let u=e.createInstance(Mf),m=this._register(new sn),g=()=>{n.getValue("chat.artifacts.enabled")&&n.getValue("chat.artifacts.mode")==="tool"?m.value||(m.value=t.registerTool(f5,u)):m.clear()};g(),this._register(n.onDidChangeConfiguration(T=>{(T.affectsConfiguration("chat.artifacts.enabled")||T.affectsConfiguration("chat.artifacts.mode"))&&g()}));let h=this._register(e.createInstance(ji)),f,I,S=()=>{f?.dispose(),I?.dispose(),t.flushToolUpdates();let T=h.getToolData();f=t.registerTool(T,h),I=t.agentToolSet.addTool(T)};S(),this._register(h.onDidUpdateToolData(S)),this._register({dispose:()=>{f?.dispose(),I?.dispose()}})}};ck=_([C(0,wc),C(1,Jo),C(2,Kt)],ck);var v5="vscode_fetchWebPage_internal";var cO=R("commandService"),gy=new class{constructor(){this._commands=new Map;this._onDidRegisterCommand=new E;this.onDidRegisterCommand=this._onDidRegisterCommand.event}registerCommand(r,t){if(!r)throw new Error("invalid command");if(typeof r=="string"){if(!t)throw new Error("invalid command");return this.registerCommand({id:r,handler:t})}if(r.metadata&&Array.isArray(r.metadata.args)){let s=[];for(let l of r.metadata.args)s.push(l.constraint);let a=r.handler;r.handler=function(l,...d){return YN(d,s),a(l,...d)}}let{id:e}=r,n=this._commands.get(e);n||(n=new ao,this._commands.set(e,n));let o=n.unshift(r),i=K(()=>{o(),this._commands.get(e)?.isEmpty()&&this._commands.delete(e)});return this._onDidRegisterCommand.fire(e),lh(i)}registerCommandAlias(r,t){return gy.registerCommand(r,(e,...n)=>e.get(cO).executeCommand(t,...n))}getCommand(r){let t=this._commands.get(r);if(!(!t||t.isEmpty()))return Nt.first(t)}getCommands(){let r=new Map;for(let t of this._commands.keys()){let e=this.getCommand(t);e&&r.set(t,e)}return r}};gy.registerCommand("noop",()=>{});var fy=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(t,e){this._keyCodeToStr[t]=e,this._strToKeyCode[e.toLowerCase()]=t}keyCodeToStr(t){return this._keyCodeToStr[t]}strToKeyCode(t){return this._strToKeyCode[t.toLowerCase()]||0}},uk=new fy,uO=new fy,pO=new fy,qG=new Array(230),KG={},jG={},GG=[],QG=Object.create(null),JG=Object.create(null);var b5=[],mO=[];for(let r=0;r<=193;r++)b5[r]=-1;for(let r=0;r<=132;r++)mO[r]=-1;(function(){let t=[[1,0,"None",0,"unknown",0,"VK_UNKNOWN","",""],[1,1,"Hyper",0,"",0,"","",""],[1,2,"Super",0,"",0,"","",""],[1,3,"Fn",0,"",0,"","",""],[1,4,"FnLock",0,"",0,"","",""],[1,5,"Suspend",0,"",0,"","",""],[1,6,"Resume",0,"",0,"","",""],[1,7,"Turbo",0,"",0,"","",""],[1,8,"Sleep",0,"",0,"VK_SLEEP","",""],[1,9,"WakeUp",0,"",0,"","",""],[0,10,"KeyA",31,"A",65,"VK_A","",""],[0,11,"KeyB",32,"B",66,"VK_B","",""],[0,12,"KeyC",33,"C",67,"VK_C","",""],[0,13,"KeyD",34,"D",68,"VK_D","",""],[0,14,"KeyE",35,"E",69,"VK_E","",""],[0,15,"KeyF",36,"F",70,"VK_F","",""],[0,16,"KeyG",37,"G",71,"VK_G","",""],[0,17,"KeyH",38,"H",72,"VK_H","",""],[0,18,"KeyI",39,"I",73,"VK_I","",""],[0,19,"KeyJ",40,"J",74,"VK_J","",""],[0,20,"KeyK",41,"K",75,"VK_K","",""],[0,21,"KeyL",42,"L",76,"VK_L","",""],[0,22,"KeyM",43,"M",77,"VK_M","",""],[0,23,"KeyN",44,"N",78,"VK_N","",""],[0,24,"KeyO",45,"O",79,"VK_O","",""],[0,25,"KeyP",46,"P",80,"VK_P","",""],[0,26,"KeyQ",47,"Q",81,"VK_Q","",""],[0,27,"KeyR",48,"R",82,"VK_R","",""],[0,28,"KeyS",49,"S",83,"VK_S","",""],[0,29,"KeyT",50,"T",84,"VK_T","",""],[0,30,"KeyU",51,"U",85,"VK_U","",""],[0,31,"KeyV",52,"V",86,"VK_V","",""],[0,32,"KeyW",53,"W",87,"VK_W","",""],[0,33,"KeyX",54,"X",88,"VK_X","",""],[0,34,"KeyY",55,"Y",89,"VK_Y","",""],[0,35,"KeyZ",56,"Z",90,"VK_Z","",""],[0,36,"Digit1",22,"1",49,"VK_1","",""],[0,37,"Digit2",23,"2",50,"VK_2","",""],[0,38,"Digit3",24,"3",51,"VK_3","",""],[0,39,"Digit4",25,"4",52,"VK_4","",""],[0,40,"Digit5",26,"5",53,"VK_5","",""],[0,41,"Digit6",27,"6",54,"VK_6","",""],[0,42,"Digit7",28,"7",55,"VK_7","",""],[0,43,"Digit8",29,"8",56,"VK_8","",""],[0,44,"Digit9",30,"9",57,"VK_9","",""],[0,45,"Digit0",21,"0",48,"VK_0","",""],[1,46,"Enter",3,"Enter",13,"VK_RETURN","",""],[1,47,"Escape",9,"Escape",27,"VK_ESCAPE","",""],[1,48,"Backspace",1,"Backspace",8,"VK_BACK","",""],[1,49,"Tab",2,"Tab",9,"VK_TAB","",""],[1,50,"Space",10,"Space",32,"VK_SPACE","",""],[0,51,"Minus",88,"-",189,"VK_OEM_MINUS","-","OEM_MINUS"],[0,52,"Equal",86,"=",187,"VK_OEM_PLUS","=","OEM_PLUS"],[0,53,"BracketLeft",92,"[",219,"VK_OEM_4","[","OEM_4"],[0,54,"BracketRight",94,"]",221,"VK_OEM_6","]","OEM_6"],[0,55,"Backslash",93,"\\",220,"VK_OEM_5","\\","OEM_5"],[0,56,"IntlHash",0,"",0,"","",""],[0,57,"Semicolon",85,";",186,"VK_OEM_1",";","OEM_1"],[0,58,"Quote",95,"'",222,"VK_OEM_7","'","OEM_7"],[0,59,"Backquote",91,"`",192,"VK_OEM_3","`","OEM_3"],[0,60,"Comma",87,",",188,"VK_OEM_COMMA",",","OEM_COMMA"],[0,61,"Period",89,".",190,"VK_OEM_PERIOD",".","OEM_PERIOD"],[0,62,"Slash",90,"/",191,"VK_OEM_2","/","OEM_2"],[1,63,"CapsLock",8,"CapsLock",20,"VK_CAPITAL","",""],[1,64,"F1",59,"F1",112,"VK_F1","",""],[1,65,"F2",60,"F2",113,"VK_F2","",""],[1,66,"F3",61,"F3",114,"VK_F3","",""],[1,67,"F4",62,"F4",115,"VK_F4","",""],[1,68,"F5",63,"F5",116,"VK_F5","",""],[1,69,"F6",64,"F6",117,"VK_F6","",""],[1,70,"F7",65,"F7",118,"VK_F7","",""],[1,71,"F8",66,"F8",119,"VK_F8","",""],[1,72,"F9",67,"F9",120,"VK_F9","",""],[1,73,"F10",68,"F10",121,"VK_F10","",""],[1,74,"F11",69,"F11",122,"VK_F11","",""],[1,75,"F12",70,"F12",123,"VK_F12","",""],[1,76,"PrintScreen",0,"",0,"","",""],[1,77,"ScrollLock",84,"ScrollLock",145,"VK_SCROLL","",""],[1,78,"Pause",7,"PauseBreak",19,"VK_PAUSE","",""],[1,79,"Insert",19,"Insert",45,"VK_INSERT","",""],[1,80,"Home",14,"Home",36,"VK_HOME","",""],[1,81,"PageUp",11,"PageUp",33,"VK_PRIOR","",""],[1,82,"Delete",20,"Del",46,"VK_DELETE","Delete",""],[1,83,"End",13,"End",35,"VK_END","",""],[1,84,"PageDown",12,"PageDown",34,"VK_NEXT","",""],[1,85,"ArrowRight",17,"RightArrow",39,"VK_RIGHT","Right",""],[1,86,"ArrowLeft",15,"LeftArrow",37,"VK_LEFT","Left",""],[1,87,"ArrowDown",18,"DownArrow",40,"VK_DOWN","Down",""],[1,88,"ArrowUp",16,"UpArrow",38,"VK_UP","Up",""],[1,89,"NumLock",83,"NumLock",144,"VK_NUMLOCK","",""],[1,90,"NumpadDivide",113,"NumPad_Divide",111,"VK_DIVIDE","",""],[1,91,"NumpadMultiply",108,"NumPad_Multiply",106,"VK_MULTIPLY","",""],[1,92,"NumpadSubtract",111,"NumPad_Subtract",109,"VK_SUBTRACT","",""],[1,93,"NumpadAdd",109,"NumPad_Add",107,"VK_ADD","",""],[1,94,"NumpadEnter",3,"",0,"","",""],[1,95,"Numpad1",99,"NumPad1",97,"VK_NUMPAD1","",""],[1,96,"Numpad2",100,"NumPad2",98,"VK_NUMPAD2","",""],[1,97,"Numpad3",101,"NumPad3",99,"VK_NUMPAD3","",""],[1,98,"Numpad4",102,"NumPad4",100,"VK_NUMPAD4","",""],[1,99,"Numpad5",103,"NumPad5",101,"VK_NUMPAD5","",""],[1,100,"Numpad6",104,"NumPad6",102,"VK_NUMPAD6","",""],[1,101,"Numpad7",105,"NumPad7",103,"VK_NUMPAD7","",""],[1,102,"Numpad8",106,"NumPad8",104,"VK_NUMPAD8","",""],[1,103,"Numpad9",107,"NumPad9",105,"VK_NUMPAD9","",""],[1,104,"Numpad0",98,"NumPad0",96,"VK_NUMPAD0","",""],[1,105,"NumpadDecimal",112,"NumPad_Decimal",110,"VK_DECIMAL","",""],[0,106,"IntlBackslash",97,"OEM_102",226,"VK_OEM_102","",""],[1,107,"ContextMenu",58,"ContextMenu",93,"","",""],[1,108,"Power",0,"",0,"","",""],[1,109,"NumpadEqual",0,"",0,"","",""],[1,110,"F13",71,"F13",124,"VK_F13","",""],[1,111,"F14",72,"F14",125,"VK_F14","",""],[1,112,"F15",73,"F15",126,"VK_F15","",""],[1,113,"F16",74,"F16",127,"VK_F16","",""],[1,114,"F17",75,"F17",128,"VK_F17","",""],[1,115,"F18",76,"F18",129,"VK_F18","",""],[1,116,"F19",77,"F19",130,"VK_F19","",""],[1,117,"F20",78,"F20",131,"VK_F20","",""],[1,118,"F21",79,"F21",132,"VK_F21","",""],[1,119,"F22",80,"F22",133,"VK_F22","",""],[1,120,"F23",81,"F23",134,"VK_F23","",""],[1,121,"F24",82,"F24",135,"VK_F24","",""],[1,122,"Open",0,"",0,"","",""],[1,123,"Help",0,"",0,"","",""],[1,124,"Select",0,"",0,"","",""],[1,125,"Again",0,"",0,"","",""],[1,126,"Undo",0,"",0,"","",""],[1,127,"Cut",0,"",0,"","",""],[1,128,"Copy",0,"",0,"","",""],[1,129,"Paste",0,"",0,"","",""],[1,130,"Find",0,"",0,"","",""],[1,131,"AudioVolumeMute",117,"AudioVolumeMute",173,"VK_VOLUME_MUTE","",""],[1,132,"AudioVolumeUp",118,"AudioVolumeUp",175,"VK_VOLUME_UP","",""],[1,133,"AudioVolumeDown",119,"AudioVolumeDown",174,"VK_VOLUME_DOWN","",""],[1,134,"NumpadComma",110,"NumPad_Separator",108,"VK_SEPARATOR","",""],[0,135,"IntlRo",115,"ABNT_C1",193,"VK_ABNT_C1","",""],[1,136,"KanaMode",0,"",0,"","",""],[0,137,"IntlYen",0,"",0,"","",""],[1,138,"Convert",0,"",0,"","",""],[1,139,"NonConvert",0,"",0,"","",""],[1,140,"Lang1",0,"",0,"","",""],[1,141,"Lang2",0,"",0,"","",""],[1,142,"Lang3",0,"",0,"","",""],[1,143,"Lang4",0,"",0,"","",""],[1,144,"Lang5",0,"",0,"","",""],[1,145,"Abort",0,"",0,"","",""],[1,146,"Props",0,"",0,"","",""],[1,147,"NumpadParenLeft",0,"",0,"","",""],[1,148,"NumpadParenRight",0,"",0,"","",""],[1,149,"NumpadBackspace",0,"",0,"","",""],[1,150,"NumpadMemoryStore",0,"",0,"","",""],[1,151,"NumpadMemoryRecall",0,"",0,"","",""],[1,152,"NumpadMemoryClear",0,"",0,"","",""],[1,153,"NumpadMemoryAdd",0,"",0,"","",""],[1,154,"NumpadMemorySubtract",0,"",0,"","",""],[1,155,"NumpadClear",131,"Clear",12,"VK_CLEAR","",""],[1,156,"NumpadClearEntry",0,"",0,"","",""],[1,0,"",5,"Ctrl",17,"VK_CONTROL","",""],[1,0,"",4,"Shift",16,"VK_SHIFT","",""],[1,0,"",6,"Alt",18,"VK_MENU","",""],[1,0,"",57,"Meta",91,"VK_COMMAND","",""],[1,157,"ControlLeft",5,"",0,"VK_LCONTROL","",""],[1,158,"ShiftLeft",4,"",0,"VK_LSHIFT","",""],[1,159,"AltLeft",6,"",0,"VK_LMENU","",""],[1,160,"MetaLeft",57,"",0,"VK_LWIN","",""],[1,161,"ControlRight",5,"",0,"VK_RCONTROL","",""],[1,162,"ShiftRight",4,"",0,"VK_RSHIFT","",""],[1,163,"AltRight",6,"",0,"VK_RMENU","",""],[1,164,"MetaRight",57,"",0,"VK_RWIN","",""],[1,165,"BrightnessUp",0,"",0,"","",""],[1,166,"BrightnessDown",0,"",0,"","",""],[1,167,"MediaPlay",0,"",0,"","",""],[1,168,"MediaRecord",0,"",0,"","",""],[1,169,"MediaFastForward",0,"",0,"","",""],[1,170,"MediaRewind",0,"",0,"","",""],[1,171,"MediaTrackNext",124,"MediaTrackNext",176,"VK_MEDIA_NEXT_TRACK","",""],[1,172,"MediaTrackPrevious",125,"MediaTrackPrevious",177,"VK_MEDIA_PREV_TRACK","",""],[1,173,"MediaStop",126,"MediaStop",178,"VK_MEDIA_STOP","",""],[1,174,"Eject",0,"",0,"","",""],[1,175,"MediaPlayPause",127,"MediaPlayPause",179,"VK_MEDIA_PLAY_PAUSE","",""],[1,176,"MediaSelect",128,"LaunchMediaPlayer",181,"VK_MEDIA_LAUNCH_MEDIA_SELECT","",""],[1,177,"LaunchMail",129,"LaunchMail",180,"VK_MEDIA_LAUNCH_MAIL","",""],[1,178,"LaunchApp2",130,"LaunchApp2",183,"VK_MEDIA_LAUNCH_APP2","",""],[1,179,"LaunchApp1",0,"",0,"VK_MEDIA_LAUNCH_APP1","",""],[1,180,"SelectTask",0,"",0,"","",""],[1,181,"LaunchScreenSaver",0,"",0,"","",""],[1,182,"BrowserSearch",120,"BrowserSearch",170,"VK_BROWSER_SEARCH","",""],[1,183,"BrowserHome",121,"BrowserHome",172,"VK_BROWSER_HOME","",""],[1,184,"BrowserBack",122,"BrowserBack",166,"VK_BROWSER_BACK","",""],[1,185,"BrowserForward",123,"BrowserForward",167,"VK_BROWSER_FORWARD","",""],[1,186,"BrowserStop",0,"",0,"VK_BROWSER_STOP","",""],[1,187,"BrowserRefresh",0,"",0,"VK_BROWSER_REFRESH","",""],[1,188,"BrowserFavorites",0,"",0,"VK_BROWSER_FAVORITES","",""],[1,189,"ZoomToggle",0,"",0,"","",""],[1,190,"MailReply",0,"",0,"","",""],[1,191,"MailForward",0,"",0,"","",""],[1,192,"MailSend",0,"",0,"","",""],[1,0,"",114,"KeyInComposition",229,"","",""],[1,0,"",116,"ABNT_C2",194,"VK_ABNT_C2","",""],[1,0,"",96,"OEM_8",223,"VK_OEM_8","",""],[1,0,"",0,"",0,"VK_KANA","",""],[1,0,"",0,"",0,"VK_HANGUL","",""],[1,0,"",0,"",0,"VK_JUNJA","",""],[1,0,"",0,"",0,"VK_FINAL","",""],[1,0,"",0,"",0,"VK_HANJA","",""],[1,0,"",0,"",0,"VK_KANJI","",""],[1,0,"",0,"",0,"VK_CONVERT","",""],[1,0,"",0,"",0,"VK_NONCONVERT","",""],[1,0,"",0,"",0,"VK_ACCEPT","",""],[1,0,"",0,"",0,"VK_MODECHANGE","",""],[1,0,"",0,"",0,"VK_SELECT","",""],[1,0,"",0,"",0,"VK_PRINT","",""],[1,0,"",0,"",0,"VK_EXECUTE","",""],[1,0,"",0,"",0,"VK_SNAPSHOT","",""],[1,0,"",0,"",0,"VK_HELP","",""],[1,0,"",0,"",0,"VK_APPS","",""],[1,0,"",0,"",0,"VK_PROCESSKEY","",""],[1,0,"",0,"",0,"VK_PACKET","",""],[1,0,"",0,"",0,"VK_DBE_SBCSCHAR","",""],[1,0,"",0,"",0,"VK_DBE_DBCSCHAR","",""],[1,0,"",0,"",0,"VK_ATTN","",""],[1,0,"",0,"",0,"VK_CRSEL","",""],[1,0,"",0,"",0,"VK_EXSEL","",""],[1,0,"",0,"",0,"VK_EREOF","",""],[1,0,"",0,"",0,"VK_PLAY","",""],[1,0,"",0,"",0,"VK_ZOOM","",""],[1,0,"",0,"",0,"VK_NONAME","",""],[1,0,"",0,"",0,"VK_PA1","",""],[1,0,"",0,"",0,"VK_OEM_CLEAR","",""]],e=[],n=[];for(let o of t){let[i,s,a,l,d,c,u,m,g]=o;if(n[s]||(n[s]=!0,GG[s]=a,QG[a]=s,JG[a.toLowerCase()]=s,i&&(b5[s]=l,l!==0&&l!==3&&!XG(l)&&(mO[l]=s))),!e[l]){if(e[l]=!0,!d)throw new Error(`String representation missing for key code ${l} around scan code ${a}`);uk.define(l,d),uO.define(l,m||d),pO.define(l,g||m||d)}c&&(qG[c]=l),a&&(jG[a]=c),u&&(KG[u]=l)}mO[3]=46})();var YG;(s=>{function r(a){return uk.keyCodeToStr(a)}s.toString=r;function t(a){return uk.strToKeyCode(a)}s.fromString=t;function e(a){return uO.keyCodeToStr(a)}s.toUserSettingsUS=e;function n(a){return pO.keyCodeToStr(a)}s.toUserSettingsGeneral=n;function o(a){return uO.strToKeyCode(a)||pO.strToKeyCode(a)}s.fromUserSettings=o;function i(a){if(a>=98&&a<=113)return null;switch(a){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right";case 20:return"Delete"}return uk.keyCodeToStr(a)}s.toElectronAccelerator=i})(YG||={});function XG(r){return r===5||r===4||r===6||r===57}function hy(r,t){if(typeof r=="number"){if(r===0)return null;let e=(r&65535)>>>0,n=(r&4294901760)>>>16;return n!==0?new Lf([pk(e,t),pk(n,t)]):new Lf([pk(e,t)])}else{let e=[];for(let n=0;n<r.length;n++)e.push(pk(r[n],t));return new Lf(e)}}function pk(r,t){let e=!!(r&2048),n=!!(r&256),o=t===2?n:e,i=!!(r&1024),s=!!(r&512),a=t===2?e:n,l=r&255;return new gO(o,i,s,a,l)}var gO=class r{constructor(t,e,n,o,i){this.ctrlKey=t;this.shiftKey=e;this.altKey=n;this.metaKey=o;this.keyCode=i}equals(t){return t instanceof r&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){let t=this.ctrlKey?"1":"0",e=this.shiftKey?"1":"0",n=this.altKey?"1":"0",o=this.metaKey?"1":"0";return`K${t}${e}${n}${o}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new Lf([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}};var Lf=class{constructor(t){if(t.length===0)throw Fe("chords");this.chords=t}getHashCode(){let t="";for(let e=0,n=this.chords.length;e<n;e++)e!==0&&(t+=";"),t+=this.chords[e].getHashCode();return t}equals(t){if(t===null||this.chords.length!==t.chords.length)return!1;for(let e=0;e<this.chords.length;e++)if(!this.chords[e].equals(t.chords[e]))return!1;return!0}};var fO=class r{constructor(){this._coreKeybindings=new ao,this._coreKeybindingRules=new ao,this._extensionKeybindings=[],this._cachedMergedKeybindings=null}static bindToPlatform(t,e){if(e===1){if(t&&t.win)return t.win}else if(e===2){if(t&&t.mac)return t.mac}else if(t&&t.linux)return t.linux;return t}static bindToCurrentPlatform(t){return r.bindToPlatform(t,lr)}registerKeybindingRule(t){let e=r.bindToCurrentPlatform(t),n=new $;if(e&&e.primary){let i=hy(e.primary,lr);i&&n.add(this._registerDefaultKeybinding(i,t.id,t.args,t.weight,0,t.when))}if(e&&Array.isArray(e.secondary))for(let i=0,s=e.secondary.length;i<s;i++){let a=e.secondary[i],l=hy(a,lr);l&&n.add(this._registerDefaultKeybinding(l,t.id,t.args,t.weight,-i-1,t.when))}let o=this._coreKeybindingRules.push(t);return n.add(K(()=>{o()})),n}setExtensionKeybindings(t){let e=[],n=0;for(let o of t)o.keybinding&&(e[n++]={keybinding:o.keybinding,command:o.id,commandArgs:o.args,when:o.when,weight1:o.weight,weight2:0,extensionId:o.extensionId||null,isBuiltinExtension:o.isBuiltinExtension||!1});this._extensionKeybindings=e,this._cachedMergedKeybindings=null}registerCommandAndKeybindingRule(t){return np(this.registerKeybindingRule(t),gy.registerCommand(t))}_registerDefaultKeybinding(t,e,n,o,i,s){let a=this._coreKeybindings.push({keybinding:t,command:e,commandArgs:n,when:s,weight1:o,weight2:i,extensionId:null,isBuiltinExtension:!1});return this._cachedMergedKeybindings=null,K(()=>{a(),this._cachedMergedKeybindings=null})}getDefaultKeybindings(){return this._cachedMergedKeybindings||(this._cachedMergedKeybindings=Array.from(this._coreKeybindings).concat(this._extensionKeybindings),this._cachedMergedKeybindings.sort(y5)),this._cachedMergedKeybindings.slice(0)}getDefaultKeybindingsForOS(t){let e=[];for(let n of this._coreKeybindingRules){let o=r.bindToPlatform(n,t);if(o&&o.primary){let i=hy(o.primary,t);i&&e.push({keybinding:i,command:n.id,commandArgs:n.args,when:n.when,weight1:n.weight,weight2:0,extensionId:null,isBuiltinExtension:!1})}if(o&&Array.isArray(o.secondary))for(let i=0,s=o.secondary.length;i<s;i++){let a=o.secondary[i],l=hy(a,t);l&&e.push({keybinding:l,command:n.id,commandArgs:n.args,when:n.when,weight1:n.weight,weight2:-i-1,extensionId:null,isBuiltinExtension:!1})}}return e.sort(y5),e}},I5=new fO,ZG={EditorModes:"platform.keybindingsRegistry"};vt.add(ZG.EditorModes,I5);function y5(r,t){if(r.weight1!==t.weight1)return r.weight1-t.weight1;if(r.command&&t.command){if(r.command<t.command)return-1;if(r.command>t.command)return 1}return r.weight2-t.weight2}function eQ(r){return r.command!==void 0}var Od=class r{static{this._instances=new Map}static{this.CommandPalette=new r("CommandPalette")}static{this.DebugBreakpointsContext=new r("DebugBreakpointsContext")}static{this.DebugCallStackContext=new r("DebugCallStackContext")}static{this.DebugConsoleContext=new r("DebugConsoleContext")}static{this.DebugVariablesContext=new r("DebugVariablesContext")}static{this.NotebookVariablesContext=new r("NotebookVariablesContext")}static{this.DebugHoverContext=new r("DebugHoverContext")}static{this.DebugWatchContext=new r("DebugWatchContext")}static{this.DebugToolBar=new r("DebugToolBar")}static{this.DebugToolBarStop=new r("DebugToolBarStop")}static{this.DebugDisassemblyContext=new r("DebugDisassemblyContext")}static{this.DebugCallStackToolbar=new r("DebugCallStackToolbar")}static{this.DebugCreateConfiguration=new r("DebugCreateConfiguration")}static{this.DebugScopesContext=new r("DebugScopesContext")}static{this.EditorContext=new r("EditorContext")}static{this.SimpleEditorContext=new r("SimpleEditorContext")}static{this.EditorContent=new r("EditorContent")}static{this.EditorLineNumberContext=new r("EditorLineNumberContext")}static{this.EditorContextCopy=new r("EditorContextCopy")}static{this.EditorContextPeek=new r("EditorContextPeek")}static{this.EditorContextShare=new r("EditorContextShare")}static{this.EditorTitle=new r("EditorTitle")}static{this.ModalEditorTitle=new r("ModalEditorTitle")}static{this.ModalEditorEditorTitle=new r("ModalEditorEditorTitle")}static{this.CompactWindowEditorTitle=new r("CompactWindowEditorTitle")}static{this.EditorTitleRun=new r("EditorTitleRun")}static{this.EditorTitleContext=new r("EditorTitleContext")}static{this.EditorTitleContextShare=new r("EditorTitleContextShare")}static{this.EmptyEditorGroup=new r("EmptyEditorGroup")}static{this.EmptyEditorGroupContext=new r("EmptyEditorGroupContext")}static{this.EditorTabsBarContext=new r("EditorTabsBarContext")}static{this.EditorTabsBarShowTabsSubmenu=new r("EditorTabsBarShowTabsSubmenu")}static{this.EditorTabsBarShowTabsZenModeSubmenu=new r("EditorTabsBarShowTabsZenModeSubmenu")}static{this.EditorActionsPositionSubmenu=new r("EditorActionsPositionSubmenu")}static{this.EditorSplitMoveSubmenu=new r("EditorSplitMoveSubmenu")}static{this.ExplorerContext=new r("ExplorerContext")}static{this.ExplorerContextShare=new r("ExplorerContextShare")}static{this.ExtensionContext=new r("ExtensionContext")}static{this.ExtensionEditorContextMenu=new r("ExtensionEditorContextMenu")}static{this.GlobalActivity=new r("GlobalActivity")}static{this.CommandCenter=new r("CommandCenter")}static{this.CommandCenterCenter=new r("CommandCenterCenter")}static{this.LayoutControlMenuSubmenu=new r("LayoutControlMenuSubmenu")}static{this.LayoutControlMenu=new r("LayoutControlMenu")}static{this.MenubarMainMenu=new r("MenubarMainMenu")}static{this.MenubarAppearanceMenu=new r("MenubarAppearanceMenu")}static{this.MenubarDebugMenu=new r("MenubarDebugMenu")}static{this.MenubarEditMenu=new r("MenubarEditMenu")}static{this.MenubarCopy=new r("MenubarCopy")}static{this.MenubarFileMenu=new r("MenubarFileMenu")}static{this.MenubarGoMenu=new r("MenubarGoMenu")}static{this.MenubarHelpMenu=new r("MenubarHelpMenu")}static{this.MenubarLayoutMenu=new r("MenubarLayoutMenu")}static{this.MenubarNewBreakpointMenu=new r("MenubarNewBreakpointMenu")}static{this.PanelAlignmentMenu=new r("PanelAlignmentMenu")}static{this.PanelPositionMenu=new r("PanelPositionMenu")}static{this.ActivityBarPositionMenu=new r("ActivityBarPositionMenu")}static{this.NotificationsCenterPositionMenu=new r("NotificationsCenterPositionMenu")}static{this.MenubarPreferencesMenu=new r("MenubarPreferencesMenu")}static{this.MenubarRecentMenu=new r("MenubarRecentMenu")}static{this.MenubarSelectionMenu=new r("MenubarSelectionMenu")}static{this.MenubarShare=new r("MenubarShare")}static{this.MenubarSwitchEditorMenu=new r("MenubarSwitchEditorMenu")}static{this.MenubarSwitchGroupMenu=new r("MenubarSwitchGroupMenu")}static{this.MenubarTerminalMenu=new r("MenubarTerminalMenu")}static{this.MenubarTerminalSuggestStatusMenu=new r("MenubarTerminalSuggestStatusMenu")}static{this.MenubarViewMenu=new r("MenubarViewMenu")}static{this.MenubarHomeMenu=new r("MenubarHomeMenu")}static{this.OpenEditorsContext=new r("OpenEditorsContext")}static{this.OpenEditorsContextShare=new r("OpenEditorsContextShare")}static{this.ProblemsPanelContext=new r("ProblemsPanelContext")}static{this.SCMInputBox=new r("SCMInputBox")}static{this.SCMChangeContext=new r("SCMChangeContext")}static{this.SCMResourceContext=new r("SCMResourceContext")}static{this.SCMResourceContextShare=new r("SCMResourceContextShare")}static{this.SCMResourceFolderContext=new r("SCMResourceFolderContext")}static{this.SCMResourceGroupContext=new r("SCMResourceGroupContext")}static{this.SCMSourceControl=new r("SCMSourceControl")}static{this.SCMSourceControlInline=new r("SCMSourceControlInline")}static{this.SCMSourceControlTitle=new r("SCMSourceControlTitle")}static{this.SCMHistoryTitle=new r("SCMHistoryTitle")}static{this.SCMHistoryItemContext=new r("SCMHistoryItemContext")}static{this.SCMHistoryItemChangeContext=new r("SCMHistoryItemChangeContext")}static{this.SCMHistoryItemRefContext=new r("SCMHistoryItemRefContext")}static{this.SCMArtifactGroupContext=new r("SCMArtifactGroupContext")}static{this.SCMArtifactContext=new r("SCMArtifactContext")}static{this.SCMQuickDiffDecorations=new r("SCMQuickDiffDecorations")}static{this.SCMTitle=new r("SCMTitle")}static{this.SearchContext=new r("SearchContext")}static{this.SearchActionMenu=new r("SearchActionContext")}static{this.StatusBarWindowIndicatorMenu=new r("StatusBarWindowIndicatorMenu")}static{this.StatusBarRemoteIndicatorMenu=new r("StatusBarRemoteIndicatorMenu")}static{this.StickyScrollContext=new r("StickyScrollContext")}static{this.TestItem=new r("TestItem")}static{this.TestItemGutter=new r("TestItemGutter")}static{this.TestProfilesContext=new r("TestProfilesContext")}static{this.TestMessageContext=new r("TestMessageContext")}static{this.TestMessageContent=new r("TestMessageContent")}static{this.TestPeekElement=new r("TestPeekElement")}static{this.TestPeekTitle=new r("TestPeekTitle")}static{this.TestCallStack=new r("TestCallStack")}static{this.TestCoverageFilterItem=new r("TestCoverageFilterItem")}static{this.TouchBarContext=new r("TouchBarContext")}static{this.TitleBar=new r("TitleBar")}static{this.TitleBarAdjacentCenter=new r("TitleBarAdjacentCenter")}static{this.TitleBarContext=new r("TitleBarContext")}static{this.TitleBarTitleContext=new r("TitleBarTitleContext")}static{this.TunnelContext=new r("TunnelContext")}static{this.TunnelPrivacy=new r("TunnelPrivacy")}static{this.TunnelProtocol=new r("TunnelProtocol")}static{this.TunnelPortInline=new r("TunnelInline")}static{this.TunnelTitle=new r("TunnelTitle")}static{this.TunnelLocalAddressInline=new r("TunnelLocalAddressInline")}static{this.TunnelOriginInline=new r("TunnelOriginInline")}static{this.ViewItemContext=new r("ViewItemContext")}static{this.ViewContainerTitle=new r("ViewContainerTitle")}static{this.ViewContainerTitleContext=new r("ViewContainerTitleContext")}static{this.ViewTitle=new r("ViewTitle")}static{this.ViewTitleContext=new r("ViewTitleContext")}static{this.CommentEditorActions=new r("CommentEditorActions")}static{this.CommentThreadTitle=new r("CommentThreadTitle")}static{this.CommentThreadActions=new r("CommentThreadActions")}static{this.CommentThreadAdditionalActions=new r("CommentThreadAdditionalActions")}static{this.CommentThreadTitleContext=new r("CommentThreadTitleContext")}static{this.CommentThreadCommentContext=new r("CommentThreadCommentContext")}static{this.CommentTitle=new r("CommentTitle")}static{this.CommentActions=new r("CommentActions")}static{this.CommentsViewThreadActions=new r("CommentsViewThreadActions")}static{this.InteractiveToolbar=new r("InteractiveToolbar")}static{this.InteractiveCellTitle=new r("InteractiveCellTitle")}static{this.InteractiveCellDelete=new r("InteractiveCellDelete")}static{this.InteractiveCellExecute=new r("InteractiveCellExecute")}static{this.InteractiveInputExecute=new r("InteractiveInputExecute")}static{this.InteractiveInputConfig=new r("InteractiveInputConfig")}static{this.ReplInputExecute=new r("ReplInputExecute")}static{this.IssueReporter=new r("IssueReporter")}static{this.NotebookToolbar=new r("NotebookToolbar")}static{this.NotebookToolbarContext=new r("NotebookToolbarContext")}static{this.NotebookStickyScrollContext=new r("NotebookStickyScrollContext")}static{this.NotebookCellTitle=new r("NotebookCellTitle")}static{this.NotebookCellDelete=new r("NotebookCellDelete")}static{this.NotebookCellInsert=new r("NotebookCellInsert")}static{this.NotebookCellBetween=new r("NotebookCellBetween")}static{this.NotebookCellListTop=new r("NotebookCellTop")}static{this.NotebookCellExecute=new r("NotebookCellExecute")}static{this.NotebookCellExecuteGoTo=new r("NotebookCellExecuteGoTo")}static{this.NotebookCellExecutePrimary=new r("NotebookCellExecutePrimary")}static{this.NotebookDiffCellInputTitle=new r("NotebookDiffCellInputTitle")}static{this.NotebookDiffDocumentMetadata=new r("NotebookDiffDocumentMetadata")}static{this.NotebookDiffCellMetadataTitle=new r("NotebookDiffCellMetadataTitle")}static{this.NotebookDiffCellOutputsTitle=new r("NotebookDiffCellOutputsTitle")}static{this.NotebookOutputToolbar=new r("NotebookOutputToolbar")}static{this.NotebookOutlineFilter=new r("NotebookOutlineFilter")}static{this.NotebookOutlineActionMenu=new r("NotebookOutlineActionMenu")}static{this.NotebookEditorLayoutConfigure=new r("NotebookEditorLayoutConfigure")}static{this.NotebookKernelSource=new r("NotebookKernelSource")}static{this.BulkEditTitle=new r("BulkEditTitle")}static{this.BulkEditContext=new r("BulkEditContext")}static{this.TimelineItemContext=new r("TimelineItemContext")}static{this.TimelineTitle=new r("TimelineTitle")}static{this.TimelineTitleContext=new r("TimelineTitleContext")}static{this.TimelineFilterSubMenu=new r("TimelineFilterSubMenu")}static{this.AccountsContext=new r("AccountsContext")}static{this.SidebarTitle=new r("SidebarTitle")}static{this.PanelTitle=new r("PanelTitle")}static{this.AuxiliaryBarTitle=new r("AuxiliaryBarTitle")}static{this.TerminalInstanceContext=new r("TerminalInstanceContext")}static{this.TerminalEditorInstanceContext=new r("TerminalEditorInstanceContext")}static{this.TerminalNewDropdownContext=new r("TerminalNewDropdownContext")}static{this.TerminalTabContext=new r("TerminalTabContext")}static{this.TerminalTabEmptyAreaContext=new r("TerminalTabEmptyAreaContext")}static{this.TerminalStickyScrollContext=new r("TerminalStickyScrollContext")}static{this.WebviewContext=new r("WebviewContext")}static{this.InlineCompletionsActions=new r("InlineCompletionsActions")}static{this.InlineEditsActions=new r("InlineEditsActions")}static{this.NewFile=new r("NewFile")}static{this.MergeInput1Toolbar=new r("MergeToolbar1Toolbar")}static{this.MergeInput2Toolbar=new r("MergeToolbar2Toolbar")}static{this.MergeBaseToolbar=new r("MergeBaseToolbar")}static{this.MergeInputResultToolbar=new r("MergeToolbarResultToolbar")}static{this.InlineSuggestionToolbar=new r("InlineSuggestionToolbar")}static{this.InlineEditToolbar=new r("InlineEditToolbar")}static{this.ChatContext=new r("ChatContext")}static{this.ChatCodeBlock=new r("ChatCodeblock")}static{this.ChatCompareBlock=new r("ChatCompareBlock")}static{this.ChatMessageTitle=new r("ChatMessageTitle")}static{this.ChatWelcomeContext=new r("ChatWelcomeContext")}static{this.ChatMessageFooter=new r("ChatMessageFooter")}static{this.ChatExecute=new r("ChatExecute")}static{this.ChatExecuteQueue=new r("ChatExecuteQueue")}static{this.ChatInput=new r("ChatInput")}static{this.ChatInputSecondary=new r("ChatInputSecondary")}static{this.ChatInputSide=new r("ChatInputSide")}static{this.ChatModePicker=new r("ChatModePicker")}static{this.ChatEditingWidgetToolbar=new r("ChatEditingWidgetToolbar")}static{this.ChatEditingSessionChangesToolbar=new r("ChatEditingSessionChangesToolbar")}static{this.ChatEditingSessionApplySubmenu=new r("ChatEditingSessionApplySubmenu")}static{this.ChatEditingSessionTitleToolbar=new r("ChatEditingSessionTitleToolbar")}static{this.ChatEditingSessionChangeToolbar=new r("ChatEditingSessionChangeToolbar")}static{this.ChatEditingSessionChangesVersionsSubmenu=new r("ChatEditingSessionChangesVersionsSubmenu")}static{this.ChatEditingSessionChangesFileHeaderToolbar=new r("ChatEditingSessionChangesFileHeaderToolbar")}static{this.ChatEditingEditorContent=new r("ChatEditingEditorContent")}static{this.ChatEditingEditorHunk=new r("ChatEditingEditorHunk")}static{this.ChatEditingDeletedNotebookCell=new r("ChatEditingDeletedNotebookCell")}static{this.ChatInputAttachmentToolbar=new r("ChatInputAttachmentToolbar")}static{this.ChatEditingWidgetModifiedFilesToolbar=new r("ChatEditingWidgetModifiedFilesToolbar")}static{this.ChatInputResourceAttachmentContext=new r("ChatInputResourceAttachmentContext")}static{this.ChatInputSymbolAttachmentContext=new r("ChatInputSymbolAttachmentContext")}static{this.ChatInlineResourceAnchorContext=new r("ChatInlineResourceAnchorContext")}static{this.ChatInlineSymbolAnchorContext=new r("ChatInlineSymbolAnchorContext")}static{this.ChatMessageCheckpoint=new r("ChatMessageCheckpoint")}static{this.ChatMessageRestoreCheckpoint=new r("ChatMessageRestoreCheckpoint")}static{this.ChatNewMenu=new r("ChatNewMenu")}static{this.ChatEditingCodeBlockContext=new r("ChatEditingCodeBlockContext")}static{this.ChatTitleBarMenu=new r("ChatTitleBarMenu")}static{this.ChatAttachmentsContext=new r("ChatAttachmentsContext")}static{this.ChatTipContext=new r("ChatTipContext")}static{this.ChatTipToolbar=new r("ChatTipToolbar")}static{this.ChatToolOutputResourceToolbar=new r("ChatToolOutputResourceToolbar")}static{this.ChatTextEditorMenu=new r("ChatTextEditorMenu")}static{this.ChatToolOutputResourceContext=new r("ChatToolOutputResourceContext")}static{this.ChatMultiDiffContext=new r("ChatMultiDiffContext")}static{this.ChatConfirmationMenu=new r("ChatConfirmationMenu")}static{this.ChatEditorInlineMenu=new r("ChatEditorInlineGutter")}static{this.ChatEditorInlineExecute=new r("ChatEditorInputExecute")}static{this.ChatEditorInlineInputSide=new r("ChatEditorInputSide")}static{this.InlineChatEditorAffordance=new r("InlineChatEditorAffordance")}static{this.InlineChatInput=new r("InlineChatInput")}static{this.AccessibleView=new r("AccessibleView")}static{this.MultiDiffEditorContent=new r("MultiDiffEditorContent")}static{this.MultiDiffEditorFileToolbar=new r("MultiDiffEditorFileToolbar")}static{this.DiffEditorHunkToolbar=new r("DiffEditorHunkToolbar")}static{this.DiffEditorSelectionToolbar=new r("DiffEditorSelectionToolbar")}static{this.BrowserNavigationToolbar=new r("BrowserNavigationToolbar")}static{this.BrowserActionsToolbar=new r("BrowserActionsToolbar")}static{this.AgentSessionsViewerFilterSubMenu=new r("AgentSessionsViewerFilterSubMenu")}static{this.AgentSessionsContext=new r("AgentSessionsContext")}static{this.AgentSessionSectionContext=new r("AgentSessionSectionContext")}static{this.AgentSessionsCreateSubMenu=new r("AgentSessionsCreateSubMenu")}static{this.AgentSessionsToolbar=new r("AgentSessionsToolbar")}static{this.AgentSessionItemToolbar=new r("AgentSessionItemToolbar")}static{this.AgentSessionSectionToolbar=new r("AgentSessionSectionToolbar")}static{this.AgentsTitleBarControlMenu=new r("AgentsTitleBarControlMenu")}static{this.ChatViewSessionTitleNavigationToolbar=new r("ChatViewSessionTitleNavigationToolbar")}static{this.ChatViewSessionTitleToolbar=new r("ChatViewSessionTitleToolbar")}static{this.ChatContextUsageActions=new r("ChatContextUsageActions")}static{this.MarkerHoverStatusBar=new r("MarkerHoverParticipant.StatusBar")}static for(t){return r._instances.get(t)??new r(t)}constructor(t){if(r._instances.has(t))throw new TypeError(`MenuId with identifier '${t}' already exists. Use MenuId.for(ident) or a unique identifier`);r._instances.set(t,this),this.id=t}},Rlt=R("menuService"),Uu=class r{constructor(t){this.id=t;this.has=e=>e===t}static{this._all=new Map}static for(t){let e=this._all.get(t);return e||(e=new r(t),this._all.set(t,e)),e}static merge(t){let e=new Set;for(let n of t)n instanceof r&&e.add(n.id);return e}},Alt=new class{constructor(){this._commands=new Map;this._menuItems=new Map;this._onDidChangeMenu=new oI({merge:Uu.merge});this.onDidChangeMenu=this._onDidChangeMenu.event}addCommand(r){return this._commands.set(r.id,r),this._onDidChangeMenu.fire(Uu.for(Od.CommandPalette)),lh(K(()=>{this._commands.delete(r.id)&&this._onDidChangeMenu.fire(Uu.for(Od.CommandPalette))}))}getCommand(r){return this._commands.get(r)}getCommands(){let r=new Map;return this._commands.forEach((t,e)=>r.set(e,t)),r}appendMenuItem(r,t){let e=this._menuItems.get(r);e||(e=new ao,this._menuItems.set(r,e));let n=e.push(t);return this._onDidChangeMenu.fire(Uu.for(r)),lh(K(()=>{n(),this._onDidChangeMenu.fire(Uu.for(r))}))}appendMenuItems(r){let t=new $;for(let{id:e,item:n}of r)t.add(this.appendMenuItem(e,n));return t}getMenuItems(r){let t;return this._menuItems.has(r)?t=[...this._menuItems.get(r)]:t=[],r===Od.CommandPalette&&this._appendImplicitItems(t),t}_appendImplicitItems(r){let t=new Set;for(let e of r)eQ(e)&&(t.add(e.command.id),e.alt&&t.add(e.alt.id));this._commands.forEach((e,n)=>{t.has(n)||r.push({command:e})})}};var Fu=class{constructor(t,e,n,o,i,s,a){this.hideActions=o;this.menuKeybinding=i;this._commandService=a;this.id=t.id,this.label=Fu.label(t,n),this.tooltip=(typeof t.tooltip=="string"?t.tooltip:t.tooltip?.value)??"",this.enabled=!t.precondition||s.contextMatchesRules(t.precondition),this.checked=void 0;let l;if(t.toggled){let d=t.toggled.condition?t.toggled:{condition:t.toggled};this.checked=s.contextMatchesRules(d.condition),this.checked&&d.tooltip&&(this.tooltip=typeof d.tooltip=="string"?d.tooltip:d.tooltip.value),this.checked&&ut.isThemeIcon(d.icon)&&(l=d.icon),this.checked&&d.title&&(this.label=typeof d.title=="string"?d.title:d.title.value)}l||(l=ut.isThemeIcon(t.icon)?t.icon:void 0),this.item=t,this.alt=e?new Fu(e,void 0,n,o,void 0,s,a):void 0,this._options=n,this.class=l&&ut.asClassName(l)}static label(t,e){return e?.renderShortTitle&&t.shortTitle?typeof t.shortTitle=="string"?t.shortTitle:t.shortTitle.value:typeof t.title=="string"?t.title:t.title.value}run(...t){let e=[];return this._options?.args?e=[...e,...this._options.args]:this._options?.arg&&(e=[...e,this._options.arg]),this._options?.shouldForwardArgs&&(e=[...e,...t]),this._commandService.executeCommand(this.id,...e)}};Fu=_([C(5,Oo),C(6,cO)],Fu);var Ult=R("IExtensionGalleryManifestService");var Glt=Qd(10700,"Extensions");var hO=R("extensionsWorkbenchService");var mk=class extends O{constructor(e,n){super();this.containers=e;this._register(n.onChange(this.update,this))}set extension(e){this.containers.forEach(n=>n.extension=e)}update(e){for(let n of this.containers)e&&n.extension?dW(n.extension.identifier,e.identifier)&&(n.extension.server&&e.server&&n.extension.server!==e.server?n.updateWhenCounterExtensionChanges&&n.update():n.extension=e):n.update()}};mk=_([C(1,hO)],mk);var Qlt=new w("defaultExtensionViews",!0),Jlt=new w("hasOutdatedExtensions",!1),Ylt=new w("hasGallery",!1),Xlt=new w("extensionsGalleryStatus","unavailable"),Zlt=new w("extensionResultListFocused ",!0),edt=new w("searchMcpServers",!1),tdt=new w("searchAgentPlugins",!1);var ndt=new Od("extensionsSearchActionsMenu"),odt=new Od("extensionsFilterSubMenu");var vO="vscode_searchExtensions_internal",Sdt={id:vO,toolReferenceName:"extensions",legacyToolReferenceFullNames:["extensions"],icon:ut.fromId(ce.extensions.id),displayName:p(10713,null),modelDescription:"This is a tool for browsing Visual Studio Code Extensions Marketplace. It allows the model to search for extensions and retrieve detailed information about them. The model should use this tool whenever it needs to discover extensions or resolve information about known ones. To use the tool, the model has to provide the category of the extensions, relevant search keywords, or known extension IDs. Note that search results may include false positives, so reviewing and filtering is recommended.",userDescription:p(10715,null),source:kn.Internal,inputSchema:{type:"object",properties:{category:{type:"string",description:"The category of extensions to search for",enum:KI},keywords:{type:"array",items:{type:"string"},description:"The keywords to search for"},ids:{type:"array",items:{type:"string"},description:"The ids of the extensions to search for"}}}},gk=class{constructor(t){this.extensionWorkbenchService=t}async invoke(t,e,n,o){let i=t.parameters;if(!i.keywords?.length&&!i.category&&!i.ids?.length)return{content:[{kind:"text",value:p(10714,null)}]};let s=new Map,a=c=>{for(let u of c)u.deprecationInfo||u.isMalicious||s.set(u.identifier.id.toLowerCase(),{id:u.identifier.id,name:u.displayName,description:u.description,installed:u.state===1,installCount:u.installCount??0,rating:u.rating??0,categories:u.categories??[],tags:u.gallery?.tags??[]})},l=async c=>{let u=await this.extensionWorkbenchService.queryGallery({text:c,pageSize:10,sortBy:"InstallCount"},o);u.firstPage.length&&a(u.firstPage)};if(i.ids?.length){let c=await this.extensionWorkbenchService.getExtensions(i.ids.map(u=>({id:u})),o);a(c)}if(i.keywords?.length)for(let c of i.keywords??[])if(c==="featured")await l("featured");else{let u=i.category?`category:"${i.category}"`:"";u=c?`${u} ${c}`.trim():u,await l(u)}else await l(`category:"${i.category}"`);let d=Array.from(s.values());return{content:[{kind:"text",value:`Here are the list of extensions:
${JSON.stringify(d)}
. Important: Use the following format to display extensions to the user because there is a renderer available to parse these extensions in this format and display them with all details. So, do not describe about the extensions to the user.
\`\`\`vscode-extensions
extensionId1,extensionId2
\`\`\`
.`}],toolResultDetails:{input:JSON.stringify(i),output:[{type:"embed",isText:!0,value:JSON.stringify(d.map(c=>c.id))}]}}}};gk=_([C(0,hO)],gk);var fk=class{constructor(t){this._data=t}update(t){this._data=t,this._apiObject=void 0,this._apiObjectWithChatParticipantAdditions=void 0}get data(){return this._data}get apiObject(){return this._apiObject||(this._apiObject=Object.freeze({name:this._data.id,description:this._data.modelDescription,inputSchema:this._data.inputSchema,tags:this._data.tags??[],source:void 0})),this._apiObject}get apiObjectWithChatParticipantAdditions(){return this._apiObjectWithChatParticipantAdditions||(this._apiObjectWithChatParticipantAdditions=Object.freeze({name:this._data.id,description:this._data.modelDescription,inputSchema:this._data.inputSchema,tags:this._data.tags??[],source:CM.to(this._data.source),fullReferenceName:this._data.fullReferenceName})),this._apiObjectWithChatParticipantAdditions}},hk=class{constructor(t,e){this._languageModels=e;this._registeredTools=new Map;this._tokenCountFuncs=new Map;this._allTools=new Map;this._proxy=t.getProxy(F.MainThreadLanguageModelTools),this._proxy.$getTools().then(n=>{for(let o of n)this._allTools.set(o.id,new fk(ht(o)))})}async $countTokensForInvocation(t,e,n){let o=this._tokenCountFuncs.get(t);if(!o)throw new Error(`Tool invocation call ${t} not found`);return await o(e,n)}async invokeTool(t,e,n,o){let i=typeof e=="string"?e:e.name,s=Ae();n.tokenizationOptions&&this._tokenCountFuncs.set(s,n.tokenizationOptions.countTokens);try{if(n.toolInvocationToken&&!NH(n.toolInvocationToken))throw new Error("Invalid tool invocation token");if((i===Nw||i===JL)&&!He(t,"chatParticipantPrivate"))throw new Error(`Invalid tool: ${i}`);let a=await this._proxy.$invokeTool({toolId:i,callId:s,parameters:n.input,tokenBudget:n.tokenizationOptions?.tokenBudget,context:n.toolInvocationToken,chatRequestId:He(t,"chatParticipantPrivate")?n.chatRequestId:void 0,chatInteractionId:He(t,"chatParticipantPrivate")?n.chatInteractionId:void 0,subAgentInvocationId:He(t,"chatParticipantPrivate")?n.subAgentInvocationId:void 0,chatStreamToolCallId:He(t,"chatParticipantAdditions")?n.chatStreamToolCallId:void 0,preToolUseResult:He(t,"chatParticipantPrivate")?n.preToolUseResult:void 0},o),l=a instanceof Gt?a.value:a;return CT.to(ht(l))}finally{this._tokenCountFuncs.delete(s)}}$onDidChangeTools(t){let e=new Set(this._allTools.keys());for(let n of t){e.delete(n.id);let o=this._allTools.get(n.id);o?o.update(n):this._allTools.set(n.id,new fk(ht(n)))}for(let n of e)this._allTools.delete(n)}getTools(t){let e=He(t,"chatParticipantPrivate");return Array.from(this._allTools.values()).map(n=>e?n.apiObjectWithChatParticipantAdditions:n.apiObject).filter(n=>{switch(n.name){case Nw:case JL:case v5:case vO:return He(t,"chatParticipantPrivate");default:return!0}})}async $invokeTool(t,e){let n=this._registeredTools.get(t.toolId);if(!n)throw new Error(`Unknown tool ${t.toolId}`);let o={input:t.parameters,toolInvocationToken:ht(t.context)};He(n.extension,"chatParticipantPrivate")&&(o.chatRequestId=t.chatRequestId,o.chatInteractionId=t.chatInteractionId,o.chatSessionResource=b.revive(t.context?.sessionResource),o.subAgentInvocationId=t.subAgentInvocationId),He(n.extension,"chatParticipantAdditions")&&t.modelId&&(o.model=await this.getModel(t.modelId,n.extension)),He(n.extension,"chatParticipantAdditions")&&t.chatStreamToolCallId&&(o.chatStreamToolCallId=t.chatStreamToolCallId),t.tokenBudget!==void 0&&(o.tokenizationOptions={tokenBudget:t.tokenBudget,countTokens:this._tokenCountFuncs.get(t.callId)||((a,l=ve.None)=>this._proxy.$countTokensForInvocation(t.callId,a,l))});let i;if(He(n.extension,"toolProgress")){let a;i={report:l=>{l.increment!==void 0&&(a=(a??0)+l.increment),this._proxy.$acceptToolProgress(t.callId,{message:ue.fromStrict(l.message),progress:a===void 0?void 0:a/100})}}}let s=await gp(Promise.resolve(n.tool.invoke(o,e,i)),e);if(!s)throw new Be;return CT.from(s,n.extension)}async getModel(t,e){let n;if(t&&(n=await this._languageModels.getLanguageModelByIdentifier(e,t)),!n&&(n=await this._languageModels.getDefaultLanguageModel(e),!n))throw new Error("Language model unavailable");return n}async $handleToolStream(t,e,n){let o=this._registeredTools.get(t);if(!o)throw new Error(`Unknown tool ${t}`);if(!o.tool.handleToolStream)return;A(o.extension,"chatParticipantAdditions");let i={rawInput:e.rawInput,chatRequestId:e.chatRequestId,chatSessionResource:e.chatSessionResource,chatInteractionId:e.chatInteractionId},s=await o.tool.handleToolStream(i,n);if(s)return{invocationMessage:ue.fromStrict(s.invocationMessage)}}async $prepareToolInvocation(t,e,n){let o=this._registeredTools.get(t);if(!o)throw new Error(`Unknown tool ${t}`);let i={input:e.parameters,chatRequestId:e.chatRequestId,chatSessionResource:e.chatSessionResource,chatInteractionId:e.chatInteractionId,forceConfirmationReason:e.forceConfirmationReason};if(e.forceConfirmationReason&&A(o.extension,"chatParticipantPrivate"),o.tool.prepareInvocation){let s=await o.tool.prepareInvocation(i,n);if(!s)return;(s.pastTenseMessage||s.presentation)&&A(o.extension,"chatParticipantPrivate"),s.confirmationMessages?.approveCombination!==void 0&&A(o.extension,"toolInvocationApproveCombination");let a=s.confirmationMessages?.approveCombination?ue.fromStrict(s.confirmationMessages.approveCombination):void 0,l=a?await UB(t,e.parameters):void 0;return{confirmationMessages:s.confirmationMessages?{title:typeof s.confirmationMessages.title=="string"?s.confirmationMessages.title:ue.from(s.confirmationMessages.title),message:typeof s.confirmationMessages.message=="string"?s.confirmationMessages.message:ue.from(s.confirmationMessages.message),approveCombination:a&&l?{label:a,key:l}:void 0}:void 0,invocationMessage:ue.fromStrict(s.invocationMessage),pastTenseMessage:ue.fromStrict(s.pastTenseMessage),presentation:s.presentation}}}registerTool(t,e,n){return this._registeredTools.set(e,{extension:t,tool:n}),this._proxy.$registerTool(e,typeof n.handleToolStream=="function"),K(()=>{this._registeredTools.delete(e),this._proxy.$unregisterTool(e)})}registerToolDefinition(t,e,n){A(t,"languageModelToolSupportsModel");let o=e.name,i={id:o,displayName:e.displayName,toolReferenceName:e.toolReferenceName,userDescription:e.userDescription,modelDescription:e.description,inputSchema:e.inputSchema,source:{type:"extension",label:t.displayName??t.name,extensionId:t.identifier},icon:Hi.from(e.icon),models:e.models,toolSet:e.toolSet};return this._registeredTools.set(o,{extension:t,tool:n}),this._proxy.$registerToolWithDefinition(t.identifier,i,typeof n.handleToolStream=="function"),K(()=>{this._registeredTools.delete(o),this._proxy.$unregisterTool(o)})}};var vk=class{constructor(t,e,n,o){this._documents=e;this._commands=n;this._uriTransformer=o;this._languageIds=[];this._handlePool=0;this._ids=new Set;this._proxy=t.getProxy(F.MainThreadLanguages)}$acceptLanguageIds(t){this._languageIds=t}async getLanguages(){return this._languageIds.slice(0)}async changeLanguage(t,e){await this._proxy.$changeLanguage(t,e);let n=this._documents.getDocumentData(t);if(!n)throw new Error(`document '${t.toString()}' NOT found`);return n.document}async tokenAtPosition(t,e){let n=t.version,o=ct.from(e),i=await this._proxy.$tokensAtPosition(t.uri,o),s={type:0,range:t.getWordRangeAtPosition(e)??new fe(e.line,e.character,e.line,e.character)};if(!i)return s;let a={range:j.to(i.range),type:G1.to(i.type)};return!a.range.contains(e)||n!==t.version?s:a}createLanguageStatusItem(t,e,n){let o=this._handlePool++,i=this._proxy,s=this._ids,a=`${t.identifier.value}/${e}`;if(s.has(a))throw new Error(`LanguageStatusItem with id '${e}' ALREADY exists`);s.add(a);let l={selector:n,id:e,name:t.displayName??t.name,severity:0,command:void 0,text:"",detail:"",busy:!1},d,c=new $,u=()=>{if(d?.dispose(),!s.has(a)){console.warn(`LanguageStatusItem (${e}) from ${t.identifier.value} has been disposed and CANNOT be updated anymore`);return}d=Ch(()=>{c.clear(),this._proxy.$setLanguageStatus(o,{id:a,name:l.name??t.displayName??t.name,source:t.displayName??t.name,selector:Fi.from(l.selector,this._uriTransformer),label:l.text,detail:l.detail??"",severity:l.severity===2?Xe.Error:l.severity===1?Xe.Warning:Xe.Info,command:l.command&&this._commands.toInternal(l.command,c),accessibilityInfo:l.accessibilityInformation,busy:l.busy})},0)},m={dispose(){c.dispose(),d?.dispose(),i.$removeLanguageStatus(o),s.delete(a)},get id(){return l.id},get name(){return l.name},set name(g){l.name=g,u()},get selector(){return l.selector},set selector(g){l.selector=g,u()},get text(){return l.text},set text(g){l.text=g,u()},set text2(g){A(t,"languageStatusText"),l.text=g,u()},get text2(){return A(t,"languageStatusText"),l.text},get detail(){return l.detail},set detail(g){l.detail=g,u()},get severity(){return l.severity},set severity(g){l.severity=g,u()},get accessibilityInformation(){return l.accessibilityInformation},set accessibilityInformation(g){l.accessibilityInformation=g,u()},get command(){return l.command},set command(g){l.command=g,u()},get busy(){return l.busy},set busy(g){l.busy=g,u()}};return u(),m}};function tQ(r){return r&&r.title}var Of=class{constructor(t,e){this._logService=e;this._proxy=t.getProxy(F.MainThreadMessageService)}showMessage(t,e,n,o,i){let s={source:{identifier:t.identifier,label:t.displayName||t.name}},a;typeof o=="string"||tQ(o)?a=[o,...i]:(s.modal=o?.modal,s.useCustom=o?.useCustom,s.detail=o?.detail,a=i),s.useCustom&&A(t,"resolvers");let l=[],d=!1;for(let c=0;c<a.length;c++){let u=a[c];if(typeof u=="string")l.push({title:u,handle:c,isCloseAffordance:!1});else if(typeof u=="object"){let{title:m,isCloseAffordance:g}=u;l.push({title:m,isCloseAffordance:!!g,handle:c}),g&&(d?this._logService.warn(`[${t.identifier}] Only one message item can have 'isCloseAffordance':`,u):d=!0)}else this._logService.warn(`[${t.identifier}] Invalid message item:`,u)}return this._proxy.$showMessage(e,n,s,l).then(c=>{if(typeof c=="number")return a[c]})}};Of=_([C(1,oe)],Of);var vy=class{constructor(t,e,n,o){this.start=t;this.deletedCount=e;this.deletedItems=n;this.items=o}asApiEvent(){return{range:new oo(this.start,this.start+this.deletedCount),addedCells:this.items.map(t=>t.apiCell),removedCells:this.deletedItems}}},Nf=class{constructor(t,e,n){this.notebook=t;this._extHostDocument=e;this._cellData=n;this.handle=n.handle,this.uri=b.revive(n.uri),this.cellKind=n.cellKind,this._outputs=n.outputs.map(Ua.to),this._internalMetadata=n.internalMetadata??{},this._metadata=Object.freeze(n.metadata??{}),this._previousResult=Object.freeze(Wm.to(n.internalMetadata??{}))}static asModelAddData(t){return{EOL:t.eol,lines:t.source,languageId:t.language,uri:t.uri,isDirty:!1,versionId:1,encoding:"utf8"}}get internalMetadata(){return this._internalMetadata}get apiCell(){if(!this._apiCell){let t=this,e=this._extHostDocument.getDocument(this.uri);if(!e)throw new Error(`MISSING extHostDocument for notebook cell: ${this.uri}`);let n={get index(){return t.notebook.getCellIndex(t)},notebook:t.notebook.apiNotebook,kind:Kv.to(this._cellData.cellKind),document:e.document,get mime(){return t._mime},set mime(o){t._mime=o},get outputs(){return t._outputs.slice(0)},get metadata(){return t._metadata},get executionSummary(){return t._previousResult}};this._apiCell=Object.freeze(n)}return this._apiCell}setOutputs(t){this._outputs=t.map(Ua.to)}setOutputItems(t,e,n){let o=n.map(iu.to),i=this._outputs.find(s=>s.id===t);if(i&&(e||(i.items.length=0),i.items.push(...o),i.items.length>1&&i.items.every(s=>fx(s.mime)))){let s=new Map,a=[];i.items.forEach(l=>{let d;s.has(l.mime)?d=s.get(l.mime):(d=[],s.set(l.mime,d),a.push(l.mime)),d.push(l.data)}),i.items.length=0,a.forEach(l=>{let d=jW(s.get(l));i.items.push({mime:l,data:d.data.buffer})})}}setMetadata(t){this._metadata=Object.freeze(t)}setInternalMetadata(t){this._internalMetadata=t,this._previousResult=Object.freeze(Wm.to(t))}setMime(t){}},bk=class r{constructor(t,e,n,o,i){this._proxy=t;this._textDocumentsAndEditors=e;this._textDocuments=n;this.uri=o;this.handle=r._handlePool++;this._cells=[];this._versionId=0;this._isDirty=!1;this._disposed=!1;this._notebookType=i.viewType,this._metadata=Object.freeze(i.metadata??Object.create(null)),this._spliceNotebookCells([[0,0,i.cells]],!0,void 0),this._versionId=i.versionId}static{this._handlePool=0}dispose(){this._disposed=!0}get versionId(){return this._versionId}get apiNotebook(){if(!this._notebook){let t=this,e={get uri(){return t.uri},get version(){return t._versionId},get notebookType(){return t._notebookType},get isDirty(){return t._isDirty},get isUntitled(){return t.uri.scheme===V.untitled},get isClosed(){return t._disposed},get metadata(){return t._metadata},get cellCount(){return t._cells.length},cellAt(n){return n=t._validateIndex(n),t._cells[n].apiCell},getCells(n){return(n?t._getCells(n):t._cells).map(i=>i.apiCell)},save(){return t._save()},[Symbol.for("debug.description")](){return`NotebookDocument(${this.uri.toString()})`}};this._notebook=Object.freeze(e)}return this._notebook}acceptDocumentPropertiesChanged(t){t.metadata&&(this._metadata=Object.freeze({...this._metadata,...t.metadata}))}acceptDirty(t){this._isDirty=t}acceptModelChanged(t,e,n){this._versionId=t.versionId,this._isDirty=e,this.acceptDocumentPropertiesChanged({metadata:n});let o={notebook:this.apiNotebook,metadata:n,cellChanges:[],contentChanges:[]},i=[];for(let a of t.rawEvents)a.kind===1?this._spliceNotebookCells(a.changes,!1,o.contentChanges):a.kind===2?this._moveCells(a.index,a.length,a.newIdx,o.contentChanges):a.kind===8?(this._setCellOutputs(a.index,a.outputs),i.push({cell:this._cells[a.index].apiCell,outputs:this._cells[a.index].apiCell.outputs})):a.kind===9?(this._setCellOutputItems(a.index,a.outputId,a.append,a.outputItems),i.push({cell:this._cells[a.index].apiCell,outputs:this._cells[a.index].apiCell.outputs})):a.kind===5?(this._changeCellLanguage(a.index,a.language),i.push({cell:this._cells[a.index].apiCell,document:this._cells[a.index].apiCell.document})):a.kind===10?i.push({cell:this._cells[a.index].apiCell,document:this._cells[a.index].apiCell.document}):a.kind===13?this._changeCellMime(a.index,a.mime):a.kind===7?(this._changeCellMetadata(a.index,a.metadata),i.push({cell:this._cells[a.index].apiCell,metadata:this._cells[a.index].apiCell.metadata})):a.kind===12&&(this._changeCellInternalMetadata(a.index,a.internalMetadata),i.push({cell:this._cells[a.index].apiCell,executionSummary:this._cells[a.index].apiCell.executionSummary}));let s=new Map;for(let a=0;a<i.length;a++){let l=i[a],d=s.get(l.cell);if(d===void 0){let c=o.cellChanges.push({document:void 0,executionSummary:void 0,metadata:void 0,outputs:void 0,...l});s.set(l.cell,c-1)}else o.cellChanges[d]={...o.cellChanges[d],...l}}return Object.freeze(o),Object.freeze(o.cellChanges),Object.freeze(o.contentChanges),o}_validateIndex(t){return t=t|0,t<0?0:t>=this._cells.length?this._cells.length-1:t}_validateRange(t){let e=t.start|0,n=t.end|0;return e<0&&(e=0),n>this._cells.length&&(n=this._cells.length),t.with({start:e,end:n})}_getCells(t){t=this._validateRange(t);let e=[];for(let n=t.start;n<t.end;n++)e.push(this._cells[n]);return e}async _save(){return this._disposed?Promise.reject(new Error("Notebook has been closed")):this._proxy.$trySaveNotebook(this.uri)}_spliceNotebookCells(t,e,n){if(this._disposed)return;let o=[],i=[],s=[];if(t.reverse().forEach(a=>{let d=a[2].map(m=>{let g=new Nf(this,this._textDocumentsAndEditors,m);return e||i.push(Nf.asModelAddData(m)),g}),c=new vy(a[0],a[1],[],d),u=this._cells.splice(a[0],a[1],...d);for(let m of u)s.push(m.uri),c.deletedItems.push(m.apiCell);o.push(c)}),this._textDocumentsAndEditors.acceptDocumentsAndEditorsDelta({addedDocuments:i,removedDocuments:s}),n)for(let a of o)n.push(a.asApiEvent())}_moveCells(t,e,n,o){let i=this._cells.splice(t,e);this._cells.splice(n,0,...i);let s=[new vy(t,e,i.map(a=>a.apiCell),[]),new vy(n,0,[],i)];for(let a of s)o.push(a.asApiEvent())}_setCellOutputs(t,e){this._cells[t].setOutputs(e)}_setCellOutputItems(t,e,n,o){this._cells[t].setOutputItems(e,n,o)}_changeCellLanguage(t,e){let n=this._cells[t];n.apiCell.document.languageId!==e&&this._textDocuments.$acceptModelLanguageChanged(n.uri,e)}_changeCellMime(t,e){let n=this._cells[t];n.apiCell.mime=e}_changeCellMetadata(t,e){this._cells[t].setMetadata(e)}_changeCellInternalMetadata(t,e){this._cells[t].setInternalMetadata(e)}getCellFromApiCell(t){return this._cells.find(e=>e.apiCell===t)}getCellFromIndex(t){return this._cells[t]}getCell(t){return this._cells.find(e=>e.handle===t)}getCellIndex(t){return this._cells.indexOf(t)}};var Hu=class r{constructor(t,e,n,o,i,s,a){this.id=t;this._proxy=e;this.notebookData=n;this._visibleRanges=o;this._selections=i;this._viewColumn=s;this.viewType=a;this._visible=!1}static{this.apiEditorsToExtHost=new WeakMap}get apiEditor(){if(!this._editor){let t=this;this._editor={get notebook(){return t.notebookData.apiNotebook},get selection(){return t._selections[0]},set selection(e){this.selections=[e]},get selections(){return t._selections},set selections(e){if(!Array.isArray(e)||!e.every(oo.isNotebookRange))throw Fe("selections");t._selections=e.length===0?[new oo(0,0)]:e,t._trySetSelections(t._selections)},get visibleRanges(){return t._visibleRanges},revealRange(e,n){t._proxy.$tryRevealRange(t.id,Fr.from(e),n??0)},get viewColumn(){return t._viewColumn},get replOptions(){if(t.viewType==="repl")return{appendIndex:this.notebook.cellCount-1}},[Symbol.for("debug.description")](){return`NotebookEditor(${this.notebook.uri.toString()})`}},r.apiEditorsToExtHost.set(this._editor,this)}return this._editor}get visible(){return this._visible}_acceptVisibility(t){this._visible=t}_acceptVisibleRanges(t){this._visibleRanges=t}_acceptSelections(t){this._selections=t}_trySetSelections(t){this._proxy.$trySetSelections(this.id,t.map(Fr.from))}_acceptViewColumn(t){this._viewColumn=t}};var Uf=class{constructor(t,e){this.piece=t,this.color=e,this.size_left=0,this.lf_left=0,this.parent=this,this.left=this,this.right=this}next(){if(this.right!==xe)return yk(this.right);let t=this;for(;t.parent!==xe&&t.parent.left!==t;)t=t.parent;return t.parent===xe?xe:t.parent}prev(){if(this.left!==xe)return yO(this.left);let t=this;for(;t.parent!==xe&&t.parent.right!==t;)t=t.parent;return t.parent===xe?xe:t.parent}detach(){this.parent=null,this.left=null,this.right=null}};var xe=new Uf(null,0);xe.parent=xe;xe.left=xe;xe.right=xe;xe.color=0;function yk(r){for(;r.left!==xe;)r=r.left;return r}function yO(r){for(;r.right!==xe;)r=r.right;return r}function IO(r){return r===xe?0:r.size_left+r.piece.length+IO(r.right)}function xO(r){return r===xe?0:r.lf_left+r.piece.lineFeedCnt+xO(r.right)}function bO(){xe.parent=xe}function yy(r,t){let e=t.right;e.size_left+=t.size_left+(t.piece?t.piece.length:0),e.lf_left+=t.lf_left+(t.piece?t.piece.lineFeedCnt:0),t.right=e.left,e.left!==xe&&(e.left.parent=t),e.parent=t.parent,t.parent===xe?r.root=e:t.parent.left===t?t.parent.left=e:t.parent.right=e,e.left=t,t.parent=e}function Iy(r,t){let e=t.left;t.left=e.right,e.right!==xe&&(e.right.parent=t),e.parent=t.parent,t.size_left-=e.size_left+(e.piece?e.piece.length:0),t.lf_left-=e.lf_left+(e.piece?e.piece.lineFeedCnt:0),t.parent===xe?r.root=e:t===t.parent.right?t.parent.right=e:t.parent.left=e,e.right=t,t.parent=e}function xy(r,t){let e,n;if(t.left===xe?(n=t,e=n.right):t.right===xe?(n=t,e=n.left):(n=yk(t.right),e=n.right),n===r.root){r.root=e,e.color=0,t.detach(),bO(),r.root.parent=xe;return}let o=n.color===1;if(n===n.parent.left?n.parent.left=e:n.parent.right=e,n===t?(e.parent=n.parent,by(r,e)):(n.parent===t?e.parent=n:e.parent=n.parent,by(r,e),n.left=t.left,n.right=t.right,n.parent=t.parent,n.color=t.color,t===r.root?r.root=n:t===t.parent.left?t.parent.left=n:t.parent.right=n,n.left!==xe&&(n.left.parent=n),n.right!==xe&&(n.right.parent=n),n.size_left=t.size_left,n.lf_left=t.lf_left,by(r,n)),t.detach(),e.parent.left===e){let s=IO(e),a=xO(e);if(s!==e.parent.size_left||a!==e.parent.lf_left){let l=s-e.parent.size_left,d=a-e.parent.lf_left;e.parent.size_left=s,e.parent.lf_left=a,zs(r,e.parent,l,d)}}if(by(r,e.parent),o){bO();return}let i;for(;e!==r.root&&e.color===0;)e===e.parent.left?(i=e.parent.right,i.color===1&&(i.color=0,e.parent.color=1,yy(r,e.parent),i=e.parent.right),i.left.color===0&&i.right.color===0?(i.color=1,e=e.parent):(i.right.color===0&&(i.left.color=0,i.color=1,Iy(r,i),i=e.parent.right),i.color=e.parent.color,e.parent.color=0,i.right.color=0,yy(r,e.parent),e=r.root)):(i=e.parent.left,i.color===1&&(i.color=0,e.parent.color=1,Iy(r,e.parent),i=e.parent.left),i.left.color===0&&i.right.color===0?(i.color=1,e=e.parent):(i.left.color===0&&(i.right.color=0,i.color=1,yy(r,i),i=e.parent.left),i.color=e.parent.color,e.parent.color=0,i.left.color=0,Iy(r,e.parent),e=r.root));e.color=0,bO()}function SO(r,t){for(by(r,t);t!==r.root&&t.parent.color===1;)if(t.parent===t.parent.parent.left){let e=t.parent.parent.right;e.color===1?(t.parent.color=0,e.color=0,t.parent.parent.color=1,t=t.parent.parent):(t===t.parent.right&&(t=t.parent,yy(r,t)),t.parent.color=0,t.parent.parent.color=1,Iy(r,t.parent.parent))}else{let e=t.parent.parent.left;e.color===1?(t.parent.color=0,e.color=0,t.parent.parent.color=1,t=t.parent.parent):(t===t.parent.left&&(t=t.parent,Iy(r,t)),t.parent.color=0,t.parent.parent.color=1,yy(r,t.parent.parent))}r.root.color=0}function zs(r,t,e,n){for(;t!==r.root&&t!==xe;)t.parent.left===t&&(t.parent.size_left+=e,t.parent.lf_left+=n),t=t.parent}function by(r,t){let e=0,n=0;if(t!==r.root){for(;t!==r.root&&t===t.parent.right;)t=t.parent;if(t!==r.root)for(t=t.parent,e=IO(t.left)-t.size_left,n=xO(t.left)-t.lf_left,t.size_left+=e,t.lf_left+=n;t!==r.root&&(e!==0||n!==0);)t.parent.left===t&&(t.parent.size_left+=e,t.parent.lf_left+=n),t=t.parent}}var Ka=65535;function x5(r){let t;return r[r.length-1]<65536?t=new Uint16Array(r.length):t=new Uint32Array(r.length),t.set(r,0),t}var CO=class{constructor(t,e,n,o,i){this.lineStarts=t;this.cr=e;this.lf=n;this.crlf=o;this.isBasicASCII=i}};function qs(r,t=!0){let e=[0],n=1;for(let o=0,i=r.length;o<i;o++){let s=r.charCodeAt(o);s===13?o+1<i&&r.charCodeAt(o+1)===10?(e[n++]=o+2,o++):e[n++]=o+1:s===10&&(e[n++]=o+1)}return t?x5(e):e}function S5(r,t){r.length=0,r[0]=0;let e=1,n=0,o=0,i=0,s=!0;for(let l=0,d=t.length;l<d;l++){let c=t.charCodeAt(l);c===13?l+1<d&&t.charCodeAt(l+1)===10?(i++,r[e++]=l+2,l++):(n++,r[e++]=l+1):c===10?(o++,r[e++]=l+1):s&&c!==9&&(c<32||c>126)&&(s=!1)}let a=new CO(x5(r),n,o,i,s);return r.length=0,a}var Po=class{constructor(t,e,n,o,i){this.bufferIndex=t,this.start=e,this.end=n,this.lineFeedCnt=o,this.length=i}},Ks=class{constructor(t,e){this.buffer=t,this.lineStarts=e}},TO=class{constructor(t,e){this._pieces=[],this._tree=t,this._BOM=e,this._index=0,t.root!==xe&&t.iterate(t.root,n=>(n!==xe&&this._pieces.push(n.piece),!0))}read(){return this._pieces.length===0?this._index===0?(this._index++,this._BOM):null:this._index>this._pieces.length-1?null:this._index===0?this._BOM+this._tree.getPieceContent(this._pieces[this._index++]):this._tree.getPieceContent(this._pieces[this._index++])}},EO=class{constructor(t){this._limit=t,this._cache=[]}get(t){for(let e=this._cache.length-1;e>=0;e--){let n=this._cache[e];if(n.nodeStartOffset<=t&&n.nodeStartOffset+n.node.piece.length>=t)return n}return null}get2(t){for(let e=this._cache.length-1;e>=0;e--){let n=this._cache[e];if(n.nodeStartLineNumber&&n.nodeStartLineNumber<t&&n.nodeStartLineNumber+n.node.piece.lineFeedCnt>=t)return n}return null}set(t){this._cache.length>=this._limit&&this._cache.shift(),this._cache.push(t)}validate(t){let e=!1,n=this._cache;for(let o=0;o<n.length;o++){let i=n[o];if(i.node.parent===null||i.nodeStartOffset>=t){n[o]=null,e=!0;continue}}if(e){let o=[];for(let i of n)i!==null&&o.push(i);this._cache=o}}},Ik=class{constructor(t,e,n){this.create(t,e,n)}create(t,e,n){this._buffers=[new Ks("",[0])],this._lastChangeBufferPos={line:0,column:0},this.root=xe,this._lineCnt=1,this._length=0,this._EOL=e,this._EOLLength=e.length,this._EOLNormalized=n;let o=null;for(let i=0,s=t.length;i<s;i++)if(t[i].buffer.length>0){t[i].lineStarts||(t[i].lineStarts=qs(t[i].buffer));let a=new Po(i+1,{line:0,column:0},{line:t[i].lineStarts.length-1,column:t[i].buffer.length-t[i].lineStarts[t[i].lineStarts.length-1]},t[i].lineStarts.length-1,t[i].buffer.length);this._buffers.push(t[i]),o=this.rbInsertRight(o,a)}this._searchCache=new EO(1),this._lastVisitedLine={lineNumber:0,value:""},this.computeBufferMetadata()}normalizeEOL(t){let e=Ka,n=e-Math.floor(e/3),o=n*2,i="",s=0,a=[];if(this.iterate(this.root,l=>{let d=this.getNodeContent(l),c=d.length;if(s<=n||s+c<o)return i+=d,s+=c,!0;let u=i.replace(/\r\n|\r|\n/g,t);return a.push(new Ks(u,qs(u))),i=d,s=c,!0}),s>0){let l=i.replace(/\r\n|\r|\n/g,t);a.push(new Ks(l,qs(l)))}this.create(a,t,!0)}getEOL(){return this._EOL}setEOL(t){this._EOL=t,this._EOLLength=this._EOL.length,this.normalizeEOL(t)}createSnapshot(t){return new TO(this,t)}equal(t){if(this.getLength()!==t.getLength()||this.getLineCount()!==t.getLineCount())return!1;let e=0;return this.iterate(this.root,o=>{if(o===xe)return!0;let i=this.getNodeContent(o),s=i.length,a=t.nodeAt(e),l=t.nodeAt(e+s),d=t.getValueInRange2(a,l);return e+=s,i===d})}getOffsetAt(t,e){let n=0,o=this.root;for(;o!==xe;)if(o.left!==xe&&o.lf_left+1>=t)o=o.left;else if(o.lf_left+o.piece.lineFeedCnt+1>=t){n+=o.size_left;let i=this.getAccumulatedValue(o,t-o.lf_left-2);return n+=i+e-1}else t-=o.lf_left+o.piece.lineFeedCnt,n+=o.size_left+o.piece.length,o=o.right;return n}getPositionAt(t){t=Math.floor(t),t=Math.max(0,t);let e=this.root,n=0,o=t;for(;e!==xe;)if(e.size_left!==0&&e.size_left>=t)e=e.left;else if(e.size_left+e.piece.length>=t){let i=this.getIndexOf(e,t-e.size_left);if(n+=e.lf_left+i.index,i.index===0){let s=this.getOffsetAt(n+1,1),a=o-s;return new An(n+1,a+1)}return new An(n+1,i.remainder+1)}else if(t-=e.size_left+e.piece.length,n+=e.lf_left+e.piece.lineFeedCnt,e.right===xe){let i=this.getOffsetAt(n+1,1),s=o-t-i;return new An(n+1,s+1)}else e=e.right;return new An(1,1)}getValueInRange(t,e){if(t.startLineNumber===t.endLineNumber&&t.startColumn===t.endColumn)return"";let n=this.nodeAt2(t.startLineNumber,t.startColumn),o=this.nodeAt2(t.endLineNumber,t.endColumn),i=this.getValueInRange2(n,o);return e?e!==this._EOL||!this._EOLNormalized?i.replace(/\r\n|\r|\n/g,e):e===this.getEOL()&&this._EOLNormalized?i:i.replace(/\r\n|\r|\n/g,e):i}getValueInRange2(t,e){if(t.node===e.node){let a=t.node,l=this._buffers[a.piece.bufferIndex].buffer,d=this.offsetInBuffer(a.piece.bufferIndex,a.piece.start);return l.substring(d+t.remainder,d+e.remainder)}let n=t.node,o=this._buffers[n.piece.bufferIndex].buffer,i=this.offsetInBuffer(n.piece.bufferIndex,n.piece.start),s=o.substring(i+t.remainder,i+n.piece.length);for(n=n.next();n!==xe;){let a=this._buffers[n.piece.bufferIndex].buffer,l=this.offsetInBuffer(n.piece.bufferIndex,n.piece.start);if(n===e.node){s+=a.substring(l,l+e.remainder);break}else s+=a.substr(l,n.piece.length);n=n.next()}return s}getLinesContent(){let t=[],e=0,n="",o=!1;return this.iterate(this.root,i=>{if(i===xe)return!0;let s=i.piece,a=s.length;if(a===0)return!0;let l=this._buffers[s.bufferIndex].buffer,d=this._buffers[s.bufferIndex].lineStarts,c=s.start.line,u=s.end.line,m=d[c]+s.start.column;if(o&&(l.charCodeAt(m)===10&&(m++,a--),t[e++]=n,n="",o=!1,a===0))return!0;if(c===u)return!this._EOLNormalized&&l.charCodeAt(m+a-1)===13?(o=!0,n+=l.substr(m,a-1)):n+=l.substr(m,a),!0;n+=this._EOLNormalized?l.substring(m,Math.max(m,d[c+1]-this._EOLLength)):l.substring(m,d[c+1]).replace(/(\r\n|\r|\n)$/,""),t[e++]=n;for(let g=c+1;g<u;g++)n=this._EOLNormalized?l.substring(d[g],d[g+1]-this._EOLLength):l.substring(d[g],d[g+1]).replace(/(\r\n|\r|\n)$/,""),t[e++]=n;return!this._EOLNormalized&&l.charCodeAt(d[u]+s.end.column-1)===13?(o=!0,s.end.column===0?e--:n=l.substr(d[u],s.end.column-1)):n=l.substr(d[u],s.end.column),!0}),o&&(t[e++]=n,n=""),t[e++]=n,t}getLength(){return this._length}getLineCount(){return this._lineCnt}getLineContent(t){return this._lastVisitedLine.lineNumber===t?this._lastVisitedLine.value:(this._lastVisitedLine.lineNumber=t,t===this._lineCnt?this._lastVisitedLine.value=this.getLineRawContent(t):this._EOLNormalized?this._lastVisitedLine.value=this.getLineRawContent(t,this._EOLLength):this._lastVisitedLine.value=this.getLineRawContent(t).replace(/(\r\n|\r|\n)$/,""),this._lastVisitedLine.value)}_getCharCode(t){if(t.remainder===t.node.piece.length){let e=t.node.next();if(!e)return 0;let n=this._buffers[e.piece.bufferIndex],o=this.offsetInBuffer(e.piece.bufferIndex,e.piece.start);return n.buffer.charCodeAt(o)}else{let e=this._buffers[t.node.piece.bufferIndex],o=this.offsetInBuffer(t.node.piece.bufferIndex,t.node.piece.start)+t.remainder;return e.buffer.charCodeAt(o)}}getLineCharCode(t,e){let n=this.nodeAt2(t,e+1);return this._getCharCode(n)}getLineLength(t){if(t===this.getLineCount()){let e=this.getOffsetAt(t,1);return this.getLength()-e}return this.getOffsetAt(t+1,1)-this.getOffsetAt(t,1)-this._EOLLength}getCharCode(t){let e=this.nodeAt(t);return this._getCharCode(e)}getNearestChunk(t){let e=this.nodeAt(t);if(e.remainder===e.node.piece.length){let n=e.node.next();if(!n||n===xe)return"";let o=this._buffers[n.piece.bufferIndex],i=this.offsetInBuffer(n.piece.bufferIndex,n.piece.start);return o.buffer.substring(i,i+n.piece.length)}else{let n=this._buffers[e.node.piece.bufferIndex],o=this.offsetInBuffer(e.node.piece.bufferIndex,e.node.piece.start),i=o+e.remainder,s=o+e.node.piece.length;return n.buffer.substring(i,s)}}findMatchesInNode(t,e,n,o,i,s,a,l,d,c,u){let m=this._buffers[t.piece.bufferIndex],g=this.offsetInBuffer(t.piece.bufferIndex,t.piece.start),h=this.offsetInBuffer(t.piece.bufferIndex,i),f=this.offsetInBuffer(t.piece.bufferIndex,s),I,S={line:0,column:0},T,P;e._wordSeparators?(T=m.buffer.substring(h,f),P=L=>L+h,e.reset(0)):(T=m.buffer,P=L=>L,e.reset(h));do if(I=e.next(T),I){if(P(I.index)>=f)return c;this.positionInBuffer(t,P(I.index)-g,S);let L=this.getLineFeedCnt(t.piece.bufferIndex,i,S),q=S.line===i.line?S.column-i.column+o:S.column+1,N=q+I[0].length;if(u[c++]=c0(new We(n+L,q,n+L,N),I,l),P(I.index)+I[0].length>=f||c>=d)return c}while(I);return c}findMatchesLineByLine(t,e,n,o){let i=[],s=0,a=new KT(e.wordSeparators,e.regex),l=this.nodeAt2(t.startLineNumber,t.startColumn);if(l===null)return[];let d=this.nodeAt2(t.endLineNumber,t.endColumn);if(d===null)return[];let c=this.positionInBuffer(l.node,l.remainder),u=this.positionInBuffer(d.node,d.remainder);if(l.node===d.node)return this.findMatchesInNode(l.node,a,t.startLineNumber,t.startColumn,c,u,e,n,o,s,i),i;let m=t.startLineNumber,g=l.node;for(;g!==d.node;){let f=this.getLineFeedCnt(g.piece.bufferIndex,c,g.piece.end);if(f>=1){let S=this._buffers[g.piece.bufferIndex].lineStarts,T=this.offsetInBuffer(g.piece.bufferIndex,g.piece.start),P=S[c.line+f],L=m===t.startLineNumber?t.startColumn:1;if(s=this.findMatchesInNode(g,a,m,L,c,this.positionInBuffer(g,P-T),e,n,o,s,i),s>=o)return i;m+=f}let I=m===t.startLineNumber?t.startColumn-1:0;if(m===t.endLineNumber){let S=this.getLineContent(m).substring(I,t.endColumn-1);return s=this._findMatchesInLine(e,a,S,t.endLineNumber,I,s,i,n,o),i}if(s=this._findMatchesInLine(e,a,this.getLineContent(m).substr(I),m,I,s,i,n,o),s>=o)return i;m++,l=this.nodeAt2(m,1),g=l.node,c=this.positionInBuffer(l.node,l.remainder)}if(m===t.endLineNumber){let f=m===t.startLineNumber?t.startColumn-1:0,I=this.getLineContent(m).substring(f,t.endColumn-1);return s=this._findMatchesInLine(e,a,I,t.endLineNumber,f,s,i,n,o),i}let h=m===t.startLineNumber?t.startColumn:1;return s=this.findMatchesInNode(d.node,a,m,h,c,u,e,n,o,s,i),i}_findMatchesInLine(t,e,n,o,i,s,a,l,d){let c=t.wordSeparators;if(!l&&t.simpleSearch){let m=t.simpleSearch,g=m.length,h=n.length,f=-g;for(;(f=n.indexOf(m,f+g))!==-1;)if((!c||u0(c,n,h,f,g))&&(a[s++]=new yc(new We(o,f+1+i,o,f+1+g+i),null),s>=d))return s;return s}let u;e.reset(0);do if(u=e.next(n),u&&(a[s++]=c0(new We(o,u.index+1+i,o,u.index+1+u[0].length+i),u,l),s>=d))return s;while(u);return s}insert(t,e,n=!1){if(this._EOLNormalized=this._EOLNormalized&&n,this._lastVisitedLine.lineNumber=0,this._lastVisitedLine.value="",this.root!==xe){let{node:o,remainder:i,nodeStartOffset:s}=this.nodeAt(t),a=o.piece,l=a.bufferIndex,d=this.positionInBuffer(o,i);if(o.piece.bufferIndex===0&&a.end.line===this._lastChangeBufferPos.line&&a.end.column===this._lastChangeBufferPos.column&&s+a.length===t&&e.length<Ka){this.appendToNode(o,e),this.computeBufferMetadata();return}if(s===t)this.insertContentToNodeLeft(e,o),this._searchCache.validate(t);else if(s+o.piece.length>t){let c=[],u=new Po(a.bufferIndex,d,a.end,this.getLineFeedCnt(a.bufferIndex,d,a.end),this.offsetInBuffer(l,a.end)-this.offsetInBuffer(l,d));if(this.shouldCheckCRLF()&&this.endWithCR(e)&&this.nodeCharCodeAt(o,i)===10){let f={line:u.start.line+1,column:0};u=new Po(u.bufferIndex,f,u.end,this.getLineFeedCnt(u.bufferIndex,f,u.end),u.length-1),e+=`
`}if(this.shouldCheckCRLF()&&this.startWithLF(e))if(this.nodeCharCodeAt(o,i-1)===13){let f=this.positionInBuffer(o,i-1);this.deleteNodeTail(o,f),e="\r"+e,o.piece.length===0&&c.push(o)}else this.deleteNodeTail(o,d);else this.deleteNodeTail(o,d);let m=this.createNewPieces(e);u.length>0&&this.rbInsertRight(o,u);let g=o;for(let h=0;h<m.length;h++)g=this.rbInsertRight(g,m[h]);this.deleteNodes(c)}else this.insertContentToNodeRight(e,o)}else{let o=this.createNewPieces(e),i=this.rbInsertLeft(null,o[0]);for(let s=1;s<o.length;s++)i=this.rbInsertRight(i,o[s])}this.computeBufferMetadata()}delete(t,e){if(this._lastVisitedLine.lineNumber=0,this._lastVisitedLine.value="",e<=0||this.root===xe)return;let n=this.nodeAt(t),o=this.nodeAt(t+e),i=n.node,s=o.node;if(i===s){let m=this.positionInBuffer(i,n.remainder),g=this.positionInBuffer(i,o.remainder);if(n.nodeStartOffset===t){if(e===i.piece.length){let h=i.next();xy(this,i),this.validateCRLFWithPrevNode(h),this.computeBufferMetadata();return}this.deleteNodeHead(i,g),this._searchCache.validate(t),this.validateCRLFWithPrevNode(i),this.computeBufferMetadata();return}if(n.nodeStartOffset+i.piece.length===t+e){this.deleteNodeTail(i,m),this.validateCRLFWithNextNode(i),this.computeBufferMetadata();return}this.shrinkNode(i,m,g),this.computeBufferMetadata();return}let a=[],l=this.positionInBuffer(i,n.remainder);this.deleteNodeTail(i,l),this._searchCache.validate(t),i.piece.length===0&&a.push(i);let d=this.positionInBuffer(s,o.remainder);this.deleteNodeHead(s,d),s.piece.length===0&&a.push(s);let c=i.next();for(let m=c;m!==xe&&m!==s;m=m.next())a.push(m);let u=i.piece.length===0?i.prev():i;this.deleteNodes(a),this.validateCRLFWithNextNode(u),this.computeBufferMetadata()}insertContentToNodeLeft(t,e){let n=[];if(this.shouldCheckCRLF()&&this.endWithCR(t)&&this.startWithLF(e)){let s=e.piece,a={line:s.start.line+1,column:0},l=new Po(s.bufferIndex,a,s.end,this.getLineFeedCnt(s.bufferIndex,a,s.end),s.length-1);e.piece=l,t+=`
`,zs(this,e,-1,-1),e.piece.length===0&&n.push(e)}let o=this.createNewPieces(t),i=this.rbInsertLeft(e,o[o.length-1]);for(let s=o.length-2;s>=0;s--)i=this.rbInsertLeft(i,o[s]);this.validateCRLFWithPrevNode(i),this.deleteNodes(n)}insertContentToNodeRight(t,e){this.adjustCarriageReturnFromNext(t,e)&&(t+=`
`);let n=this.createNewPieces(t),o=this.rbInsertRight(e,n[0]),i=o;for(let s=1;s<n.length;s++)i=this.rbInsertRight(i,n[s]);this.validateCRLFWithPrevNode(o)}positionInBuffer(t,e,n){let o=t.piece,i=t.piece.bufferIndex,s=this._buffers[i].lineStarts,l=s[o.start.line]+o.start.column+e,d=o.start.line,c=o.end.line,u=0,m=0,g=0;for(;d<=c&&(u=d+(c-d)/2|0,g=s[u],u!==c);)if(m=s[u+1],l<g)c=u-1;else if(l>=m)d=u+1;else break;return n?(n.line=u,n.column=l-g,null):{line:u,column:l-g}}getLineFeedCnt(t,e,n){if(n.column===0)return n.line-e.line;let o=this._buffers[t].lineStarts;if(n.line===o.length-1)return n.line-e.line;let i=o[n.line+1],s=o[n.line]+n.column;if(i>s+1)return n.line-e.line;let a=s-1;return this._buffers[t].buffer.charCodeAt(a)===13?n.line-e.line+1:n.line-e.line}offsetInBuffer(t,e){return this._buffers[t].lineStarts[e.line]+e.column}deleteNodes(t){for(let e=0;e<t.length;e++)xy(this,t[e])}createNewPieces(t){if(t.length>Ka){let c=[];for(;t.length>Ka;){let m=t.charCodeAt(Ka-1),g;m===13||m>=55296&&m<=56319?(g=t.substring(0,Ka-1),t=t.substring(Ka-1)):(g=t.substring(0,Ka),t=t.substring(Ka));let h=qs(g);c.push(new Po(this._buffers.length,{line:0,column:0},{line:h.length-1,column:g.length-h[h.length-1]},h.length-1,g.length)),this._buffers.push(new Ks(g,h))}let u=qs(t);return c.push(new Po(this._buffers.length,{line:0,column:0},{line:u.length-1,column:t.length-u[u.length-1]},u.length-1,t.length)),this._buffers.push(new Ks(t,u)),c}let e=this._buffers[0].buffer.length,n=qs(t,!1),o=this._lastChangeBufferPos;if(this._buffers[0].lineStarts[this._buffers[0].lineStarts.length-1]===e&&e!==0&&this.startWithLF(t)&&this.endWithCR(this._buffers[0].buffer)){this._lastChangeBufferPos={line:this._lastChangeBufferPos.line,column:this._lastChangeBufferPos.column+1},o=this._lastChangeBufferPos;for(let c=0;c<n.length;c++)n[c]+=e+1;this._buffers[0].lineStarts=this._buffers[0].lineStarts.concat(n.slice(1)),this._buffers[0].buffer+="_"+t,e+=1}else{if(e!==0)for(let c=0;c<n.length;c++)n[c]+=e;this._buffers[0].lineStarts=this._buffers[0].lineStarts.concat(n.slice(1)),this._buffers[0].buffer+=t}let i=this._buffers[0].buffer.length,s=this._buffers[0].lineStarts.length-1,a=i-this._buffers[0].lineStarts[s],l={line:s,column:a},d=new Po(0,o,l,this.getLineFeedCnt(0,o,l),i-e);return this._lastChangeBufferPos=l,[d]}getLinesRawContent(){return this.getContentOfSubTree(this.root)}getLineRawContent(t,e=0){let n=this.root,o="",i=this._searchCache.get2(t);if(i){n=i.node;let s=this.getAccumulatedValue(n,t-i.nodeStartLineNumber-1),a=this._buffers[n.piece.bufferIndex].buffer,l=this.offsetInBuffer(n.piece.bufferIndex,n.piece.start);if(i.nodeStartLineNumber+n.piece.lineFeedCnt===t)o=a.substring(l+s,l+n.piece.length);else{let d=this.getAccumulatedValue(n,t-i.nodeStartLineNumber);return a.substring(l+s,l+d-e)}}else{let s=0,a=t;for(;n!==xe;)if(n.left!==xe&&n.lf_left>=t-1)n=n.left;else if(n.lf_left+n.piece.lineFeedCnt>t-1){let l=this.getAccumulatedValue(n,t-n.lf_left-2),d=this.getAccumulatedValue(n,t-n.lf_left-1),c=this._buffers[n.piece.bufferIndex].buffer,u=this.offsetInBuffer(n.piece.bufferIndex,n.piece.start);return s+=n.size_left,this._searchCache.set({node:n,nodeStartOffset:s,nodeStartLineNumber:a-(t-1-n.lf_left)}),c.substring(u+l,u+d-e)}else if(n.lf_left+n.piece.lineFeedCnt===t-1){let l=this.getAccumulatedValue(n,t-n.lf_left-2),d=this._buffers[n.piece.bufferIndex].buffer,c=this.offsetInBuffer(n.piece.bufferIndex,n.piece.start);o=d.substring(c+l,c+n.piece.length);break}else t-=n.lf_left+n.piece.lineFeedCnt,s+=n.size_left+n.piece.length,n=n.right}for(n=n.next();n!==xe;){let s=this._buffers[n.piece.bufferIndex].buffer;if(n.piece.lineFeedCnt>0){let a=this.getAccumulatedValue(n,0),l=this.offsetInBuffer(n.piece.bufferIndex,n.piece.start);return o+=s.substring(l,l+a-e),o}else{let a=this.offsetInBuffer(n.piece.bufferIndex,n.piece.start);o+=s.substr(a,n.piece.length)}n=n.next()}return o}computeBufferMetadata(){let t=this.root,e=1,n=0;for(;t!==xe;)e+=t.lf_left+t.piece.lineFeedCnt,n+=t.size_left+t.piece.length,t=t.right;this._lineCnt=e,this._length=n,this._searchCache.validate(this._length)}getIndexOf(t,e){let n=t.piece,o=this.positionInBuffer(t,e),i=o.line-n.start.line;if(this.offsetInBuffer(n.bufferIndex,n.end)-this.offsetInBuffer(n.bufferIndex,n.start)===e){let s=this.getLineFeedCnt(t.piece.bufferIndex,n.start,o);if(s!==i)return{index:s,remainder:0}}return{index:i,remainder:o.column}}getAccumulatedValue(t,e){if(e<0)return 0;let n=t.piece,o=this._buffers[n.bufferIndex].lineStarts,i=n.start.line+e+1;return i>n.end.line?o[n.end.line]+n.end.column-o[n.start.line]-n.start.column:o[i]-o[n.start.line]-n.start.column}deleteNodeTail(t,e){let n=t.piece,o=n.lineFeedCnt,i=this.offsetInBuffer(n.bufferIndex,n.end),s=e,a=this.offsetInBuffer(n.bufferIndex,s),l=this.getLineFeedCnt(n.bufferIndex,n.start,s),d=l-o,c=a-i,u=n.length+c;t.piece=new Po(n.bufferIndex,n.start,s,l,u),zs(this,t,c,d)}deleteNodeHead(t,e){let n=t.piece,o=n.lineFeedCnt,i=this.offsetInBuffer(n.bufferIndex,n.start),s=e,a=this.getLineFeedCnt(n.bufferIndex,s,n.end),l=this.offsetInBuffer(n.bufferIndex,s),d=a-o,c=i-l,u=n.length+c;t.piece=new Po(n.bufferIndex,s,n.end,a,u),zs(this,t,c,d)}shrinkNode(t,e,n){let o=t.piece,i=o.start,s=o.end,a=o.length,l=o.lineFeedCnt,d=e,c=this.getLineFeedCnt(o.bufferIndex,o.start,d),u=this.offsetInBuffer(o.bufferIndex,e)-this.offsetInBuffer(o.bufferIndex,i);t.piece=new Po(o.bufferIndex,o.start,d,c,u),zs(this,t,u-a,c-l);let m=new Po(o.bufferIndex,n,s,this.getLineFeedCnt(o.bufferIndex,n,s),this.offsetInBuffer(o.bufferIndex,s)-this.offsetInBuffer(o.bufferIndex,n)),g=this.rbInsertRight(t,m);this.validateCRLFWithPrevNode(g)}appendToNode(t,e){this.adjustCarriageReturnFromNext(e,t)&&(e+=`
`);let n=this.shouldCheckCRLF()&&this.startWithLF(e)&&this.endWithCR(t),o=this._buffers[0].buffer.length;this._buffers[0].buffer+=e;let i=qs(e,!1);for(let g=0;g<i.length;g++)i[g]+=o;if(n){let g=this._buffers[0].lineStarts[this._buffers[0].lineStarts.length-2];this._buffers[0].lineStarts.pop(),this._lastChangeBufferPos={line:this._lastChangeBufferPos.line-1,column:o-g}}this._buffers[0].lineStarts=this._buffers[0].lineStarts.concat(i.slice(1));let s=this._buffers[0].lineStarts.length-1,a=this._buffers[0].buffer.length-this._buffers[0].lineStarts[s],l={line:s,column:a},d=t.piece.length+e.length,c=t.piece.lineFeedCnt,u=this.getLineFeedCnt(0,t.piece.start,l),m=u-c;t.piece=new Po(t.piece.bufferIndex,t.piece.start,l,u,d),this._lastChangeBufferPos=l,zs(this,t,e.length,m)}nodeAt(t){let e=this.root,n=this._searchCache.get(t);if(n)return{node:n.node,nodeStartOffset:n.nodeStartOffset,remainder:t-n.nodeStartOffset};let o=0;for(;e!==xe;)if(e.size_left>t)e=e.left;else if(e.size_left+e.piece.length>=t){o+=e.size_left;let i={node:e,remainder:t-e.size_left,nodeStartOffset:o};return this._searchCache.set(i),i}else t-=e.size_left+e.piece.length,o+=e.size_left+e.piece.length,e=e.right;return null}nodeAt2(t,e){let n=this.root,o=0;for(;n!==xe;)if(n.left!==xe&&n.lf_left>=t-1)n=n.left;else if(n.lf_left+n.piece.lineFeedCnt>t-1){let i=this.getAccumulatedValue(n,t-n.lf_left-2),s=this.getAccumulatedValue(n,t-n.lf_left-1);return o+=n.size_left,{node:n,remainder:Math.min(i+e-1,s),nodeStartOffset:o}}else if(n.lf_left+n.piece.lineFeedCnt===t-1){let i=this.getAccumulatedValue(n,t-n.lf_left-2);if(i+e-1<=n.piece.length)return{node:n,remainder:i+e-1,nodeStartOffset:o};e-=n.piece.length-i;break}else t-=n.lf_left+n.piece.lineFeedCnt,o+=n.size_left+n.piece.length,n=n.right;for(n=n.next();n!==xe;){if(n.piece.lineFeedCnt>0){let i=this.getAccumulatedValue(n,0),s=this.offsetOfNode(n);return{node:n,remainder:Math.min(e-1,i),nodeStartOffset:s}}else if(n.piece.length>=e-1){let i=this.offsetOfNode(n);return{node:n,remainder:e-1,nodeStartOffset:i}}else e-=n.piece.length;n=n.next()}return null}nodeCharCodeAt(t,e){if(t.piece.lineFeedCnt<1)return-1;let n=this._buffers[t.piece.bufferIndex],o=this.offsetInBuffer(t.piece.bufferIndex,t.piece.start)+e;return n.buffer.charCodeAt(o)}offsetOfNode(t){if(!t)return 0;let e=t.size_left;for(;t!==this.root;)t.parent.right===t&&(e+=t.parent.size_left+t.parent.piece.length),t=t.parent;return e}shouldCheckCRLF(){return!(this._EOLNormalized&&this._EOL===`
`)}startWithLF(t){if(typeof t=="string")return t.charCodeAt(0)===10;if(t===xe||t.piece.lineFeedCnt===0)return!1;let e=t.piece,n=this._buffers[e.bufferIndex].lineStarts,o=e.start.line,i=n[o]+e.start.column;return o===n.length-1||n[o+1]>i+1?!1:this._buffers[e.bufferIndex].buffer.charCodeAt(i)===10}endWithCR(t){return typeof t=="string"?t.charCodeAt(t.length-1)===13:t===xe||t.piece.lineFeedCnt===0?!1:this.nodeCharCodeAt(t,t.piece.length-1)===13}validateCRLFWithPrevNode(t){if(this.shouldCheckCRLF()&&this.startWithLF(t)){let e=t.prev();this.endWithCR(e)&&this.fixCRLF(e,t)}}validateCRLFWithNextNode(t){if(this.shouldCheckCRLF()&&this.endWithCR(t)){let e=t.next();this.startWithLF(e)&&this.fixCRLF(t,e)}}fixCRLF(t,e){let n=[],o=this._buffers[t.piece.bufferIndex].lineStarts,i;t.piece.end.column===0?i={line:t.piece.end.line-1,column:o[t.piece.end.line]-o[t.piece.end.line-1]-1}:i={line:t.piece.end.line,column:t.piece.end.column-1};let s=t.piece.length-1,a=t.piece.lineFeedCnt-1;t.piece=new Po(t.piece.bufferIndex,t.piece.start,i,a,s),zs(this,t,-1,-1),t.piece.length===0&&n.push(t);let l={line:e.piece.start.line+1,column:0},d=e.piece.length-1,c=this.getLineFeedCnt(e.piece.bufferIndex,l,e.piece.end);e.piece=new Po(e.piece.bufferIndex,l,e.piece.end,c,d),zs(this,e,-1,-1),e.piece.length===0&&n.push(e);let u=this.createNewPieces(`\r
`);this.rbInsertRight(t,u[0]);for(let m=0;m<n.length;m++)xy(this,n[m])}adjustCarriageReturnFromNext(t,e){if(this.shouldCheckCRLF()&&this.endWithCR(t)){let n=e.next();if(this.startWithLF(n)){if(t+=`
`,n.piece.length===1)xy(this,n);else{let o=n.piece,i={line:o.start.line+1,column:0},s=o.length-1,a=this.getLineFeedCnt(o.bufferIndex,i,o.end);n.piece=new Po(o.bufferIndex,i,o.end,a,s),zs(this,n,-1,-1)}return!0}}return!1}iterate(t,e){if(t===xe)return e(xe);let n=this.iterate(t.left,e);return n&&e(t)&&this.iterate(t.right,e)}getNodeContent(t){if(t===xe)return"";let e=this._buffers[t.piece.bufferIndex],n=t.piece,o=this.offsetInBuffer(n.bufferIndex,n.start),i=this.offsetInBuffer(n.bufferIndex,n.end);return e.buffer.substring(o,i)}getPieceContent(t){let e=this._buffers[t.bufferIndex],n=this.offsetInBuffer(t.bufferIndex,t.start),o=this.offsetInBuffer(t.bufferIndex,t.end);return e.buffer.substring(n,o)}rbInsertRight(t,e){let n=new Uf(e,1);if(n.left=xe,n.right=xe,n.parent=xe,n.size_left=0,n.lf_left=0,this.root===xe)this.root=n,n.color=0;else if(t.right===xe)t.right=n,n.parent=t;else{let i=yk(t.right);i.left=n,n.parent=i}return SO(this,n),n}rbInsertLeft(t,e){let n=new Uf(e,1);if(n.left=xe,n.right=xe,n.parent=xe,n.size_left=0,n.lf_left=0,this.root===xe)this.root=n,n.color=0;else if(t.left===xe)t.left=n,n.parent=t;else{let o=yO(t.left);o.right=n,n.parent=o}return SO(this,n),n}getContentOfSubTree(t){let e="";return this.iterate(t,n=>(e+=this.getNodeContent(n),!0)),e}};function xk(r){let t=0,e=0,n=0,o=0;for(let i=0,s=r.length;i<s;i++){let a=r.charCodeAt(i);a===13?(t===0&&(e=i),t++,i+1<s&&r.charCodeAt(i+1)===10?(o|=2,i++):o|=3,n=i+1):a===10&&(o|=1,t===0&&(e=i),t++,n=i+1)}return t===0&&(e=r.length),[t,e,r.length-n,o]}var wO;function nQ(){return wO||(wO=new TextDecoder("UTF-16LE")),wO}function C5(r,t,e){let n=new Uint16Array(r.buffer,t,e);return e>0&&(n[0]===65279||n[0]===65534)?oQ(r,t,e):nQ().decode(n)}function oQ(r,t,e){let n=[],o=0;for(let i=0;i<e;i++){let s=sF(r,t);t+=2,n[o++]=String.fromCharCode(s)}return n.join("")}function Sk(r){return r.replace(/\n/g,"\\n").replace(/\r/g,"\\r")}var Ck=class r{constructor(t,e,n,o){this.oldPosition=t;this.oldText=e;this.newPosition=n;this.newText=o}get oldLength(){return this.oldText.length}get oldEnd(){return this.oldPosition+this.oldText.length}get newLength(){return this.newText.length}get newEnd(){return this.newPosition+this.newText.length}toString(){return this.oldText.length===0?`(insert@${this.oldPosition} "${Sk(this.newText)}")`:this.newText.length===0?`(delete@${this.oldPosition} "${Sk(this.oldText)}")`:`(replace@${this.oldPosition} "${Sk(this.oldText)}" with "${Sk(this.newText)}")`}static _writeStringSize(t){return 4+2*t.length}static _writeString(t,e,n){let o=e.length;wh(t,o,n),n+=4;for(let i=0;i<o;i++)aF(t,e.charCodeAt(i),n),n+=2;return n}static _readString(t,e){let n=Eh(t,e);return e+=4,C5(t,e,n)}writeSize(){return 8+r._writeStringSize(this.oldText)+r._writeStringSize(this.newText)}write(t,e){return wh(t,this.oldPosition,e),e+=4,wh(t,this.newPosition,e),e+=4,e=r._writeString(t,this.oldText,e),e=r._writeString(t,this.newText,e),e}static read(t,e,n){let o=Eh(t,e);e+=4;let i=Eh(t,e);e+=4;let s=r._readString(t,e);e+=r._writeStringSize(s);let a=r._readString(t,e);return e+=r._writeStringSize(a),n.push(new r(o,s,i,a)),e}};var Tk=class r extends O{constructor(e,n,o,i,s,a,l){super();this._onDidChangeContent=this._register(new E);this._BOM=n,this._mightContainNonBasicASCII=!a,this._mightContainRTL=i,this._mightContainUnusualLineTerminators=s,this._pieceTree=new Ik(e,o,l)}get onDidChangeContent(){return this._onDidChangeContent.event}equals(e){return!(e instanceof r)||this._BOM!==e._BOM||this.getEOL()!==e.getEOL()?!1:this._pieceTree.equal(e._pieceTree)}mightContainRTL(){return this._mightContainRTL}mightContainUnusualLineTerminators(){return this._mightContainUnusualLineTerminators}resetMightContainUnusualLineTerminators(){this._mightContainUnusualLineTerminators=!1}mightContainNonBasicASCII(){return this._mightContainNonBasicASCII}getBOM(){return this._BOM}getEOL(){return this._pieceTree.getEOL()}createSnapshot(e){return this._pieceTree.createSnapshot(e?this._BOM:"")}getOffsetAt(e,n){return this._pieceTree.getOffsetAt(e,n)}getPositionAt(e){return this._pieceTree.getPositionAt(e)}getRangeAt(e,n){let o=e+n,i=this.getPositionAt(e),s=this.getPositionAt(o);return new We(i.lineNumber,i.column,s.lineNumber,s.column)}getValueInRange(e,n=0){if(e.isEmpty())return"";let o=this._getEndOfLine(n);return this._pieceTree.getValueInRange(e,o)}getValueLengthInRange(e,n=0){if(e.isEmpty())return 0;if(e.startLineNumber===e.endLineNumber)return e.endColumn-e.startColumn;let o=this.getOffsetAt(e.startLineNumber,e.startColumn),i=this.getOffsetAt(e.endLineNumber,e.endColumn),s=0,a=this._getEndOfLine(n),l=this.getEOL();if(a.length!==l.length){let d=a.length-l.length,c=e.endLineNumber-e.startLineNumber;s=d*c}return i-o+s}getCharacterCountInRange(e,n=0){if(this._mightContainNonBasicASCII){let o=0,i=e.startLineNumber,s=e.endLineNumber;for(let a=i;a<=s;a++){let l=this.getLineContent(a),d=a===i?e.startColumn-1:0,c=a===s?e.endColumn-1:l.length;for(let u=d;u<c;u++)ec(l.charCodeAt(u))?(o=o+1,u=u+1):o=o+1}return o+=this._getEndOfLine(n).length*(s-i),o}return this.getValueLengthInRange(e,n)}getNearestChunk(e){return this._pieceTree.getNearestChunk(e)}getLength(){return this._pieceTree.getLength()}getLineCount(){return this._pieceTree.getLineCount()}getLinesContent(){return this._pieceTree.getLinesContent()}getLineContent(e){return this._pieceTree.getLineContent(e)}getLineCharCode(e,n){return this._pieceTree.getLineCharCode(e,n)}getCharCode(e){return this._pieceTree.getCharCode(e)}getLineLength(e){return this._pieceTree.getLineLength(e)}getLineMinColumn(e){return 1}getLineMaxColumn(e){return this.getLineLength(e)+1}getLineFirstNonWhitespaceColumn(e){let n=pI(this.getLineContent(e));return n===-1?0:n+1}getLineLastNonWhitespaceColumn(e){let n=kU(this.getLineContent(e));return n===-1?0:n+2}_getEndOfLine(e){switch(e){case 1:return`
`;case 2:return`\r
`;case 0:return this.getEOL();default:throw new Error("Unknown EOL preference")}}setEOL(e){this._pieceTree.setEOL(e)}applyEdits(e,n,o){let i=this._mightContainRTL,s=this._mightContainUnusualLineTerminators,a=this._mightContainNonBasicASCII,l=!0,d=[];for(let I=0;I<e.length;I++){let S=e[I];l&&S._isTracked&&(l=!1);let T=S.range;if(S.text){let B=!0;a||(B=!DU(S.text),a=B),!i&&B&&(i=fI(S.text)),!s&&B&&(s=hI(S.text))}let P="",L=0,q=0,N=0;if(S.text){let B;[L,q,N,B]=xk(S.text);let G=this.getEOL(),J=G===`\r
`?2:1;B===0||B===J?P=S.text:P=S.text.replace(/\r\n|\r|\n/g,G)}d[I]={sortIndex:I,identifier:S.identifier||null,range:T,rangeOffset:this.getOffsetAt(T.startLineNumber,T.startColumn),rangeLength:this.getValueLengthInRange(T),text:P,eolCount:L,firstLineLength:q,lastLineLength:N,forceMoveMarkers:!!S.forceMoveMarkers,isAutoWhitespaceEdit:S.isAutoWhitespaceEdit||!1}}d.sort(r._sortOpsAscending);let c=!1;for(let I=0,S=d.length-1;I<S;I++){let T=d[I].range.getEndPosition(),P=d[I+1].range.getStartPosition();if(P.isBeforeOrEqual(T)){if(P.isBefore(T))throw new Error("Overlapping ranges are not allowed!");c=!0}}l&&(d=this._reduceOperations(d));let u=o||n?r._getInverseEditRanges(d):[],m=[];if(n)for(let I=0;I<d.length;I++){let S=d[I],T=u[I];if(S.isAutoWhitespaceEdit&&S.range.isEmpty())for(let P=T.startLineNumber;P<=T.endLineNumber;P++){let L="";P===T.startLineNumber&&(L=this.getLineContent(S.range.startLineNumber),pI(L)!==-1)||m.push({lineNumber:P,oldContent:L})}}let g=null;if(o){let I=0;g=[];for(let S=0;S<d.length;S++){let T=d[S],P=u[S],L=this.getValueInRange(T.range),q=T.rangeOffset+I;I+=T.text.length-L.length,g[S]={sortIndex:T.sortIndex,identifier:T.identifier,range:P,text:L,textChange:new Ck(T.rangeOffset,L,q,T.text)}}c||g.sort((S,T)=>S.sortIndex-T.sortIndex)}this._mightContainRTL=i,this._mightContainUnusualLineTerminators=s,this._mightContainNonBasicASCII=a;let h=this._doApplyEdits(d),f=null;if(n&&m.length>0){m.sort((I,S)=>S.lineNumber-I.lineNumber),f=[];for(let I=0,S=m.length;I<S;I++){let T=m[I].lineNumber;if(I>0&&m[I-1].lineNumber===T)continue;let P=m[I].oldContent,L=this.getLineContent(T);L.length===0||L===P||pI(L)!==-1||f.push(T)}}return this._onDidChangeContent.fire(),new Ix(g,h,f)}_reduceOperations(e){return e.length<1e3?e:[this._toSingleEditOperation(e)]}_toSingleEditOperation(e){let n=!1,o=e[0].range,i=e[e.length-1].range,s=new We(o.startLineNumber,o.startColumn,i.endLineNumber,i.endColumn),a=o.startLineNumber,l=o.startColumn,d=[];for(let h=0,f=e.length;h<f;h++){let I=e[h],S=I.range;n=n||I.forceMoveMarkers,d.push(this.getValueInRange(new We(a,l,S.startLineNumber,S.startColumn))),I.text.length>0&&d.push(I.text),a=S.endLineNumber,l=S.endColumn}let c=d.join(""),[u,m,g]=xk(c);return{sortIndex:0,identifier:e[0].identifier,range:s,rangeOffset:this.getOffsetAt(s.startLineNumber,s.startColumn),rangeLength:this.getValueLengthInRange(s,0),text:c,eolCount:u,firstLineLength:m,lastLineLength:g,forceMoveMarkers:n,isAutoWhitespaceEdit:!1}}_doApplyEdits(e){e.sort(r._sortOpsDescending);let n=[];for(let o=0;o<e.length;o++){let i=e[o],s=i.range.startLineNumber,a=i.range.startColumn,l=i.range.endLineNumber,d=i.range.endColumn;if(s===l&&a===d&&i.text.length===0)continue;i.text?(this._pieceTree.delete(i.rangeOffset,i.rangeLength),this._pieceTree.insert(i.rangeOffset,i.text,!0)):this._pieceTree.delete(i.rangeOffset,i.rangeLength);let c=new We(s,a,l,d);n.push({range:c,rangeLength:i.rangeLength,text:i.text,rangeOffset:i.rangeOffset,forceMoveMarkers:i.forceMoveMarkers})}return n}findMatchesLineByLine(e,n,o,i){return this._pieceTree.findMatchesLineByLine(e,n,o,i)}getPieceTree(){return this._pieceTree}static _getInverseEditRange(e,n){let o=e.startLineNumber,i=e.startColumn,[s,a,l]=xk(n),d;if(n.length>0){let c=s+1;c===1?d=new We(o,i,o,i+a):d=new We(o,i,o+c-1,l+1)}else d=new We(o,i,o,i);return d}static _getInverseEditRanges(e){let n=[],o=0,i=0,s=null;for(let a=0,l=e.length;a<l;a++){let d=e[a],c,u;s?s.range.endLineNumber===d.range.startLineNumber?(c=o,u=i+(d.range.startColumn-s.range.endColumn)):(c=o+(d.range.startLineNumber-s.range.endLineNumber),u=d.range.startColumn):(c=d.range.startLineNumber,u=d.range.startColumn);let m;if(d.text.length>0){let g=d.eolCount+1;g===1?m=new We(c,u,c,u+d.firstLineLength):m=new We(c,u,c+g-1,d.lastLineLength+1)}else m=new We(c,u,c,u);o=m.endLineNumber,i=m.endColumn,n.push(m),s=d}return n}static _sortOpsAscending(e,n){let o=We.compareRangesUsingEnds(e.range,n.range);return o===0?e.sortIndex-n.sortIndex:o}static _sortOpsDescending(e,n){let o=We.compareRangesUsingEnds(e.range,n.range);return o===0?n.sortIndex-e.sortIndex:-o}};var kO=class{constructor(t,e,n,o,i,s,a,l,d){this._chunks=t;this._bom=e;this._cr=n;this._lf=o;this._crlf=i;this._containsRTL=s;this._containsUnusualLineTerminators=a;this._isBasicASCII=l;this._normalizeEOL=d}_getEOL(t){let e=this._cr+this._lf+this._crlf,n=this._cr+this._crlf;return e===0?t===1?`
`:`\r
`:n>e/2?`\r
`:`
`}create(t){let e=this._getEOL(t),n=this._chunks;if(this._normalizeEOL&&(e===`\r
`&&(this._cr>0||this._lf>0)||e===`
`&&(this._cr>0||this._crlf>0)))for(let i=0,s=n.length;i<s;i++){let a=n[i].buffer.replace(/\r\n|\r|\n/g,e),l=qs(a);n[i]=new Ks(a,l)}let o=new Tk(n,this._bom,e,this._containsRTL,this._containsUnusualLineTerminators,this._isBasicASCII,this._normalizeEOL);return{textBuffer:o,disposable:o}}getFirstLineText(t){return this._chunks[0].buffer.substr(0,t).split(/\r\n|\r|\n/)[0]}},Sy=class{constructor(){this.chunks=[],this.BOM="",this._hasPreviousChar=!1,this._previousChar=0,this._tmpLineStarts=[],this.cr=0,this.lf=0,this.crlf=0,this.containsRTL=!1,this.containsUnusualLineTerminators=!1,this.isBasicASCII=!0}acceptChunk(t){if(t.length===0)return;this.chunks.length===0&&AU(t)&&(this.BOM=RU,t=t.substr(1));let e=t.charCodeAt(t.length-1);e===13||e>=55296&&e<=56319?(this._acceptChunk1(t.substr(0,t.length-1),!1),this._hasPreviousChar=!0,this._previousChar=e):(this._acceptChunk1(t,!1),this._hasPreviousChar=!1,this._previousChar=e)}_acceptChunk1(t,e){!e&&t.length===0||(this._hasPreviousChar?this._acceptChunk2(String.fromCharCode(this._previousChar)+t):this._acceptChunk2(t))}_acceptChunk2(t){let e=S5(this._tmpLineStarts,t);this.chunks.push(new Ks(t,e.lineStarts)),this.cr+=e.cr,this.lf+=e.lf,this.crlf+=e.crlf,e.isBasicASCII||(this.isBasicASCII=!1,this.containsRTL||(this.containsRTL=fI(t)),this.containsUnusualLineTerminators||(this.containsUnusualLineTerminators=hI(t)))}finish(t=!0){return this._finish(),new kO(this.chunks,this.BOM,this.cr,this.lf,this.crlf,this.containsRTL,this.containsUnusualLineTerminators,this.isBasicASCII,t)}_finish(){if(this.chunks.length===0&&this._acceptChunk1("",!0),this._hasPreviousChar){this._hasPreviousChar=!1;let t=this.chunks[this.chunks.length-1];t.buffer+=String.fromCharCode(this._previousChar);let e=qs(t.buffer);t.lineStarts=e,this._previousChar===13&&this.cr++}}};var Ek=class extends O{constructor(e,n,o){super();this._source=e;this._inputTextBuffer=n;this._outputs=o;this._outputTextBuffers=void 0}_getFullModelRange(e){let n=e.getLineCount();return new We(1,1,n,this._getLineMaxColumn(e,n))}_getLineMaxColumn(e,n){if(n<1||n>e.getLineCount())throw new Error("Illegal value for lineNumber");return e.getLineLength(n)+1}get inputTextBuffer(){if(!this._inputTextBuffer){let e=new Sy;e.acceptChunk(this._source);let n=e.finish(!0),{textBuffer:o,disposable:i}=n.create(1);this._inputTextBuffer=o,this._register(i)}return this._inputTextBuffer}get outputTextBuffers(){return this._outputTextBuffers||(this._outputTextBuffers=this._outputs.map(e=>{let n=new Sy;n.acceptChunk(e);let o=n.finish(!0),{textBuffer:i,disposable:s}=o.create(1);return this._register(s),i})),this._outputTextBuffers}findInInputs(e){let o=new kb(e,!1,!1,null).parseSearchRequest();if(!o)return[];let i=this._getFullModelRange(this.inputTextBuffer);return this.inputTextBuffer.findMatchesLineByLine(i,o,!0,5e3)}findInOutputs(e){let o=new kb(e,!1,!1,null).parseSearchRequest();return o?this.outputTextBuffers.map(i=>{let s=i.findMatchesLineByLine(this._getFullModelRange(i),o,!0,5e3);if(s.length!==0)return{textBuffer:i,matches:s}}).filter(i=>!!i):[]}};function PO(r,t){let e=-1,n=[],o=[];return r.forEach(s=>{s.range.startLineNumber!==e&&o.length>0&&(n.push([...o]),o=[]),o.push(s),e=s.range.endLineNumber}),o.length>0&&n.push([...o]),n.map(s=>{let a=[],l=s[0].range.startLineNumber,d=s[s.length-1].range.endLineNumber;for(let c=l;c<=d;c++)a.push(t.getLineContent(c));return new Zm(a.join(`
`)+`
`,s.map(c=>new We(c.range.startLineNumber-1,c.range.startColumn-1,c.range.endLineNumber-1,c.range.endColumn-1)))})}var Yut=Object.freeze({id:"application",order:100,title:p(4830,null),type:"object"}),T5=Object.freeze({id:"workbench",order:7,title:p(4838,null),type:"object"}),iQ=Object.freeze({id:"security",scope:1,title:p(4836,null),type:"object",order:7}),Xut=Object.freeze({id:"problems",title:p(4832,null),type:"object",order:101}),sQ=Object.freeze({id:"window",order:8,title:p(4837,null),type:"object"}),aQ={ConfigurationMigration:"base.contributions.configuration.migration"},_O=class{constructor(){this.migrations=[];this._onDidRegisterConfigurationMigrations=new E;this.onDidRegisterConfigurationMigration=this._onDidRegisterConfigurationMigrations.event}registerConfigurationMigrations(t){this.migrations.push(...t)}},_k=new _O;vt.add(aQ.ConfigurationMigration,_k);var wk=class extends O{constructor(e,n){super();this.configurationService=e;this.workspaceService=n;this._register(this.workspaceService.onDidChangeWorkspaceFolders(async o=>{for(let i of o.added)await this.migrateConfigurationsForFolder(i,_k.migrations)})),this.migrateConfigurations(_k.migrations),this._register(_k.onDidRegisterConfigurationMigration(o=>this.migrateConfigurations(o)))}static{this.ID="workbench.contrib.configurationMigration"}async migrateConfigurations(e){await this.migrateConfigurationsForFolder(void 0,e);for(let n of this.workspaceService.getWorkspace().folders)await this.migrateConfigurationsForFolder(n,e)}async migrateConfigurationsForFolder(e,n){await Promise.all([n.map(o=>this.migrateConfigurationsForFolderAndOverride(o,e?.uri))])}async migrateConfigurationsForFolderAndOverride(e,n){let o=this.configurationService.inspect(e.key,{resource:n}),i=this.workspaceService.getWorkbenchState()===3?[["user",2],["userLocal",3],["userRemote",4],["workspace",5],["workspaceFolder",6]]:[["user",2],["userLocal",3],["userRemote",4],["workspace",5]];for(let[s,a]of i){let l=o[s];if(!l)continue;let d=[];if(l.value!==void 0){let c=await this.runMigration(e,s,l.value,n,void 0);for(let u of c??[])d.push([u,[]])}for(let{identifiers:c,value:u}of l.overrides??[])if(u!==void 0){let m=await this.runMigration(e,s,u,n,c);for(let g of m??[])d.push([g,c])}d.length&&await Promise.allSettled(d.map(async([[c,u],m])=>this.configurationService.updateValue(c,u.value,{resource:n,overrideIdentifiers:m},a)))}}async runMigration(e,n,o,i,s){let a=d=>{let u=this.configurationService.inspect(d,{resource:i})[n];if(u)return s?u.overrides?.find(({identifiers:m})=>qt(m,s))?.value:u.value},l=await e.migrateFn(o,a);return Array.isArray(l)?l:[[e.key,l]]}};wk=_([C(0,Kt),C(1,cs)],wk);var kk=class extends O{constructor(e){super();this.remoteAgentService=e;this._ready=new Jt;this.ready=this._ready.p;this.create()}static{this.ID="workbench.contrib.dynamicWorkbenchSecurityConfiguration"}async create(){try{await this.doCreate()}finally{this._ready.complete()}}async doCreate(){if(!Ie&&(await this.remoteAgentService.getEnvironment())?.os!==1)return;vt.as(xr.Configuration).registerConfiguration({...iQ,properties:{"security.allowedUNCHosts":{type:"array",items:{type:"string",pattern:"^[^\\\\]+$",patternErrorMessage:p(4834,null)},default:[],markdownDescription:p(4833,null),scope:3},"security.restrictUNCAccess":{type:"boolean",default:!0,markdownDescription:p(4835,null),scope:3}}})}};kk=_([C(0,kg)],kk);var Cy="window.newWindowProfile",Pk=class extends O{constructor(e,n){super();this.userDataProfilesService=e;this.configurationService=n;this.registerNewWindowProfileConfiguration(),this._register(this.userDataProfilesService.onDidChangeProfiles(o=>this.registerNewWindowProfileConfiguration())),this.setNewWindowProfile(),this.checkAndResetNewWindowProfileConfig(),this._register(n.onDidChangeConfiguration(o=>{o.source!==7&&o.affectsConfiguration(Cy)&&this.setNewWindowProfile()})),this._register(this.userDataProfilesService.onDidChangeProfiles(()=>this.checkAndResetNewWindowProfileConfig()))}static{this.ID="workbench.contrib.dynamicWindowConfiguration"}registerNewWindowProfileConfiguration(){let e=vt.as(xr.Configuration),n={...sQ,properties:{[Cy]:{type:["string","null"],default:null,enum:[...this.userDataProfilesService.profiles.map(o=>o.name),null],enumItemLabels:[...this.userDataProfilesService.profiles.map(()=>""),p(4829,null)],description:p(4831,null),scope:1}}};this.configurationNode?e.updateConfigurations({add:[n],remove:[this.configurationNode]}):e.registerConfiguration(n),this.configurationNode=n}setNewWindowProfile(){let e=this.configurationService.getValue(Cy);this.newWindowProfile=e?this.userDataProfilesService.profiles.find(n=>n.name===e):void 0}checkAndResetNewWindowProfileConfig(){let e=this.configurationService.getValue(Cy);if(!e)return;let n=this.newWindowProfile?this.userDataProfilesService.profiles.find(o=>o.id===this.newWindowProfile.id):void 0;e!==n?.name&&this.configurationService.updateValue(Cy,n?.name)}};Pk=_([C(0,nW),C(1,Kt)],Pk);var upt=R("editorResolverService");var lQ=vt.as(xr.Configuration),dQ={...T5,properties:{"workbench.editorAssociations":{type:"object",markdownDescription:p(17546,null),additionalProperties:{type:"string"}}}};lQ.registerConfiguration(dQ);function E5(r,t){if(new Set([V.extension,V.webviewPanel,V.vscodeWorkspaceTrust,V.vscodeSettings]).has(t.scheme))return!1;let o=typeof r=="string"&&r.indexOf(Ge.sep)>=0?`${t.scheme}:${t.path}`:Tt(t);return nr(r,o,{ignoreCase:!0})}var Dk=class r{constructor(t,e,n,o,i,s,a){this._textDocumentsAndEditors=n;this._textDocuments=o;this._extHostFileSystem=i;this._extHostSearch=s;this._logService=a;this._notebookStatusBarItemProviders=new Map;this._documents=new Ke;this._editors=new Map;this._onDidChangeActiveNotebookEditor=new E;this.onDidChangeActiveNotebookEditor=this._onDidChangeActiveNotebookEditor.event;this._visibleNotebookEditors=[];this._onDidOpenNotebookDocument=new E;this.onDidOpenNotebookDocument=this._onDidOpenNotebookDocument.event;this._onDidCloseNotebookDocument=new E;this.onDidCloseNotebookDocument=this._onDidCloseNotebookDocument.event;this._onDidChangeVisibleNotebookEditors=new E;this.onDidChangeVisibleNotebookEditors=this._onDidChangeVisibleNotebookEditors.event;this._statusBarCache=new qo("NotebookCellStatusBarCache");this._handlePool=0;this._notebookSerializer=new Map;this._notebookProxy=t.getProxy(F.MainThreadNotebook),this._notebookDocumentsProxy=t.getProxy(F.MainThreadNotebookDocuments),this._notebookEditorsProxy=t.getProxy(F.MainThreadNotebookEditors),this._commandsConverter=e.converter,e.registerArgumentProcessor({processArgument:l=>{if(l&&l.$mid===13){let d=l.notebookEditor?.notebookUri,c=l.cell.handle,m=this._documents.get(d)?.getCell(c);if(m)return m.apiCell}if(l&&l.$mid===14){let d=l.uri,c=this._documents.get(d);if(c)return c.apiNotebook}return l}}),r._registerApiCommands(e)}static{this._notebookStatusBarItemProviderHandlePool=0}get activeNotebookEditor(){return this._activeNotebookEditor?.apiEditor}get visibleNotebookEditors(){return this._visibleNotebookEditors.map(t=>t.apiEditor)}getEditorById(t){let e=this._editors.get(t);if(!e)throw new Error(`unknown text editor: ${t}. known editors: ${[...this._editors.keys()]} `);return e}getIdByEditor(t){for(let[e,n]of this._editors)if(n.apiEditor===t)return e}get notebookDocuments(){return[...this._documents.values()]}getNotebookDocument(t,e){let n=this._documents.get(t);if(!n&&!e)throw new Error(`NO notebook document for '${t}'`);return n}static _convertNotebookRegistrationData(t,e){if(!e)return;let n=e.filenamePattern.map(o=>ib.from(o)).filter(o=>o!==void 0);if(e.filenamePattern&&!n){console.warn(`Notebook content provider view options file name pattern is invalid ${e.filenamePattern}`);return}return{extension:t.identifier,providerDisplayName:t.displayName||t.name,displayName:e.displayName,filenamePattern:n,priority:e.exclusive?"exclusive":void 0}}registerNotebookCellStatusBarItemProvider(t,e,n){let o=r._notebookStatusBarItemProviderHandlePool++,i=typeof n.onDidChangeCellStatusBarItems=="function"?r._notebookStatusBarItemProviderHandlePool++:void 0;this._notebookStatusBarItemProviders.set(o,n),this._notebookProxy.$registerNotebookCellStatusBarItemProvider(o,i,e);let s;return i!==void 0&&(s=n.onDidChangeCellStatusBarItems(a=>this._notebookProxy.$emitCellStatusBarEvent(i))),new be(()=>{this._notebookStatusBarItemProviders.delete(o),this._notebookProxy.$unregisterNotebookCellStatusBarItemProvider(o,i),s?.dispose()})}async createNotebookDocument(t){let e=await this._notebookDocumentsProxy.$tryCreateNotebook({viewType:t.viewType,content:t.content&&ud.from(t.content)});return b.revive(e)}async openNotebookDocument(t){let e=this._documents.get(t);if(e)return e.apiNotebook;let n=await this._notebookDocumentsProxy.$tryOpenNotebook(t),o=this._documents.get(b.revive(n));return pi(o?.apiNotebook)}async showNotebookDocument(t,e){let n;typeof e=="object"?n={position:Vt.from(e.viewColumn),preserveFocus:e.preserveFocus,selections:e.selections&&e.selections.map(Fr.from),pinned:typeof e.preview=="boolean"?!e.preview:void 0,label:typeof e.asRepl=="string"?e.asRepl:typeof e.asRepl=="object"?e.asRepl.label:void 0}:n={preserveFocus:!1,pinned:!0};let o=e?.asRepl?"repl":t.notebookType,i=await this._notebookEditorsProxy.$tryShowNotebookDocument(t.uri,o,n),s=i&&this._editors.get(i)?.apiEditor;if(s)return s;throw i?new Error(`Could NOT open editor for "${t.uri.toString()}" because another editor opened in the meantime.`):new Error(`Could NOT open editor for "${t.uri.toString()}".`)}async $provideNotebookCellStatusBarItems(t,e,n,o){let i=this._notebookStatusBarItemProviders.get(t),s=b.revive(e),a=this._documents.get(s);if(!a||!i)return;let l=a.getCellFromIndex(n);if(!l)return;let d=await i.provideCellStatusBarItems(l.apiCell,o);if(!d)return;let c=new $,u=this._statusBarCache.add([c]),g=(Array.isArray(d)?d:[d]).map(h=>lM.from(h,this._commandsConverter,c));return{cacheId:u,items:g}}$releaseNotebookCellStatusBarItems(t){this._statusBarCache.delete(t)}registerNotebookSerializer(t,e,n,o,i){if(rs(e))throw new Error("viewType cannot be empty or just whitespace");let s=this._handlePool++;return this._notebookSerializer.set(s,{viewType:e,serializer:n,options:o}),this._notebookProxy.$registerNotebookSerializer(s,{id:t.identifier,location:t.extensionLocation},e,cM.from(o),r._convertNotebookRegistrationData(t,i)),K(()=>{this._notebookProxy.$unregisterNotebookSerializer(s)})}async $dataToNotebook(t,e,n){let o=this._notebookSerializer.get(t);if(!o)throw new Error("NO serializer found");let i=await o.serializer.deserializeNotebook(e.buffer,n);return new Gt(ud.from(i))}async $notebookToData(t,e,n){let o=this._notebookSerializer.get(t);if(!o)throw new Error("NO serializer found");let i=await o.serializer.serializeNotebook(ud.to(e.value),n);return H.wrap(i)}async $saveNotebook(t,e,n,o,i){let s=b.revive(e),a=this._notebookSerializer.get(t);this.trace(`enter saveNotebook(versionId: ${n}, ${s.toString()})`);try{if(!a)throw new Ty("NO serializer found");let l=this._documents.get(s);if(!l)throw new Ty("Document NOT found");if(l.versionId!==n)throw new Ty("Document version mismatch, expected: "+n+", actual: "+l.versionId);if(!this._extHostFileSystem.value.isWritableFileSystem(s.scheme))throw new Cl(p(3496,null,this._resourceForError(s)),6);let d={metadata:Z_(l.apiNotebook.metadata,h=>!(a.options?.transientDocumentMetadata??{})[h]),cells:[]};for(let h of l.apiNotebook.getCells()){let f=new bs(h.kind,h.document.getText(),h.document.languageId,h.mime,a.options?.transientOutputs?[]:[...h.outputs],h.metadata,h.executionSummary);f.metadata=Z_(h.metadata,I=>!(a.options?.transientCellMetadata??{})[I]),d.cells.push(f)}if(await this._validateWriteFile(s,o),i.isCancellationRequested)throw new Be;let c=await a.serializer.serializeNotebook(d,i);if(i.isCancellationRequested)throw new Be;this.trace(`serialized versionId: ${n} ${s.toString()}`),await this._extHostFileSystem.value.writeFile(s,c),this.trace(`Finished write versionId: ${n} ${s.toString()}`);let u=this._extHostFileSystem.getFileSystemProviderExtUri(s.scheme),m=await this._extHostFileSystem.value.stat(s),g={name:u.basename(s),isFile:(m.type&1)!==0,isDirectory:(m.type&2)!==0,isSymbolicLink:(m.type&64)!==0,mtime:m.mtime,ctime:m.ctime,size:m.size,readonly:!!((m.permissions??0)&1)||!this._extHostFileSystem.value.isWritableFileSystem(s.scheme),locked:!!((m.permissions??0)&2),executable:!!((m.permissions??0)&4),etag:mR({mtime:m.mtime,size:m.size})};return this.trace(`exit saveNotebook(versionId: ${n}, ${s.toString()})`),g}catch(l){if(l instanceof Cl)return{...l,message:l.message};throw l}}async $searchInNotebooks(t,e,n,o,i){let s=this._notebookSerializer.get(t)?.serializer;if(!s)return{limitHit:!1,results:[]};let a=new kr;await(async(m,g,h)=>{await Promise.all(m.map(async f=>await Promise.all(f.filenamePatterns.map(I=>{let S={_reason:h._reason,folderQueries:h.folderQueries,includePattern:h.includePattern,excludePattern:h.excludePattern,maxResults:h.maxResults,type:1,filePattern:I};return this._extHostSearch.doInternalFileSearchWithCustomCallback(S,g,T=>{T.forEach(P=>{a.has(P)||o.some(q=>f.isFromSettings&&!q.isFromSettings?!1:q.filenamePatterns.some(N=>E5(N,P)))||a.add(P)})}).catch(T=>{if(T.code==="ENOENT")return console.warn("Could not find notebook search results, ignoring notebook results."),{limitHit:!1,messages:[]};throw T})}))))})(n,i,e);let d=new Ke,c=!1,u=Array.from(a).map(async m=>{let g=[];try{if(i.isCancellationRequested)return;if(e.maxResults&&[...d.values()].reduce((S,T)=>S+T.cellResults.length,0)>e.maxResults){c=!0;return}let h=[],f=this._documents.get(m);if(f)f.apiNotebook.getCells().forEach(T=>h.push({input:T.document.getText(),outputs:T.outputs.flatMap(P=>P.items.map(L=>L.data.toString()))}));else{let S=await this._extHostFileSystem.value.readFile(m),T=H.fromString(S.toString()),P=await s.deserializeNotebook(T.buffer,i);if(i.isCancellationRequested)return;ud.from(P).cells.forEach(q=>h.push({input:q.source,outputs:q.outputs.flatMap(N=>N.items.map(B=>B.valueBytes.toString()))}))}if(i.isCancellationRequested)return;h.forEach((S,T)=>{let P=e.contentPattern.pattern,L=new Ek(S.input,void 0,S.outputs),q=L.findInInputs(P),N=L.findInOutputs(P),B=N.flatMap(G=>PO(G.matches,G.textBuffer)).map((G,J)=>(G.webviewIndex=J,G));if(q.length>0||N.length>0){let G={index:T,contentResults:PO(q,L.inputTextBuffer),webviewResults:B};g.push(G)}});let I={resource:m,cellResults:g};d.set(m,I);return}catch{return}});return await Promise.all(u),{limitHit:c,results:[...d.values()]}}async _validateWriteFile(t,e){let n=await this._extHostFileSystem.value.stat(t);if(typeof e?.mtime=="number"&&typeof e.etag=="string"&&e.etag!==d2&&typeof n.mtime=="number"&&typeof n.size=="number"&&e.mtime<n.mtime&&e.etag!==mR({mtime:e.mtime,size:n.size}))throw new Cl(p(3497,null),3,e)}_resourceForError(t){return t.scheme===V.file?t.fsPath:t.toString()}_createExtHostEditor(t,e,n){if(this._editors.has(e))throw new Error(`editor with id ALREADY EXSIST: ${e}`);let o=new Hu(e,this._notebookEditorsProxy,t,n.visibleRanges.map(Fr.to),n.selections.map(Fr.to),typeof n.viewColumn=="number"?Vt.to(n.viewColumn):void 0,n.viewType);this._editors.set(e,o)}$acceptDocumentAndEditorsDelta(t){if(t.value.removedDocuments)for(let n of t.value.removedDocuments){let o=b.revive(n),i=this._documents.get(o);i&&(i.dispose(),this._documents.delete(o),this._textDocumentsAndEditors.$acceptDocumentsAndEditorsDelta({removedDocuments:i.apiNotebook.getCells().map(s=>s.document.uri)}),this._onDidCloseNotebookDocument.fire(i.apiNotebook));for(let s of this._editors.values())s.notebookData.uri.toString()===o.toString()&&this._editors.delete(s.id)}if(t.value.addedDocuments){let n=[];for(let o of t.value.addedDocuments){let i=b.revive(o.uri);if(this._documents.has(i))throw new Error(`adding EXISTING notebook ${i} `);let s=new bk(this._notebookDocumentsProxy,this._textDocumentsAndEditors,this._textDocuments,i,o);n.push(...o.cells.map(a=>Nf.asModelAddData(a))),this._documents.get(i)?.dispose(),this._documents.set(i,s),this._textDocumentsAndEditors.$acceptDocumentsAndEditorsDelta({addedDocuments:n}),this._onDidOpenNotebookDocument.fire(s.apiNotebook)}}if(t.value.addedEditors)for(let n of t.value.addedEditors){if(this._editors.has(n.id))return;let o=b.revive(n.documentUri),i=this._documents.get(o);i&&this._createExtHostEditor(i,n.id,n)}let e=[];if(t.value.removedEditors)for(let n of t.value.removedEditors){let o=this._editors.get(n);o&&(this._editors.delete(n),this._activeNotebookEditor?.id===o.id&&(this._activeNotebookEditor=void 0),e.push(o))}if(t.value.visibleEditors){this._visibleNotebookEditors=t.value.visibleEditors.map(o=>this._editors.get(o)).filter(o=>!!o);let n=new Set;this._visibleNotebookEditors.forEach(o=>n.add(o.id));for(let o of this._editors.values()){let i=n.has(o.id);o._acceptVisibility(i)}this._visibleNotebookEditors=[...this._editors.values()].map(o=>o).filter(o=>o.visible),this._onDidChangeVisibleNotebookEditors.fire(this.visibleNotebookEditors)}t.value.newActiveEditor===null?this._activeNotebookEditor=void 0:t.value.newActiveEditor&&(this._editors.get(t.value.newActiveEditor)||console.error(`FAILED to find active notebook editor ${t.value.newActiveEditor}`),this._activeNotebookEditor=this._editors.get(t.value.newActiveEditor)),t.value.newActiveEditor!==void 0&&this._onDidChangeActiveNotebookEditor.fire(this._activeNotebookEditor?.apiEditor)}static _registerApiCommands(t){let e=Z.String.with("notebookType","A notebook type"),n=new Re("vscode.executeDataToNotebook","_executeDataToNotebook","Invoke notebook serializer",[e,new Z("data","Bytes to convert to data",i=>i instanceof Uint8Array,i=>H.wrap(i))],new ke("Notebook Data",i=>ud.to(i.value))),o=new Re("vscode.executeNotebookToData","_executeNotebookToData","Invoke notebook serializer",[e,new Z("NotebookData","Notebook data to convert to bytes",i=>!0,i=>new Gt(ud.from(i)))],new ke("Bytes",i=>i.buffer));t.registerApiCommand(n),t.registerApiCommand(o)}trace(t){this._logService.trace(`[Extension Host Notebook] ${t}`)}},Ty=class extends Error{constructor(t){super(t),this.name="NotebookSaveError"}};var Rk=class{constructor(t,e,n,o={timeout:1500,errors:3}){this._logService=t;this._notebooksAndEditors=e;this._mainThreadBulkEdits=n;this._thresholds=o;this._onWillSaveNotebookDocumentEvent=new ns}dispose(){}getOnWillSaveNotebookDocumentEvent(t){return(e,n,o)=>{let i=function(a){e.call(n,a)};return i.extension=t,this._onWillSaveNotebookDocumentEvent.event(i,void 0,o)}}async $participateInSave(t,e,n){let o=b.revive(t),i=this._notebooksAndEditors.getNotebookDocument(o);if(!i)throw new Error("Unable to resolve notebook document");let s=[];if(await this._onWillSaveNotebookDocumentEvent.fireAsync({notebook:i.apiNotebook,reason:nb.to(e)},n,async(l,d)=>{let c=Date.now(),u=await await Promise.resolve(l);Date.now()-c>this._thresholds.timeout&&this._logService.warn("onWillSaveNotebookDocument-listener from extension",d.extension.identifier),!n.isCancellationRequested&&u&&(u instanceof Cr?s.push(u):this._logService.warn("onWillSaveNotebookDocument-listener from extension",d.extension.identifier,"ignored due to invalid data"))}),n.isCancellationRequested)return!1;if(s.length===0)return!0;let a={edits:[]};for(let l of s){let{edits:d}=mo.from(l);a.edits=a.edits.concat(d)}return this._mainThreadBulkEdits.$tryApplyWorkspaceEdit(new Gt(a))}};var Ak=class{constructor(t){this._notebooksAndEditors=t;this._onDidSaveNotebookDocument=new E;this.onDidSaveNotebookDocument=this._onDidSaveNotebookDocument.event;this._onDidChangeNotebookDocument=new E;this.onDidChangeNotebookDocument=this._onDidChangeNotebookDocument.event}$acceptModelChanged(t,e,n,o){let s=this._notebooksAndEditors.getNotebookDocument(b.revive(t)).acceptModelChanged(e.value,n,o);this._onDidChangeNotebookDocument.fire(s)}$acceptDirtyStateChanged(t,e){this._notebooksAndEditors.getNotebookDocument(b.revive(t)).acceptDirty(e)}$acceptModelSaved(t){let e=this._notebooksAndEditors.getNotebookDocument(b.revive(t));this._onDidSaveNotebookDocument.fire(e.apiNotebook)}};var Ff=class{constructor(t,e){this._logService=t;this._notebooksAndEditors=e;this._onDidChangeNotebookEditorSelection=new E;this._onDidChangeNotebookEditorVisibleRanges=new E;this.onDidChangeNotebookEditorSelection=this._onDidChangeNotebookEditorSelection.event;this.onDidChangeNotebookEditorVisibleRanges=this._onDidChangeNotebookEditorVisibleRanges.event}$acceptEditorPropertiesChanged(t,e){this._logService.debug("ExtHostNotebook#$acceptEditorPropertiesChanged",t,e);let n=this._notebooksAndEditors.getEditorById(t);e.visibleRanges&&n._acceptVisibleRanges(e.visibleRanges.ranges.map(Fr.to)),e.selections&&n._acceptSelections(e.selections.selections.map(Fr.to)),e.visibleRanges&&this._onDidChangeNotebookEditorVisibleRanges.fire({notebookEditor:n.apiEditor,visibleRanges:n.apiEditor.visibleRanges}),e.selections&&this._onDidChangeNotebookEditorSelection.fire(Object.freeze({notebookEditor:n.apiEditor,selections:n.apiEditor.selections}))}$acceptEditorViewColumns(t){for(let e in t)this._notebooksAndEditors.getEditorById(e)._acceptViewColumn(Vt.to(t[e]))}};Ff=_([C(0,oe)],Ff);var Smt=R("INotebookExecutionService");var w5=100;var Emt=R("INotebookKernelService"),wmt=R("INotebookKernelHistoryService");var Hf=class{constructor(t,e,n,o,i){this._initData=e;this._extHostNotebook=n;this._commands=o;this._logService=i;this._activeExecutions=new Ke;this._activeNotebookExecutions=new Ke;this._kernelDetectionTask=new Map;this._kernelDetectionTaskHandlePool=0;this._kernelSourceActionProviders=new Map;this._kernelSourceActionProviderHandlePool=0;this._kernelData=new Map;this._handlePool=0;this.id=0;this.variableStore={};this._proxy=t.getProxy(F.MainThreadNotebookKernels);let s=new Re("notebook.selectKernel","_notebook.selectKernel","Trigger kernel picker for specified notebook editor widget",[new Z("options","Select kernel options",l=>!0,l=>{if(l&&"notebookEditor"in l&&"id"in l){let d=this._extHostNotebook.getIdByEditor(l.notebookEditor);return{id:l.id,extension:l.extension,notebookEditorId:d}}else if(l&&"notebookEditor"in l){let d=this._extHostNotebook.getIdByEditor(l.notebookEditor);if(d===void 0)throw new Error(`Cannot invoke 'notebook.selectKernel' for unrecognized notebook editor ${l.notebookEditor.notebook.uri.toString()}`);return"skipIfAlreadySelected"in l?{notebookEditorId:d,skipIfAlreadySelected:l.skipIfAlreadySelected}:{notebookEditorId:d}}return l})],ke.Void),a=new Re("vscode.executeNotebookVariableProvider","_executeNotebookVariableProvider","Execute notebook variable provider",[Z.Uri],new ke("A promise that resolves to an array of variables",(l,d)=>l.map(c=>({variable:{name:c.name,value:c.value,expression:c.expression,type:c.type,language:c.language},hasNamedChildren:c.hasNamedChildren,indexedChildrenCount:c.indexedChildrenCount}))));this._commands.registerApiCommand(s),this._commands.registerApiCommand(a)}createNotebookController(t,e,n,o,i,s){for(let N of this._kernelData.values())if(N.controller.id===e&&Ee.equals(t.identifier,N.extensionId))throw new Error(`notebook controller with id '${e}' ALREADY exist`);let a=this._handlePool++,l=this;this._logService.trace(`NotebookController[${a}], CREATED by ${t.identifier.value}, ${e}`);let d=()=>console.warn(`NO execute handler from notebook controller '${g.id}' of extension: '${t.identifier}'`),c=!1,u=new E,m=new E,g={id:Mk(t.identifier,e),notebookType:n,extensionId:t.identifier,extensionLocation:t.extensionLocation,label:o||t.identifier.value,preloads:s?s.map(sT.from):[]},h=i??d,f,I,S;this._proxy.$addKernel(a,g).catch(N=>{console.log(N),c=!0});let T=0,P=()=>{if(c)return;let N=++T;Promise.resolve().then(()=>{N===T&&this._proxy.$updateKernel(a,g)})},L=new Ke,q={get id(){return e},get notebookType(){return g.notebookType},onDidChangeSelectedNotebooks:u.event,get label(){return g.label},set label(N){g.label=N??t.displayName??t.name,P()},get detail(){return g.detail??""},set detail(N){g.detail=N,P()},get description(){return g.description??""},set description(N){g.description=N,P()},get supportedLanguages(){return g.supportedLanguages},set supportedLanguages(N){g.supportedLanguages=N,P()},get supportsExecutionOrder(){return g.supportsExecutionOrder??!1},set supportsExecutionOrder(N){g.supportsExecutionOrder=N,P()},get rendererScripts(){return g.preloads?g.preloads.map(sT.to):[]},get executeHandler(){return h},set executeHandler(N){h=N??d},get interruptHandler(){return f},set interruptHandler(N){f=N,g.supportsInterrupt=!!N,P()},set variableProvider(N){A(t,"notebookVariableProvider"),S?.dispose(),I=N,g.hasVariableProvider=!!N,S=N?.onDidChangeVariables(B=>l._proxy.$variablesUpdated(B.uri)),P()},get variableProvider(){return I},createNotebookCellExecution(N){if(c)throw new Error("notebook controller is DISPOSED");if(!L.has(N.notebook.uri))throw l._logService.trace(`NotebookController[${a}] NOT associated to notebook, associated to THESE notebooks:`,Array.from(L.keys()).map(B=>B.toString())),new Error(`notebook controller is NOT associated to notebook: ${N.notebook.uri.toString()}`);return l._createNotebookCellExecution(N,Mk(t.identifier,this.id))},createNotebookExecution(N){if(A(t,"notebookExecution"),c)throw new Error("notebook controller is DISPOSED");if(!L.has(N.uri))throw l._logService.trace(`NotebookController[${a}] NOT associated to notebook, associated to THESE notebooks:`,Array.from(L.keys()).map(B=>B.toString())),new Error(`notebook controller is NOT associated to notebook: ${N.uri.toString()}`);return l._createNotebookExecution(N,Mk(t.identifier,this.id))},dispose:()=>{c||(this._logService.trace(`NotebookController[${a}], DISPOSED`),c=!0,this._kernelData.delete(a),u.dispose(),m.dispose(),S?.dispose(),this._proxy.$removeKernel(a))},updateNotebookAffinity(N,B){B===-1&&A(t,"notebookControllerAffinityHidden"),l._proxy.$updateNotebookPriority(a,N.uri,B)},onDidReceiveMessage:m.event,postMessage(N,B){return A(t,"notebookMessaging"),l._proxy.$postMessage(a,B&&l._extHostNotebook.getIdByEditor(B),N)},asWebviewUri(N){return A(t,"notebookMessaging"),Ld(N,l._initData.remote)}};return this._kernelData.set(a,{extensionId:t.identifier,controller:q,onDidReceiveMessage:m,onDidChangeSelection:u,associatedNotebooks:L}),q}getIdByController(t){for(let[e,n]of this._kernelData)if(n.controller===t)return Mk(n.extensionId,t.id);return null}createNotebookControllerDetectionTask(t,e){let n=this._kernelDetectionTaskHandlePool++,o=this;this._logService.trace(`NotebookControllerDetectionTask[${n}], CREATED by ${t.identifier.value}`),this._proxy.$addKernelDetectionTask(n,e);let i={dispose:()=>{this._kernelDetectionTask.delete(n),o._proxy.$removeKernelDetectionTask(n)}};return this._kernelDetectionTask.set(n,i),i}registerKernelSourceActionProvider(t,e,n){let o=this._kernelSourceActionProviderHandlePool++,i=typeof n.onDidChangeNotebookKernelSourceActions=="function"?o:void 0,s=this;this._kernelSourceActionProviders.set(o,n),this._logService.trace(`NotebookKernelSourceActionProvider[${o}], CREATED by ${t.identifier.value}`),this._proxy.$addKernelSourceActionProvider(o,o,e);let a;return i!==void 0&&(a=n.onDidChangeNotebookKernelSourceActions(l=>this._proxy.$emitNotebookKernelSourceActionsChangeEvent(i))),{dispose:()=>{this._kernelSourceActionProviders.delete(o),s._proxy.$removeKernelSourceActionProvider(o,o),a?.dispose()}}}async $provideKernelSourceActions(t,e){let n=this._kernelSourceActionProviders.get(t);if(n){let o=new $;return(await n.provideNotebookKernelSourceActions(e)??[]).map(s=>dM.from(s,this._commands.converter,o))}return[]}$acceptNotebookAssociation(t,e,n){let o=this._kernelData.get(t);if(o){let i=this._extHostNotebook.getNotebookDocument(b.revive(e));n?o.associatedNotebooks.set(i.uri,!0):o.associatedNotebooks.delete(i.uri),this._logService.trace(`NotebookController[${t}] ASSOCIATE notebook`,i.uri.toString(),n),o.onDidChangeSelection.fire({selected:n,notebook:i.apiNotebook})}}async $executeCells(t,e,n){let o=this._kernelData.get(t);if(!o)return;let i=this._extHostNotebook.getNotebookDocument(b.revive(e)),s=[];for(let a of n){let l=i.getCell(a);l&&s.push(l.apiCell)}try{this._logService.trace(`NotebookController[${t}] EXECUTE cells`,i.uri.toString(),s.length),await o.controller.executeHandler.call(o.controller,s,i.apiNotebook,o.controller)}catch(a){this._logService.error(`NotebookController[${t}] execute cells FAILED`,a),console.error(a)}}async $cancelCells(t,e,n){let o=this._kernelData.get(t);if(!o)return;let i=this._extHostNotebook.getNotebookDocument(b.revive(e));if(o.controller.interruptHandler)await o.controller.interruptHandler.call(o.controller,i.apiNotebook);else for(let s of n){let a=i.getCell(s);a&&this._activeExecutions.get(a.uri)?.cancel()}if(o.controller.interruptHandler){let s=this._activeNotebookExecutions.get(i.uri);this._activeNotebookExecutions.delete(i.uri),n.length&&Array.isArray(s)&&s.length&&s.forEach(a=>a.dispose())}}async $provideVariables(t,e,n,o,i,s,a){let l=this._kernelData.get(t);if(!l)return;let d=this._extHostNotebook.getNotebookDocument(b.revive(n)),c=l.controller.variableProvider;if(!c)return;let u;if(o!==void 0){if(u=this.variableStore[o],!u)return}else this.variableStore={};let m=i==="named"?1:2,g=c.provideVariables(d.apiNotebook,u,m,s,a),h=0;for await(let f of g){if(a.isCancellationRequested)return;let I={id:this.id++,name:f.variable.name,value:f.variable.value,type:f.variable.type,interfaces:f.variable.interfaces,language:f.variable.language,expression:f.variable.expression,hasNamedChildren:f.hasNamedChildren,indexedChildrenCount:f.indexedChildrenCount,extensionId:l.extensionId.value};if(this.variableStore[I.id]=f.variable,this._proxy.$receiveVariable(e,I),h++>=w5)return}}$acceptKernelMessageFromRenderer(t,e,n){let o=this._kernelData.get(t);if(!o)return;let i=this._extHostNotebook.getEditorById(e);o.onDidReceiveMessage.fire(Object.freeze({editor:i.apiEditor,message:n}))}_createNotebookCellExecution(t,e){if(t.index<0)throw new Error("CANNOT execute cell that has been REMOVED from notebook");let o=this._extHostNotebook.getNotebookDocument(t.notebook.uri).getCellFromApiCell(t);if(!o)throw new Error("invalid cell");if(this._activeExecutions.has(o.uri))throw new Error(`duplicate execution for ${o.uri}`);let i=new DO(e,o,this._proxy);this._activeExecutions.set(o.uri,i);let s=i.onDidChangeState(()=>{i.state===2&&(i.dispose(),s.dispose(),this._activeExecutions.delete(o.uri))});return i.asApiObject()}_createNotebookExecution(t,e){let n=this._extHostNotebook.getNotebookDocument(t.uri),o=t.getCells().find(a=>{let l=n.getCellFromApiCell(a);return l&&this._activeExecutions.has(l.uri)});if(o)throw new Error(`duplicate cell execution for ${o.document.uri}`);if(this._activeNotebookExecutions.has(n.uri))throw new Error(`duplicate notebook execution for ${n.uri}`);let i=new RO(e,n,this._proxy),s=i.onDidChangeState(()=>{i.state===2&&(i.dispose(),s.dispose(),this._activeNotebookExecutions.delete(n.uri))});return this._activeNotebookExecutions.set(n.uri,[i,s]),i.asApiObject()}};Hf=_([C(4,oe)],Hf);var DO=class r extends O{constructor(e,n,o){super();this._cell=n;this._proxy=o;this._handle=r.HANDLE++;this._onDidChangeState=this._register(new E);this.onDidChangeState=this._onDidChangeState.event;this._state=0;this._tokenSource=this._register(new Ce);this._collector=new AO(10,i=>this.update(i)),this._executionOrder=n.internalMetadata.executionOrder,this._proxy.$createExecution(this._handle,e,this._cell.notebook.uri,this._cell.handle)}static{this.HANDLE=0}get state(){return this._state}cancel(){this._tokenSource.cancel()}async updateSoon(e){await this._collector.addItem(e)}async update(e){let n=Array.isArray(e)?e:[e];return this._proxy.$updateExecution(this._handle,new Gt(n))}verifyStateForOutput(){if(this._state===0)throw new Error("Must call start before modifying cell output");if(this._state===2)throw new Error("Cannot modify cell output after calling resolve")}cellIndexToHandle(e){let n=this._cell;if(e&&(n=this._cell.notebook.getCellFromApiCell(e)),!n)throw new Error("INVALID cell");return n.handle}validateAndConvertOutputs(e){return e.map(n=>{let o=ys.ensureUniqueMimeTypes(n.items,!0);return o===n.items?Ua.from(n):Ua.from({items:o,id:n.id,metadata:n.metadata})})}async updateOutputs(e,n,o){let i=this.cellIndexToHandle(n),s=this.validateAndConvertOutputs(Dn(e));return this.updateSoon({editType:1,cellHandle:i,append:o,outputs:s})}async updateOutputItems(e,n,o){return e=ys.ensureUniqueMimeTypes(Dn(e),!0),this.updateSoon({editType:2,items:e.map(iu.from),outputId:n.id,append:o})}asApiObject(){let e=this;return Object.freeze({get token(){return e._tokenSource.token},get cell(){return e._cell.apiCell},get executionOrder(){return e._executionOrder},set executionOrder(o){e._executionOrder=o,e.update([{editType:3,executionOrder:e._executionOrder}])},start(o){if(e._state===2||e._state===1)throw new Error("Cannot call start again");e._state=1,e._onDidChangeState.fire(),e.update({editType:3,runStartTime:o})},end(o,i,s){if(e._state===2)throw new Error("Cannot call resolve twice");e._state=2,e._onDidChangeState.fire(),e._collector.flush();let a=cQ(s);e._proxy.$completeExecution(e._handle,new Gt({runEndTime:i,lastRunSuccess:o,error:a}))},clearOutput(o){return e.verifyStateForOutput(),e.updateOutputs([],o,!1)},appendOutput(o,i){return e.verifyStateForOutput(),e.updateOutputs(o,i,!0)},replaceOutput(o,i){return e.verifyStateForOutput(),e.updateOutputs(o,i,!1)},appendOutputItems(o,i){return e.verifyStateForOutput(),e.updateOutputItems(o,i,!0)},replaceOutputItems(o,i){return e.verifyStateForOutput(),e.updateOutputItems(o,i,!1)}})}};function cQ(r){let t=o=>o?{startLineNumber:o.start.line,startColumn:o.start.character,endLineNumber:o.end.line,endColumn:o.end.character}:void 0,e=o=>({uri:o.uri,position:o.position,label:o.label});return r?{name:r.name,message:r.message,stack:r.stack instanceof Array?r.stack.map(o=>e(o)):r.stack,location:t(r.location),uri:r.uri}:void 0}var RO=class r extends O{constructor(e,n,o){super();this._notebook=n;this._proxy=o;this._handle=r.HANDLE++;this._onDidChangeState=this._register(new E);this.onDidChangeState=this._onDidChangeState.event;this._state=0;this._tokenSource=this._register(new Ce);this._proxy.$createNotebookExecution(this._handle,e,this._notebook.uri)}static{this.HANDLE=0}get state(){return this._state}cancel(){this._tokenSource.cancel()}asApiObject(){return Object.freeze({start:()=>{if(this._state===2||this._state===1)throw new Error("Cannot call start again");this._state=1,this._onDidChangeState.fire(),this._proxy.$beginNotebookExecution(this._handle)},end:()=>{if(this._state===2)throw new Error("Cannot call resolve twice");this._state=2,this._onDidChangeState.fire(),this._proxy.$completeNotebookExecution(this._handle)}})}},AO=class{constructor(t,e){this.delay=t;this.callback=e;this.batch=[];this.startedTimer=Date.now()}addItem(t){return this.batch.push(t),this.currentDeferred||(this.currentDeferred=new Jt,this.startedTimer=Date.now(),Ut(this.delay).then(()=>this.flush())),Date.now()-this.startedTimer>this.delay?this.flush():this.currentDeferred.p}flush(){if(this.batch.length===0||!this.currentDeferred)return Promise.resolve();let t=this.currentDeferred;this.currentDeferred=void 0;let e=this.batch;return this.batch=[],this.callback(e).finally(()=>t.complete())}};function Mk(r,t){return`${r.value}/${t}`}var Lk=class{constructor(t,e){this._extHostNotebook=e;this._rendererMessageEmitters=new Map;this.proxy=t.getProxy(F.MainThreadNotebookRenderers)}$postRendererMessage(t,e,n){let o=this._extHostNotebook.getEditorById(t);this._rendererMessageEmitters.get(e)?.fire({editor:o.apiEditor,message:n})}createRendererMessaging(t,e){if(!t.contributes?.notebookRenderer?.some(o=>o.id===e))throw new Error(`Extensions may only call createRendererMessaging() for renderers they contribute (got ${e})`);return{onDidReceiveMessage:(o,i,s)=>this.getOrCreateEmitterFor(e).event(o,i,s),postMessage:(o,i)=>{Hu.apiEditorsToExtHost.has(o)&&([o,i]=[i,o]);let s=i&&Hu.apiEditorsToExtHost.get(i);return this.proxy.$postMessage(s?.id,e,o)}}}getOrCreateEmitterFor(t){let e=this._rendererMessageEmitters.get(t);return e||(e=new E({onDidRemoveLastListener:()=>{e?.dispose(),this._rendererMessageEmitters.delete(t)}}),this._rendererMessageEmitters.set(t,e),e)}};var Ok=class{constructor(t){this.handlers=new Map;this.proxy=t.getProxy(F.MainThreadProfileContentHandlers)}registerProfileContentHandler(t,e,n){if(A(t,"profileContentHandlers"),this.handlers.has(e))throw new Error(`Handler with id '${e}' already registered`);return this.handlers.set(e,n),this.proxy.$registerProfileContentHandler(e,n.name,n.description,t.identifier.value),K(()=>{this.handlers.delete(e),this.proxy.$unregisterProfileContentHandler(e)})}async $saveProfile(t,e,n,o){let i=this.handlers.get(t);if(!i)throw new Error(`Unknown handler with id: ${t}`);return i.saveProfile(e,n,o)}async $readProfile(t,e,n){let o=this.handlers.get(t);if(!o)throw new Error(`Unknown handler with id: ${t}`);return o.readProfile(De(e)?e:b.revive(e),n)}};var Nk=class r{constructor(t,e){this.uriTransformer=e;this.providers=new Map;this.proxy=t.getProxy(F.MainThreadQuickDiff)}static{this.handlePool=0}$provideOriginalResource(t,e,n){let o=b.revive(e),i=this.providers.get(t);return i?hn(()=>i.provideOriginalResource(o,n)).then(s=>s||null):Promise.resolve(null)}registerQuickDiffProvider(t,e,n,o,i,s){let a=r.handlePool++;this.providers.set(a,n);let l=Ee.toKey(t.identifier);return this.proxy.$registerQuickDiffProvider(a,Fi.from(e,this.uriTransformer),`${l}.${o}`,i,s),{dispose:()=>{this.proxy.$unregisterQuickDiffProvider(a),this.providers.delete(a)}}}};function k5(r,t,e){let n=r.getProxy(F.MainThreadQuickOpen);class o{constructor(d,c){this._sessions=new Map;this._instances=0;this._workspace=d,this._commands=c}showQuickPick(d,c,u,m=ve.None){this._onDidSelectItem=void 0;let g=Promise.resolve(c),h=++this._instances,f=n.$show(h,{title:u?.title,placeHolder:u?.placeHolder,prompt:u?.prompt,matchOnDescription:u?.matchOnDescription,matchOnDetail:u?.matchOnDetail,ignoreFocusLost:u?.ignoreFocusOut,canPickMany:u?.canPickMany},m),I={},S=f.then(()=>I);return Promise.race([S,g]).then(T=>{if(T!==I)return g.then(P=>{let L=[];for(let q=0;q<P.length;q++){let N=P[q];typeof N=="string"?L.push({label:N,handle:q}):N.kind===-1?L.push({type:"separator",label:N.label}):(N.tooltip&&A(d,"quickPickItemTooltip"),L.push({label:N.label,iconPathDto:Hi.from(N.iconPath),description:N.description,detail:N.detail,picked:N.picked,alwaysShow:N.alwaysShow,tooltip:ue.fromStrict(N.tooltip),resourceUri:N.resourceUri,handle:q}))}return u&&typeof u.onDidSelectItem=="function"&&(this._onDidSelectItem=q=>{u.onDidSelectItem(P[q])}),n.$setItems(h,L),f.then(q=>{if(typeof q=="number")return P[q];if(Array.isArray(q))return q.map(N=>P[N])})})}).then(void 0,T=>{if(!Qt(T))return n.$setError(h,T),Promise.reject(T)})}$onItemSelected(d){this._onDidSelectItem?.(d)}showInput(d,c=ve.None){return this._validateInput=d?.validateInput,n.$input(d,typeof this._validateInput=="function",c).then(void 0,u=>{if(!Qt(u))return Promise.reject(u)})}async $validateInput(d){if(!this._validateInput)return;let c=await this._validateInput(d);if(!c||typeof c=="string")return c;let u;switch(c.severity){case 1:u=Xe.Info;break;case 2:u=Xe.Warning;break;case 3:u=Xe.Error;break;default:u=c.message?Xe.Error:Xe.Ignore;break}return{content:c.message,severity:u}}async showWorkspaceFolderPick(d,c=ve.None){let u=await this._commands.executeCommand("_workbench.pickWorkspaceFolder",[d]);if(!u)return;let m=await this._workspace.getWorkspaceFolders2();if(m)return m.find(g=>g.uri.toString()===u.uri.toString())}createQuickPick(d){let c=new s(d,()=>this._sessions.delete(c._id));return this._sessions.set(c._id,c),c}createInputBox(d){let c=new a(d,()=>this._sessions.delete(c._id));return this._sessions.set(c._id,c),c}$onDidChangeValue(d,c){this._sessions.get(d)?._fireDidChangeValue(c)}$onDidAccept(d){this._sessions.get(d)?._fireDidAccept()}$onDidChangeActive(d,c){let u=this._sessions.get(d);u instanceof s&&u._fireDidChangeActive(c)}$onDidChangeSelection(d,c){let u=this._sessions.get(d);u instanceof s&&u._fireDidChangeSelection(c)}$onDidTriggerButton(d,c,u){this._sessions.get(d)?._fireDidTriggerButton(c,u)}$onDidTriggerItemButton(d,c,u,m){let g=this._sessions.get(d);g instanceof s&&g._fireDidTriggerItemButton(c,u,m)}$onDidHide(d){this._sessions.get(d)?._fireDidHide()}}class i{constructor(d,c){this._extension=d;this._onDidDispose=c;this._id=s._nextId++;this._visible=!1;this._expectingHide=!1;this._enabled=!0;this._busy=!1;this._ignoreFocusOut=!0;this._value="";this._valueSelection=void 0;this._buttons=[];this._handlesToButtons=new Map;this._onDidAcceptEmitter=new E;this._onDidChangeValueEmitter=new E;this._onDidTriggerButtonEmitter=new E;this._onDidHideEmitter=new E;this._pendingUpdate={id:this._id};this._disposed=!1;this._disposables=[this._onDidTriggerButtonEmitter,this._onDidHideEmitter,this._onDidAcceptEmitter,this._onDidChangeValueEmitter];this.onDidChangeValue=this._onDidChangeValueEmitter.event;this.onDidAccept=this._onDidAcceptEmitter.event;this.onDidTriggerButton=this._onDidTriggerButtonEmitter.event;this.onDidHide=this._onDidHideEmitter.event}static{this._nextId=1}get title(){return this._title}set title(d){this._title=d,this.update({title:d})}get step(){return this._steps}set step(d){this._steps=d,this.update({step:d})}get totalSteps(){return this._totalSteps}set totalSteps(d){this._totalSteps=d,this.update({totalSteps:d})}get enabled(){return this._enabled}set enabled(d){this._enabled=d,this.update({enabled:d})}get busy(){return this._busy}set busy(d){this._busy=d,this.update({busy:d})}get ignoreFocusOut(){return this._ignoreFocusOut}set ignoreFocusOut(d){this._ignoreFocusOut=d,this.update({ignoreFocusOut:d})}get value(){return this._value}set value(d){this._value=d,this.update({value:d})}get valueSelection(){return this._valueSelection}set valueSelection(d){this._valueSelection=d,this.update({valueSelection:d})}get placeholder(){return this._placeholder}set placeholder(d){this._placeholder=d,this.update({placeholder:d})}get buttons(){return this._buttons}set buttons(d){this._buttons=d.slice(),this._handlesToButtons.clear(),d.forEach((c,u)=>{let m=c===Is.Back?-1:u;this._handlesToButtons.set(m,c)}),this.update({buttons:d.map((c,u)=>({iconPathDto:Hi.from(c.iconPath),tooltip:c.tooltip,handle:c===Is.Back?-1:u,location:typeof c.location=="number"?c.location:void 0,toggle:typeof c.toggle=="object"&&typeof c.toggle.checked=="boolean"?{checked:c.toggle.checked}:void 0}))})}show(){this._visible=!0,this._expectingHide=!0,this.update({visible:!0})}hide(){this._visible=!1,this.update({visible:!1})}_fireDidAccept(){this._onDidAcceptEmitter.fire()}_fireDidChangeValue(d){this._value=d,this._onDidChangeValueEmitter.fire(d)}_fireDidTriggerButton(d,c){let u=this._handlesToButtons.get(d);u&&(c!==void 0&&u.toggle&&(u.toggle.checked=c),this._onDidTriggerButtonEmitter.fire(u))}_fireDidHide(){this._expectingHide&&(this._expectingHide=this._visible,this._onDidHideEmitter.fire())}dispose(){this._disposed||(this._disposed=!0,this._fireDidHide(),this._disposables=Cn(this._disposables),this._updateTimeout&&(clearTimeout(this._updateTimeout),this._updateTimeout=void 0),this._onDidDispose(),n.$dispose(this._id))}update(d){if(!this._disposed){for(let c of Object.keys(d)){let u=d[c];this._pendingUpdate[c]=u===void 0?null:u}"visible"in this._pendingUpdate?(this._updateTimeout&&(clearTimeout(this._updateTimeout),this._updateTimeout=void 0),this.dispatchUpdate()):this._visible&&!this._updateTimeout&&(this._updateTimeout=setTimeout(()=>{this._updateTimeout=void 0,this.dispatchUpdate()},0))}}dispatchUpdate(){n.$createOrUpdate(this._pendingUpdate),this._pendingUpdate={id:this._id}}}class s extends i{constructor(c,u){super(c,u);this._items=[];this._handlesToItems=new Map;this._itemsToHandles=new Map;this._canSelectMany=!1;this._matchOnDescription=!0;this._matchOnDetail=!0;this._sortByLabel=!0;this._keepScrollPosition=!1;this._activeItems=[];this._onDidChangeActiveEmitter=new E;this._selectedItems=[];this._onDidChangeSelectionEmitter=new E;this._onDidTriggerItemButtonEmitter=new E;this.onDidChangeActive=this._onDidChangeActiveEmitter.event;this.onDidChangeSelection=this._onDidChangeSelectionEmitter.event;this.onDidTriggerItemButton=this._onDidTriggerItemButtonEmitter.event;this._disposables.push(this._onDidChangeActiveEmitter,this._onDidChangeSelectionEmitter,this._onDidTriggerItemButtonEmitter),this.update({type:"quickPick"})}get items(){return this._items}set items(c){this._items=c.slice(),this._handlesToItems.clear(),this._itemsToHandles.clear(),c.forEach((m,g)=>{this._handlesToItems.set(g,m),this._itemsToHandles.set(m,g)});let u=[];for(let m=0;m<c.length;m++){let g=c[m];g.kind===-1?u.push({type:"separator",label:g.label}):(g.tooltip&&A(this._extension,"quickPickItemTooltip"),u.push({handle:m,label:g.label,iconPathDto:Hi.from(g.iconPath),description:g.description,detail:g.detail,picked:g.picked,alwaysShow:g.alwaysShow,tooltip:ue.fromStrict(g.tooltip),resourceUri:g.resourceUri,buttons:g.buttons?.map((h,f)=>({iconPathDto:Hi.from(h.iconPath),tooltip:h.tooltip,handle:f,toggle:typeof h.toggle=="object"&&typeof h.toggle.checked=="boolean"?{checked:h.toggle.checked}:void 0}))}))}this.update({items:u})}get canSelectMany(){return this._canSelectMany}set canSelectMany(c){this._canSelectMany=c,this.update({canSelectMany:c})}get matchOnDescription(){return this._matchOnDescription}set matchOnDescription(c){this._matchOnDescription=c,this.update({matchOnDescription:c})}get matchOnDetail(){return this._matchOnDetail}set matchOnDetail(c){this._matchOnDetail=c,this.update({matchOnDetail:c})}get sortByLabel(){return this._sortByLabel}set sortByLabel(c){this._sortByLabel=c,this.update({sortByLabel:c})}get keepScrollPosition(){return this._keepScrollPosition}set keepScrollPosition(c){this._keepScrollPosition=c,this.update({keepScrollPosition:c})}get prompt(){return this._prompt}set prompt(c){this._prompt=c,this.update({prompt:c})}get activeItems(){return this._activeItems}set activeItems(c){this._activeItems=c.filter(u=>this._itemsToHandles.has(u)),this.update({activeItems:this._activeItems.map(u=>this._itemsToHandles.get(u))})}get selectedItems(){return this._selectedItems}set selectedItems(c){this._selectedItems=c.filter(u=>this._itemsToHandles.has(u)),this.update({selectedItems:this._selectedItems.map(u=>this._itemsToHandles.get(u))})}_fireDidChangeActive(c){let u=tt(c.map(m=>this._handlesToItems.get(m)));this._activeItems=u,this._onDidChangeActiveEmitter.fire(u)}_fireDidChangeSelection(c){let u=tt(c.map(m=>this._handlesToItems.get(m)));this._selectedItems=u,this._onDidChangeSelectionEmitter.fire(u)}_fireDidTriggerItemButton(c,u,m){let g=this._handlesToItems.get(c);if(!g||!g.buttons||!g.buttons.length)return;let h=g.buttons[u];h&&(m!==void 0&&h.toggle&&(h.toggle.checked=m),this._onDidTriggerItemButtonEmitter.fire({button:h,item:g}))}}class a extends i{constructor(c,u){super(c,u);this._password=!1;this.update({type:"inputBox"})}get password(){return this._password}set password(c){this._password=c,this.update({password:c})}get prompt(){return this._prompt}set prompt(c){this._prompt=c,this.update({prompt:c})}get validationMessage(){return this._validationMessage}set validationMessage(c){this._validationMessage=c,c?typeof c=="string"?this.update({validationMessage:c,severity:Xe.Error}):this.update({validationMessage:c.message,severity:c.severity??Xe.Error}):this.update({validationMessage:void 0,severity:Xe.Ignore})}}return new o(t,e)}function P5(r){return r instanceof b}function uQ(r,t){return r.scheme===V.file&&t.scheme===V.file&&Qe?r.toString()===t.toString():r.toString().toLowerCase()===t.toString().toLowerCase()}function MO(r){if(r)return typeof r.iconPath=="string"?b.file(r.iconPath):b.isUri(r.iconPath)||ut.isThemeIcon(r.iconPath)?r.iconPath:void 0}function js(r){if(r){if(b.isUri(r))return r;if(ut.isThemeIcon(r))return r;{let t=r;return{light:t.light,dark:t.dark}}}else return}function _5(r){let t=js(r.authorIcon),e=Array.isArray(r.tooltip)?ue.fromMany(r.tooltip):r.tooltip?ue.from(r.tooltip):void 0,n=r.references?.map(o=>({...o,icon:js(o.icon)}));return{...r,authorIcon:t,references:n,tooltip:e}}function LO(r){return r?{...r,icon:js(r.icon)}:void 0}function OO(r,t){if(!r.iconPath&&!t.iconPath)return 0;if(r.iconPath){if(!t.iconPath)return 1}else return-1;let e=typeof r.iconPath=="string"?r.iconPath:b.isUri(r.iconPath)?r.iconPath.fsPath:r.iconPath.id,n=typeof t.iconPath=="string"?t.iconPath:b.isUri(t.iconPath)?t.iconPath.fsPath:t.iconPath.id;return Kb(e,n)}function pQ(r,t){let e=0;if(r.strikeThrough!==t.strikeThrough)return r.strikeThrough?1:-1;if(r.faded!==t.faded)return r.faded?1:-1;if(r.tooltip!==t.tooltip)return(r.tooltip||"").localeCompare(t.tooltip||"");if(e=OO(r,t),e!==0)return e;if(r.light&&t.light)e=OO(r.light,t.light);else{if(r.light)return 1;if(t.light)return-1}if(e!==0)return e;if(r.dark&&t.dark)e=OO(r.dark,t.dark);else{if(r.dark)return 1;if(t.dark)return-1}return e}function mQ(r,t){if(r.command!==t.command)return r.command<t.command?-1:1;if(r.title!==t.title)return r.title<t.title?-1:1;if(r.tooltip!==t.tooltip){if(r.tooltip!==void 0&&t.tooltip!==void 0)return r.tooltip<t.tooltip?-1:1;if(r.tooltip!==void 0)return 1;if(t.tooltip!==void 0)return-1}if(r.arguments===t.arguments)return 0;if(r.arguments)if(t.arguments){if(r.arguments.length!==t.arguments.length)return r.arguments.length-t.arguments.length}else return 1;else return-1;for(let e=0;e<r.arguments.length;e++){let n=r.arguments[e],o=t.arguments[e];if(n!==o&&!(P5(n)&&P5(o)&&uQ(n,o)))return n<o?-1:1}return 0}function D5(r,t){let e=Kb(r.resourceUri.fsPath,t.resourceUri.fsPath,!0);if(e!==0)return e;if(r.command&&t.command)e=mQ(r.command,t.command);else{if(r.command)return 1;if(t.command)return-1}if(e!==0)return e;if(r.decorations&&t.decorations)e=pQ(r.decorations,t.decorations);else{if(r.decorations)return 1;if(t.decorations)return-1}if(e!==0)return e;if(r.multiFileDiffEditorModifiedUri&&t.multiFileDiffEditorModifiedUri)e=Kb(r.multiFileDiffEditorModifiedUri.fsPath,t.multiFileDiffEditorModifiedUri.fsPath,!0);else{if(r.multiFileDiffEditorModifiedUri)return 1;if(t.multiFileDiffEditorModifiedUri)return-1}if(e!==0)return e;if(r.multiDiffEditorOriginalUri&&t.multiDiffEditorOriginalUri)e=Kb(r.multiDiffEditorOriginalUri.fsPath,t.multiDiffEditorOriginalUri.fsPath,!0);else{if(r.multiDiffEditorOriginalUri)return 1;if(t.multiDiffEditorOriginalUri)return-1}return e}function gQ(r,t){for(let e=0;e<r.length;e++)if(r[e]!==t[e])return!1;return!0}function fQ(r,t){return r.command===t.command&&r.title===t.title&&r.tooltip===t.tooltip&&(r.arguments&&t.arguments?gQ(r.arguments,t.arguments):r.arguments===t.arguments)}function hQ(r,t){return rn(r,t,fQ)}var NO=class{constructor(t,e,n,o,i){this._extension=t;this._sourceControlHandle=o;this._documentUri=i;this._value="";this._onDidChange=new E;this._placeholder="";this._enabled=!0;this._visible=!0;this.#t=e,this.#e=n}#e;#t;get value(){return this._value}set value(t){t=t??"",this.#e.$setInputBoxValue(this._sourceControlHandle,t),this.updateValue(t)}get onDidChange(){return this._onDidChange.event}get placeholder(){return this._placeholder}set placeholder(t){this.#e.$setInputBoxPlaceholder(this._sourceControlHandle,t),this._placeholder=t}get validateInput(){return A(this._extension,"scmValidation"),this._validateInput}set validateInput(t){if(A(this._extension,"scmValidation"),t&&typeof t!="function")throw new Error(`[${this._extension.identifier.value}]: Invalid SCM input box validation function`);this._validateInput=t,this.#e.$setValidationProviderIsEnabled(this._sourceControlHandle,!!t)}get enabled(){return this._enabled}set enabled(t){t=!!t,this._enabled!==t&&(this._enabled=t,this.#e.$setInputBoxEnablement(this._sourceControlHandle,t))}get visible(){return this._visible}set visible(t){t=!!t,this._visible!==t&&(this._visible=t,this.#e.$setInputBoxVisibility(this._sourceControlHandle,t))}get document(){return A(this._extension,"scmTextDocument"),this.#t.getDocument(this._documentUri)}showValidationMessage(t,e){A(this._extension,"scmValidation"),this.#e.$showValidationMessage(this._sourceControlHandle,t,EM.from(e))}$onInputBoxValueChange(t){this.updateValue(t)}updateValue(t){this._value=t,this._onDidChange.fire(t)}},UO=class r{constructor(t,e,n,o,i,s,a){this._proxy=t;this._commands=e;this._sourceControlHandle=n;this._id=o;this._label=i;this.multiDiffEditorEnableViewChanges=s;this._extension=a;this._resourceHandlePool=0;this._resourceStates=[];this._resourceStatesMap=new Map;this._resourceStatesCommandsMap=new Map;this._resourceStatesDisposablesMap=new Map;this._onDidUpdateResourceStates=new E;this.onDidUpdateResourceStates=this._onDidUpdateResourceStates.event;this._disposed=!1;this._onDidDispose=new E;this.onDidDispose=this._onDidDispose.event;this._handlesSnapshot=[];this._resourceSnapshot=[];this._contextValue=void 0;this._hideWhenEmpty=void 0;this.handle=r._handlePool++}static{this._handlePool=0}get disposed(){return this._disposed}get id(){return this._id}get label(){return this._label}set label(t){this._label=t,this._proxy.$updateGroupLabel(this._sourceControlHandle,this.handle,t)}get contextValue(){return this._contextValue}set contextValue(t){this._contextValue=t,this._proxy.$updateGroup(this._sourceControlHandle,this.handle,this.features)}get hideWhenEmpty(){return this._hideWhenEmpty}set hideWhenEmpty(t){this._hideWhenEmpty=t,this._proxy.$updateGroup(this._sourceControlHandle,this.handle,this.features)}get features(){return{contextValue:this.contextValue,hideWhenEmpty:this.hideWhenEmpty}}get resourceStates(){return[...this._resourceStates]}set resourceStates(t){this._resourceStates=[...t],this._onDidUpdateResourceStates.fire()}getResourceState(t){return this._resourceStatesMap.get(t)}$executeResourceCommand(t,e){let n=this._resourceStatesCommandsMap.get(t);return n?hn(()=>this._commands.executeCommand(n.command,...n.arguments||[],e)):Promise.resolve(void 0)}_takeResourceStateSnapshot(){let t=[...this._resourceStates].sort(D5),n=DP(this._resourceSnapshot,t,D5).map(s=>{let a=s.toInsert.map(l=>{let d=this._resourceHandlePool++;this._resourceStatesMap.set(d,l);let c=l.resourceUri,u;if(l.command)if(l.command.command==="vscode.open"||l.command.command==="vscode.diff"||l.command.command==="vscode.changes"){let G=new $;u=this._commands.converter.toInternal(l.command,G),this._resourceStatesDisposablesMap.set(d,G)}else this._resourceStatesCommandsMap.set(d,l.command);let m=He(this._extension,"scmMultiDiffEditor"),g=m?l.multiDiffEditorOriginalUri:void 0,h=m?l.multiFileDiffEditorModifiedUri:void 0,f=MO(l.decorations),I=l.decorations&&MO(l.decorations.light)||f,S=l.decorations&&MO(l.decorations.dark)||f,T=[I,S],P=l.decorations&&l.decorations.tooltip||"",L=l.decorations&&!!l.decorations.strikeThrough,q=l.decorations&&!!l.decorations.faded,N=l.contextValue||"";return{rawResource:[d,c,T,P,L,q,N,u,g,h],handle:d}});return{start:s.start,deleteCount:s.deleteCount,toInsert:a}}),o=n.map(({start:s,deleteCount:a,toInsert:l})=>[s,a,l.map(d=>d.rawResource)]),i=n.reverse();for(let{start:s,deleteCount:a,toInsert:l}of i){let d=l.map(u=>u.handle),c=this._handlesSnapshot.splice(s,a,...d);for(let u of c)this._resourceStatesMap.delete(u),this._resourceStatesCommandsMap.delete(u),this._resourceStatesDisposablesMap.get(u)?.dispose(),this._resourceStatesDisposablesMap.delete(u)}return this._resourceSnapshot=t,o}dispose(){this._disposed=!0,this._onDidDispose.fire(),this._onDidUpdateResourceStates.dispose(),this._onDidDispose.dispose()}},Ey=class Ey{constructor(t,e,n,o,i,s,a,l,d,c){this._extension=t;this._commands=o;this._id=i;this._label=s;this._rootUri=a;this._onDidDispose=new E;this.onDidDispose=this._onDidDispose.event;this._groups=new Map;this._contextValue=void 0;this._count=void 0;this._quickDiffProvider=void 0;this._secondaryQuickDiffProvider=void 0;this._historyProviderDisposable=new sn;this._artifactProviderDisposable=new sn;this._commitTemplate=void 0;this._acceptInputDisposables=new sn;this._acceptInputCommand=void 0;this._actionButtonDisposables=new $;this._statusBarDisposables=new $;this._statusBarCommands=void 0;this._selected=!1;this._onDidChangeSelection=new E;this.onDidChangeSelection=this._onDidChangeSelection.event;this._artifactCommandsDisposables=new Fn;this.handle=Ey._handlePool++;this.createdResourceGroups=new Map;this.updatedResourceGroups=new Set;this.#e=n;let u=b.from({scheme:V.vscodeSourceControl,path:`${i}/scm${this.handle}/input`,query:a?`rootUri=${encodeURIComponent(a.toString())}`:void 0});this._inputBox=new NO(t,e,this.#e,this.handle,u),this.#e.$registerSourceControl(this.handle,c?.handle,i,s,a,js(l),d,u),this.onDidDisposeParent=c?c.onDidDispose:he.None}static{this._handlePool=0}#e;get id(){return this._id}get label(){return this._label}get rootUri(){return this._rootUri}get contextValue(){return A(this._extension,"scmProviderOptions"),this._contextValue}set contextValue(t){A(this._extension,"scmProviderOptions"),this._contextValue!==t&&(this._contextValue=t,this.#e.$updateSourceControl(this.handle,{contextValue:t}))}get inputBox(){return this._inputBox}get count(){return this._count}set count(t){this._count!==t&&(this._count=t,this.#e.$updateSourceControl(this.handle,{count:t}))}get quickDiffProvider(){return this._quickDiffProvider}set quickDiffProvider(t){this._quickDiffProvider=t;let e;He(this._extension,"quickDiffProvider")&&(e=t?.label),this.#e.$updateSourceControl(this.handle,{hasQuickDiffProvider:!!t,quickDiffLabel:e})}get secondaryQuickDiffProvider(){return A(this._extension,"quickDiffProvider"),this._secondaryQuickDiffProvider}set secondaryQuickDiffProvider(t){A(this._extension,"quickDiffProvider"),this._secondaryQuickDiffProvider=t;let e=t?.label;this.#e.$updateSourceControl(this.handle,{hasSecondaryQuickDiffProvider:!!t,secondaryQuickDiffLabel:e})}get historyProvider(){return A(this._extension,"scmHistoryProvider"),this._historyProvider}set historyProvider(t){A(this._extension,"scmHistoryProvider"),this._historyProvider=t,this._historyProviderDisposable.value=new $,this.#e.$updateSourceControl(this.handle,{hasHistoryProvider:!!t}),t&&(this._historyProviderDisposable.value.add(t.onDidChangeCurrentHistoryItemRefs(()=>{let e=LO(t?.currentHistoryItemRef),n=LO(t?.currentHistoryItemRemoteRef),o=LO(t?.currentHistoryItemBaseRef);this.#e.$onDidChangeHistoryProviderCurrentHistoryItemRefs(this.handle,e,n,o)})),this._historyProviderDisposable.value.add(t.onDidChangeHistoryItemRefs(e=>{if(e.added.length===0&&e.modified.length===0&&e.removed.length===0)return;let n=e.added.map(s=>({...s,icon:js(s.icon)})),o=e.modified.map(s=>({...s,icon:js(s.icon)})),i=e.removed.map(s=>({...s,icon:js(s.icon)}));this.#e.$onDidChangeHistoryProviderHistoryItemRefs(this.handle,{added:n,modified:o,removed:i,silent:e.silent})})))}get artifactProvider(){return A(this._extension,"scmArtifactProvider"),this._artifactProvider}set artifactProvider(t){A(this._extension,"scmArtifactProvider"),this._artifactProvider=t,this._artifactProviderDisposable.value=new $,this.#e.$updateSourceControl(this.handle,{hasArtifactProvider:!!t}),t&&this._artifactProviderDisposable.value.add(t.onDidChangeArtifacts(e=>{e.length!==0&&this.#e.$onDidChangeArtifacts(this.handle,e)}))}get commitTemplate(){return this._commitTemplate}set commitTemplate(t){t!==this._commitTemplate&&(this._commitTemplate=t,this.#e.$updateSourceControl(this.handle,{commitTemplate:t}))}get acceptInputCommand(){return this._acceptInputCommand}set acceptInputCommand(t){this._acceptInputDisposables.value=new $,this._acceptInputCommand=t;let e=this._commands.converter.toInternal(t,this._acceptInputDisposables.value);this.#e.$updateSourceControl(this.handle,{acceptInputCommand:e})}get actionButton(){return A(this._extension,"scmActionButton"),this._actionButton}set actionButton(t){if(A(this._extension,"scmActionButton"),Lp(this._actionButton,t))return;let e=this._actionButtonDisposables;this._actionButtonDisposables=new $,this._actionButton=t;let n=t!==void 0?{command:{...this._commands.converter.toInternal(t.command,this._actionButtonDisposables),shortTitle:t.command.shortTitle},secondaryCommands:t.secondaryCommands?.map(o=>o.map(i=>this._commands.converter.toInternal(i,this._actionButtonDisposables))),enabled:t.enabled}:null;this.#e.$updateSourceControl(this.handle,{actionButton:n}).finally(()=>e.dispose())}get statusBarCommands(){return this._statusBarCommands}set statusBarCommands(t){if(this._statusBarCommands&&t&&hQ(this._statusBarCommands,t))return;let e=this._statusBarDisposables;this._statusBarDisposables=new $,this._statusBarCommands=t;let n=(t||[]).map(o=>this._commands.converter.toInternal(o,this._statusBarDisposables));this.#e.$updateSourceControl(this.handle,{statusBarCommands:n}).finally(()=>e.dispose())}get selected(){return this._selected}createResourceGroup(t,e,n){let o=He(this._extension,"scmMultiDiffEditor")&&n?.multiDiffEditorEnableViewChanges===!0,i=new UO(this.#e,this._commands,this.handle,t,e,o,this._extension),s=he.once(i.onDidDispose)(()=>this.createdResourceGroups.delete(i));return this.createdResourceGroups.set(i,s),this.eventuallyAddResourceGroups(),i}eventuallyAddResourceGroups(){let t=[],e=[];for(let[n,o]of this.createdResourceGroups){o.dispose();let i=n.onDidUpdateResourceStates(()=>{this.updatedResourceGroups.add(n),this.eventuallyUpdateResourceStates()});he.once(n.onDidDispose)(()=>{this.updatedResourceGroups.delete(n),i.dispose(),this._groups.delete(n.handle),this.#e.$unregisterGroup(this.handle,n.handle)}),t.push([n.handle,n.id,n.label,n.features,n.multiDiffEditorEnableViewChanges]);let s=n._takeResourceStateSnapshot();s.length>0&&e.push([n.handle,s]),this._groups.set(n.handle,n)}this.#e.$registerGroups(this.handle,t,e),this.createdResourceGroups.clear()}eventuallyUpdateResourceStates(){let t=[];this.updatedResourceGroups.forEach(e=>{let n=e._takeResourceStateSnapshot();n.length!==0&&t.push([e.handle,n])}),t.length>0&&this.#e.$spliceResourceStates(this.handle,t),this.updatedResourceGroups.clear()}getResourceGroup(t){return this._groups.get(t)}setSelectionState(t){this._selected=t,this._onDidChangeSelection.fire(t)}async provideArtifacts(t,e){let n=new $,i=(await this.artifactProvider?.provideArtifacts(t,e))?.map(s=>({...s,icon:js(s.icon),command:s.command?this._commands.converter.toInternal(s.command,n):void 0}));return this._artifactCommandsDisposables.get(t)?.dispose(),this._artifactCommandsDisposables.set(t,n),i}dispose(){this._acceptInputDisposables.dispose(),this._actionButtonDisposables.dispose(),this._statusBarDisposables.dispose(),this._historyProviderDisposable.dispose(),this._artifactProviderDisposable.dispose(),this._artifactCommandsDisposables.dispose(),this._groups.forEach(t=>t.dispose()),this.#e.$unregisterSourceControl(this.handle),this._onDidChangeSelection.dispose(),this._onDidDispose.fire(),this._onDidDispose.dispose()}};_([rc(100)],Ey.prototype,"eventuallyAddResourceGroups",1),_([rc(100)],Ey.prototype,"eventuallyUpdateResourceStates",1);var FO=Ey,Wf=class{constructor(t,e,n,o){this._commands=e;this._extHostDocuments=n;this.logService=o;this._sourceControls=new Map;this._sourceControlsByExtension=new uo;this._onDidChangeActiveProvider=new E;this._proxy=t.getProxy(F.MainThreadSCM),this._telemetry=t.getProxy(F.MainThreadTelemetry),e.registerArgumentProcessor({processArgument:i=>{if(i&&i.$mid===3){let s=this._sourceControls.get(i.sourceControlHandle);if(!s)return i;let a=s.getResourceGroup(i.groupHandle);return a?a.getResourceState(i.handle):i}else if(i&&i.$mid===4){let s=this._sourceControls.get(i.sourceControlHandle);return s?s.getResourceGroup(i.groupHandle):i}else if(i&&i.$mid===5){let s=this._sourceControls.get(i.handle);return s||i}return i}})}get onDidChangeActiveProvider(){return this._onDidChangeActiveProvider.event}createSourceControl(t,e,n,o,i,s,a){this.logService.trace("ExtHostSCM#createSourceControl",t.identifier.value,e,n,o),this._telemetry.$publicLog2("api/scm/createSourceControl",{extensionId:t.identifier.value});let l=a?Nt.find(this._sourceControls.values(),u=>u===a):void 0,d=new FO(t,this._extHostDocuments,this._proxy,this._commands,e,n,o,i,s,l);this._sourceControls.set(d.handle,d);let c=this._sourceControlsByExtension.get(t.identifier)||[];return c.push(d),this._sourceControlsByExtension.set(t.identifier,c),d}getLastInputBox(t){this.logService.trace("ExtHostSCM#getLastInputBox",t.identifier.value);let e=this._sourceControlsByExtension.get(t.identifier),n=e&&e[e.length-1];return n&&n.inputBox}$provideOriginalResource(t,e,n){let o=b.revive(e);this.logService.trace("ExtHostSCM#$provideOriginalResource",t,o.toString());let i=this._sourceControls.get(t);return!i||!i.quickDiffProvider||!i.quickDiffProvider.provideOriginalResource?Promise.resolve(null):hn(()=>i.quickDiffProvider.provideOriginalResource(o,n)).then(s=>s||null)}$provideSecondaryOriginalResource(t,e,n){let o=b.revive(e);this.logService.trace("ExtHostSCM#$provideSecondaryOriginalResource",t,o.toString());let i=this._sourceControls.get(t);return!i||!i.secondaryQuickDiffProvider||!i.secondaryQuickDiffProvider.provideOriginalResource?Promise.resolve(null):hn(()=>i.secondaryQuickDiffProvider.provideOriginalResource(o,n)).then(s=>s||null)}$onInputBoxValueChange(t,e){this.logService.trace("ExtHostSCM#$onInputBoxValueChange",t);let n=this._sourceControls.get(t);return n&&n.inputBox.$onInputBoxValueChange(e),Promise.resolve(void 0)}$executeResourceCommand(t,e,n,o){this.logService.trace("ExtHostSCM#$executeResourceCommand",t,e,n);let i=this._sourceControls.get(t);if(!i)return Promise.resolve(void 0);let s=i.getResourceGroup(e);return s?s.$executeResourceCommand(n,o):Promise.resolve(void 0)}$validateInput(t,e,n){this.logService.trace("ExtHostSCM#$validateInput",t);let o=this._sourceControls.get(t);return!o||!o.inputBox.validateInput?Promise.resolve(void 0):hn(()=>o.inputBox.validateInput(e,n)).then(i=>{if(!i)return Promise.resolve(void 0);let s=ue.fromStrict(i.message);return s?Promise.resolve([s,i.type]):Promise.resolve(void 0)})}$setSelectedSourceControl(t){return this.logService.trace("ExtHostSCM#$setSelectedSourceControl",t),this._selectedSourceControlHandle===t||(t!==void 0&&this._sourceControls.get(t)?.setSelectionState(!0),this._selectedSourceControlHandle!==void 0&&this._sourceControls.get(this._selectedSourceControlHandle)?.setSelectionState(!1),this._selectedSourceControlHandle=t),Promise.resolve(void 0)}async $resolveHistoryItem(t,e,n){try{let i=await this._sourceControls.get(t)?.historyProvider?.resolveHistoryItem(e,n);return i?_5(i):void 0}catch(o){this.logService.error("ExtHostSCM#$resolveHistoryItem",o);return}}async $resolveHistoryItemChatContext(t,e,n){try{return await this._sourceControls.get(t)?.historyProvider?.resolveHistoryItemChatContext(e,n)??void 0}catch(o){this.logService.error("ExtHostSCM#$resolveHistoryItemChatContext",o);return}}async $resolveHistoryItemChangeRangeChatContext(t,e,n,o,i){try{return await this._sourceControls.get(t)?.historyProvider?.resolveHistoryItemChangeRangeChatContext?.(e,n,o,i)??void 0}catch(s){this.logService.error("ExtHostSCM#$resolveHistoryItemChangeRangeChatContext",s);return}}async $resolveHistoryItemRefsCommonAncestor(t,e,n){try{return await this._sourceControls.get(t)?.historyProvider?.resolveHistoryItemRefsCommonAncestor(e,n)??void 0}catch(o){this.logService.error("ExtHostSCM#$resolveHistoryItemRefsCommonAncestor",o);return}}async $provideHistoryItemRefs(t,e,n){try{return(await this._sourceControls.get(t)?.historyProvider?.provideHistoryItemRefs(e,n))?.map(s=>({...s,icon:js(s.icon)}))??void 0}catch(o){this.logService.error("ExtHostSCM#$provideHistoryItemRefs",o);return}}async $provideHistoryItems(t,e,n){try{return(await this._sourceControls.get(t)?.historyProvider?.provideHistoryItems(e,n))?.map(s=>_5(s))??void 0}catch(o){this.logService.error("ExtHostSCM#$provideHistoryItems",o);return}}async $provideHistoryItemChanges(t,e,n,o){try{return await this._sourceControls.get(t)?.historyProvider?.provideHistoryItemChanges(e,n,o)??void 0}catch(i){this.logService.error("ExtHostSCM#$provideHistoryItemChanges",i);return}}async $provideArtifactGroups(t,e){try{return(await this._sourceControls.get(t)?.artifactProvider?.provideArtifactGroups(e))?.map(i=>({...i,icon:js(i.icon)}))}catch(n){this.logService.error("ExtHostSCM#$provideArtifactGroups",n);return}}async $provideArtifacts(t,e,n){try{return this._sourceControls.get(t)?.provideArtifacts(e,n)}catch(o){this.logService.error("ExtHostSCM#$provideArtifacts",o);return}}};Wf=_([C(3,oe)],Wf);var Uk=class r{constructor(t,e){this.uriTransformer=e;this.providers=new Map;this.proxy=t.getProxy(F.MainThreadShare)}static{this.handlePool=0}async $provideShare(t,e,n){return await this.providers.get(t)?.provideShare({selection:j.to(e.selection),resourceUri:b.revive(e.resourceUri)},n)??void 0}registerShareProvider(t,e){let n=r.handlePool++;return this.providers.set(n,e),this.proxy.$registerShareProvider(n,Fi.from(t,this.uriTransformer),e.id,e.label,e.priority),{dispose:()=>{this.proxy.$unregisterShareProvider(n),this.providers.delete(n)}}}};var Fk=class r{constructor(t){this.providers=new Map;this.sessions=new Map;this.synthesizers=new Map;this.proxy=t.getProxy(F.MainThreadSpeech)}static{this.ID_POOL=1}async $createSpeechToTextSession(t,e,n){let o=this.providers.get(t);if(!o)return;let i=new $,s=new Ce;this.sessions.set(e,s);let a=await o.provideSpeechToTextSession(s.token,n?{language:n}:void 0);a&&(i.add(a.onDidChange(l=>{s.token.isCancellationRequested||this.proxy.$emitSpeechToTextEvent(e,l)})),i.add(s.token.onCancellationRequested(()=>i.dispose())))}async $cancelSpeechToTextSession(t){this.sessions.get(t)?.dispose(!0),this.sessions.delete(t)}async $createTextToSpeechSession(t,e,n){let o=this.providers.get(t);if(!o)return;let i=new $,s=new Ce;this.sessions.set(e,s);let a=await o.provideTextToSpeechSession(s.token,n?{language:n}:void 0);a&&(this.synthesizers.set(e,a),i.add(a.onDidChange(l=>{s.token.isCancellationRequested||this.proxy.$emitTextToSpeechEvent(e,l)})),i.add(s.token.onCancellationRequested(()=>i.dispose())))}async $synthesizeSpeech(t,e){this.synthesizers.get(t)?.synthesize(e)}async $cancelTextToSpeechSession(t){this.sessions.get(t)?.dispose(!0),this.sessions.delete(t),this.synthesizers.delete(t)}async $createKeywordRecognitionSession(t,e){let n=this.providers.get(t);if(!n)return;let o=new $,i=new Ce;this.sessions.set(e,i);let s=await n.provideKeywordRecognitionSession(i.token);s&&(o.add(s.onDidChange(a=>{i.token.isCancellationRequested||this.proxy.$emitKeywordRecognitionEvent(e,a)})),o.add(i.token.onCancellationRequested(()=>o.dispose())))}async $cancelKeywordRecognitionSession(t){this.sessions.get(t)?.dispose(!0),this.sessions.delete(t)}registerProvider(t,e,n){let o=r.ID_POOL++;return this.providers.set(o,n),this.proxy.$registerProvider(o,e,{extension:t,displayName:t.value}),K(()=>{this.proxy.$unregisterProvider(o),this.providers.delete(o)})}};var HO=class{constructor(t,e,n,o){this.id=t;this._proxy=e;this._sessions=n;this._url=o.url,this._title=o.title,this._favicon=o.favicon;let i=this;this.value={get url(){return i._url},get title(){return i._title},get icon(){return i._favicon?b.parse(i._favicon):new un(ce.globe.id)},startCDPSession(){return i._startCDPSession()},close(){return i._close()}}}update(t){let e=!1;return t.url!==this._url&&(this._url=t.url,e=!0),t.title!==this._title&&(this._title=t.title,e=!0),t.favicon!==this._favicon&&(this._favicon=t.favicon,e=!0),e}async _startCDPSession(){let t=Ae();await this._proxy.$startCDPSession(t,this.id);let e=new WO(t,this._proxy);return this._sessions.set(t,e),e.value}async _close(){await this._proxy.$closeBrowserTab(this.id)}},WO=class{constructor(t,e){this.id=t;this._proxy=e;this._onDidReceiveMessage=new E;this._onDidClose=new E;this._closed=!1;let n=this;this.value={get onDidReceiveMessage(){return n._onDidReceiveMessage.event},get onDidClose(){return n._onDidClose.event},sendMessage(o){return n._sendMessage(o)},close(){return n._close()}}}dispose(){this._onDidReceiveMessage.dispose(),this._onDidClose.dispose()}async _sendMessage(t){if(this._closed)throw new Error("Session is closed");if(!t||typeof t!="object")throw new Error("Message must be an object");if(typeof t.id!="number")throw new Error("Message must have a numeric id");if(typeof t.method!="string")throw new Error("Message must have a method string");if(t.params!==void 0&&typeof t.params!="object")throw new Error("Message params must be an object");if(t.sessionId!==void 0&&typeof t.sessionId!="string")throw new Error("Message sessionId must be a string");await this._proxy.$sendCDPMessage(this.id,{id:t.id,method:t.method,params:t.params,sessionId:t.sessionId})}async _close(){this._closed=!0,await this._proxy.$closeCDPSession(this.id)}_acceptMessage(t){this._onDidReceiveMessage.fire(t)}_acceptClosed(){this._closed=!0,this._onDidClose.fire()}},Hk=class extends O{constructor(e){super();this._browserTabs=new Map;this._sessions=this._register(new Fn);this._onDidOpenBrowserTab=this._register(new E);this.onDidOpenBrowserTab=this._onDidOpenBrowserTab.event;this._onDidCloseBrowserTab=this._register(new E);this.onDidCloseBrowserTab=this._onDidCloseBrowserTab.event;this._onDidChangeActiveBrowserTab=this._register(new E);this.onDidChangeActiveBrowserTab=this._onDidChangeActiveBrowserTab.event;this._onDidChangeBrowserTabState=this._register(new E);this.onDidChangeBrowserTabState=this._onDidChangeBrowserTabState.event;this._proxy=e.getProxy(F.MainThreadBrowsers)}get browserTabs(){return[...this._browserTabs.values()].map(e=>e.value)}get activeBrowserTab(){if(this._activeBrowserTabId)return this._browserTabs.get(this._activeBrowserTabId)?.value}async openBrowserTab(e,n){let o=Vt.from(n?.viewColumn),i=await this._proxy.$openBrowserTab(e,o,{preserveFocus:n?.preserveFocus,inactive:n?.background});return this._getOrCreateTab(i).value}_getOrCreateTab(e){let n=this._browserTabs.get(e.id);return n?n.update(e):(n=new HO(e.id,this._proxy,this._sessions,e),this._browserTabs.set(e.id,n),this._onDidOpenBrowserTab.fire(n.value)),n}$onDidOpenBrowserTab(e){this._getOrCreateTab(e)}$onDidCloseBrowserTab(e){let n=this._browserTabs.get(e);n&&(this._browserTabs.delete(e),this._activeBrowserTabId===e&&(this._activeBrowserTabId=void 0),this._onDidCloseBrowserTab.fire(n.value))}$onDidChangeActiveBrowserTab(e){this._activeBrowserTabId=e,this._onDidChangeActiveBrowserTab.fire(this.activeBrowserTab)}$onDidChangeBrowserTabState(e){let n=this._browserTabs.get(e.id);n&&n.update(e)&&this._onDidChangeBrowserTabState.fire(n.value)}$onCDPSessionMessage(e,n){let o=this._sessions.get(e);o&&o._acceptMessage(n)}$onCDPSessionClosed(e){let n=this._sessions.get(e);n&&(n._acceptClosed(),this._sessions.deleteAndDispose(e))}};var VO=class r{constructor(t,e,n,o,i,s=1,a,l){this._onDispose=l;this._disposed=!1;this._text="";this._staleCommandRegistrations=new $;if(this.#e=t,this.#t=e,i&&o){this._entryId=r4(o.identifier,i);let d=n.get(this._entryId);d&&(s=d.alignLeft?1:2,a=d.priority,this._visible=!0,this.name=d.name,this.text=d.text,this.tooltip=d.tooltip,this.command=d.command,this.accessibilityInformation=d.accessibilityInformation)}else this._entryId=String(r.ID_GEN++);this._extension=o,this._id=i,this._alignment=s,this._priority=this.validatePriority(a)}static{this.ID_GEN=0}static{this.ALLOWED_BACKGROUND_COLORS=new Map([["statusBarItem.errorBackground",new xa("statusBarItem.errorForeground")],["statusBarItem.warningBackground",new xa("statusBarItem.warningForeground")]])}#e;#t;validatePriority(t){if(Un(t))return t===Number.POSITIVE_INFINITY?Number.MAX_VALUE:t===Number.NEGATIVE_INFINITY?-Number.MAX_VALUE:t}get id(){return this._id??this._extension.identifier.value}get entryId(){return this._entryId}get alignment(){return this._alignment}get priority(){return this._priority}get text(){return this._text}get name(){return this._name}get tooltip(){return this._tooltip}get tooltip2(){return this._extension&&A(this._extension,"statusBarItemTooltip"),this._tooltip2}get color(){return this._color}get backgroundColor(){return this._backgroundColor}get command(){return this._command?.fromApi}get accessibilityInformation(){return this._accessibilityInformation}set text(t){this._text=t,this.update()}set name(t){this._name=t,this.update()}set tooltip(t){this._tooltip=t,this.update()}set tooltip2(t){this._extension&&A(this._extension,"statusBarItemTooltip"),this._tooltip2=t,this.update()}set color(t){this._color=t,this.update()}set backgroundColor(t){t&&!r.ALLOWED_BACKGROUND_COLORS.has(t.id)&&(t=void 0),this._backgroundColor=t,this.update()}set command(t){this._command?.fromApi!==t&&(this._latestCommandRegistration&&this._staleCommandRegistrations.add(this._latestCommandRegistration),this._latestCommandRegistration=new $,typeof t=="string"?this._command={fromApi:t,internal:this.#t.toInternal({title:"",command:t},this._latestCommandRegistration)}:t?this._command={fromApi:t,internal:this.#t.toInternal(t,this._latestCommandRegistration)}:this._command=void 0,this.update())}set accessibilityInformation(t){this._accessibilityInformation=t,this.update()}show(){this._visible=!0,this.update()}hide(){clearTimeout(this._timeoutHandle),this._visible=!1,this.#e.$disposeEntry(this._entryId)}update(){this._disposed||!this._visible||(clearTimeout(this._timeoutHandle),this._timeoutHandle=setTimeout(()=>{this._timeoutHandle=void 0;let t;this._extension?this._id?t=`${this._extension.identifier.value}.${this._id}`:t=this._extension.identifier.value:t=this._id;let e;this._name?e=this._name:e=p(3498,null,this._extension.displayName||this._extension.name);let n=this._color;this._backgroundColor&&(n=r.ALLOWED_BACKGROUND_COLORS.get(this._backgroundColor.id));let o,i;typeof this._tooltip2=="function"?(o=ue.fromStrict(this._tooltip),i=!0):(o=ue.fromStrict(this._tooltip2??this._tooltip),i=!1),this.#e.$setEntry(this._entryId,t,this._extension?.identifier.value,e,this._text,o,i,this._command?.internal,n,this._backgroundColor,this._alignment===1,this._priority,this._accessibilityInformation),this._staleCommandRegistrations.clear()},0))}dispose(){this.hide(),this._staleCommandRegistrations.dispose(),this._latestCommandRegistration?.dispose(),this._onDispose?.(),this._disposed=!0}},BO=class{constructor(t){this._messages=[];this._item=t.createStatusBarEntry(void 0,"status.extensionMessage",1,Number.MIN_VALUE),this._item.name=p(3499,null)}dispose(){this._messages.length=0,this._item.dispose()}setMessage(t){let e={message:t};return this._messages.unshift(e),this._update(),new be(()=>{let n=this._messages.indexOf(e);n>=0&&(this._messages.splice(n,1),this._update())})}_update(){this._messages.length>0?(this._item.text=this._messages[0].message,this._item.show()):this._item.hide()}},Wk=class{constructor(t,e){this._entries=new Map;this._existingItems=new Map;this._proxy=t.getProxy(F.MainThreadStatusBar),this._commands=e,this._statusMessage=new BO(this)}$acceptStaticEntries(t){for(let e of t)this._existingItems.set(e.entryId,e)}async $provideTooltip(t,e){let n=this._entries.get(t);if(!n)return;let o=typeof n.tooltip2=="function"?await n.tooltip2(e):n.tooltip2;return e.isCancellationRequested?void 0:ue.fromStrict(o)}createStatusBarEntry(t,e,n,o){let i=new VO(this._proxy,this._commands,this._existingItems,t,e,n,o,()=>this._entries.delete(i.entryId));return this._entries.set(i.entryId,i),i}setStatusBarMessage(t,e){let n=this._statusMessage.setMessage(t),o;return typeof e=="number"?o=setTimeout(()=>n.dispose(),e):typeof e<"u"&&e.then(()=>n.dispose(),()=>n.dispose()),new be(()=>{n.dispose(),clearTimeout(o)})}};var Vk=class extends O{constructor(e,n){super();this._extHostDocumentsAndEditors=n;this._onDidChangeTextEditorSelection=this._register(new E);this._onDidChangeTextEditorOptions=this._register(new E);this._onDidChangeTextEditorVisibleRanges=this._register(new E);this._onDidChangeTextEditorViewColumn=this._register(new E);this._onDidChangeTextEditorDiffInformation=this._register(new E);this._onDidChangeActiveTextEditor=this._register(new E);this._onDidChangeVisibleTextEditors=this._register(new E);this.onDidChangeTextEditorSelection=this._onDidChangeTextEditorSelection.event;this.onDidChangeTextEditorOptions=this._onDidChangeTextEditorOptions.event;this.onDidChangeTextEditorVisibleRanges=this._onDidChangeTextEditorVisibleRanges.event;this.onDidChangeTextEditorViewColumn=this._onDidChangeTextEditorViewColumn.event;this.onDidChangeTextEditorDiffInformation=this._onDidChangeTextEditorDiffInformation.event;this.onDidChangeActiveTextEditor=this._onDidChangeActiveTextEditor.event;this.onDidChangeVisibleTextEditors=this._onDidChangeVisibleTextEditors.event;this._proxy=e.getProxy(F.MainThreadTextEditors),this._register(this._extHostDocumentsAndEditors.onDidChangeVisibleTextEditors(o=>this._onDidChangeVisibleTextEditors.fire(o))),this._register(this._extHostDocumentsAndEditors.onDidChangeActiveTextEditor(o=>this._onDidChangeActiveTextEditor.fire(o)))}getActiveTextEditor(){return this._extHostDocumentsAndEditors.activeEditor()}getVisibleTextEditors(e){let n=this._extHostDocumentsAndEditors.allEditors();return e?n:n.map(o=>o.value)}async showTextDocument(e,n,o){let i;typeof n=="number"?i={position:Vt.from(n),preserveFocus:o}:typeof n=="object"?i={position:Vt.from(n.viewColumn),preserveFocus:n.preserveFocus,selection:typeof n.selection=="object"?j.from(n.selection):void 0,pinned:typeof n.preview=="boolean"?!n.preview:void 0}:i={preserveFocus:!1};let s=await this._proxy.$tryShowTextDocument(e.uri,i),a=s&&this._extHostDocumentsAndEditors.getEditor(s);if(a)return a.value;throw s?new Error(`Could NOT open editor for "${e.uri.toString()}" because another editor opened in the meantime.`):new Error(`Could NOT open editor for "${e.uri.toString()}".`)}createTextEditorDecorationType(e,n){return new oE(this._proxy,e,n).value}$acceptEditorPropertiesChanged(e,n){let o=this._extHostDocumentsAndEditors.getEditor(e);if(!o)throw new Error("unknown text editor");if(n.options&&o._acceptOptions(n.options),n.selections){let i=n.selections.selections.map(Eo.to);o._acceptSelections(i)}if(n.visibleRanges){let i=tt(n.visibleRanges.map(j.to));o._acceptVisibleRanges(i)}if(n.options&&this._onDidChangeTextEditorOptions.fire({textEditor:o.value,options:{...n.options,lineNumbers:du.to(n.options.lineNumbers)}}),n.selections){let i=eu.fromValue(n.selections.source),s=n.selections.selections.map(Eo.to);this._onDidChangeTextEditorSelection.fire({textEditor:o.value,selections:s,kind:i})}if(n.visibleRanges){let i=tt(n.visibleRanges.map(j.to));this._onDidChangeTextEditorVisibleRanges.fire({textEditor:o.value,visibleRanges:i})}}$acceptEditorPositionData(e){for(let n in e){let o=this._extHostDocumentsAndEditors.getEditor(n);if(!o)throw new Error("Unknown text editor");let i=Vt.to(e[n]);o.value.viewColumn!==i&&(o._acceptViewColumn(i),this._onDidChangeTextEditorViewColumn.fire({textEditor:o.value,viewColumn:i}))}}$acceptEditorDiffInformation(e,n){let o=this._extHostDocumentsAndEditors.getEditor(e);if(!o)throw new Error("unknown text editor");if(!n){o._acceptDiffInformation(void 0),this._onDidChangeTextEditorDiffInformation.fire({textEditor:o.value,diffInformation:void 0});return}let i=this,s=n.map(a=>{let l=b.revive(a.original),d=b.revive(a.modified),c=a.changes.map(u=>{let[m,g,h,f]=u,I;return m===g?I=1:h===f?I=2:I=3,{original:{startLineNumber:m,endLineNumberExclusive:g},modified:{startLineNumber:h,endLineNumberExclusive:f},kind:I}});return Object.freeze({documentVersion:a.documentVersion,original:l,modified:d,changes:c,get isStale(){return i._extHostDocumentsAndEditors.getDocument(d)?.version!==a.documentVersion}})});o._acceptDiffInformation(s),this._onDidChangeTextEditorDiffInformation.fire({textEditor:o.value,diffInformation:s})}getDiffInformation(e){return Promise.resolve(this._proxy.$getDiffInformation(e))}};var Vf=class{constructor(t){this._actual=new Wc(2),this._onDidChangeActiveColorTheme=new E}get activeColorTheme(){return this._actual}$onColorThemeChange(t){let e;switch(t){case"light":e=1;break;case"hcDark":e=3;break;case"hcLight":e=4;break;default:e=2}this._actual=new Wc(e),this._onDidChangeActiveColorTheme.fire(this._actual)}get onDidChangeActiveColorTheme(){return this._onDidChangeActiveColorTheme.event}};Vf=_([C(0,se)],Vf);var ivt=R("IExtHostTimeline"),Bk=class{constructor(t,e){this._providers=new Map;this._itemsBySourceAndUriMap=new Map;this._proxy=t.getProxy(F.MainThreadTimeline),e.registerArgumentProcessor({processArgument:(n,o)=>{if(n&&n.$mid===12)if(this._providers.get(n.source)&&o&&He(o,"timeline")){let i=n.uri===void 0?void 0:b.revive(n.uri);return this._itemsBySourceAndUriMap.get(n.source)?.get(R5(i))?.get(n.handle)}else return;return n}})}async $getTimeline(t,e,n,o){return this._providers.get(t)?.provider.provideTimeline(b.revive(e),n,o)}registerTimelineProvider(t,e,n,o){let i=new $,s=this.convertTimelineItem(e.id,o,i).bind(this),a;e.onDidChange&&(a=e.onDidChange(d=>this._proxy.$emitTimelineChangeEvent({uri:void 0,reset:!0,...d,id:e.id}),this));let l=this._itemsBySourceAndUriMap;return this.registerTimelineProviderCore({...e,scheme:t,onDidChange:void 0,async provideTimeline(d,c,u){c?.resetCache&&(i.clear(),l.get(e.id)?.clear());let m=await e.provideTimeline(d,c,u);if(m==null)return;let g=s(d,c);return{...m,source:e.id,items:m.items.map(g)}},dispose(){for(let d of l.values())d.get(e.id)?.clear();a?.dispose(),i.dispose()}},n)}convertTimelineItem(t,e,n){return(o,i)=>{let s;if(i?.cacheResults){let a=this._itemsBySourceAndUriMap.get(t);a===void 0&&(a=new Map,this._itemsBySourceAndUriMap.set(t,a));let l=R5(o);s=a.get(l),s===void 0&&(s=new Map,a.set(l,s))}return a=>{let{iconPath:l,...d}=a,c=`${t}|${a.id??a.timestamp}`;s?.set(c,a);let u,m,g;a.iconPath&&(l instanceof un?g={id:l.id,color:l.color}:b.isUri(l)?(u=l,m=l):{light:u,dark:m}=l);let h;return Zt.isMarkdownString(d.tooltip)?h=ue.from(d.tooltip):De(d.tooltip)?h=d.tooltip:Zt.isMarkdownString(d.detail)?(console.warn("Using deprecated TimelineItem.detail, migrate to TimelineItem.tooltip"),h=ue.from(d.detail)):De(d.detail)&&(console.warn("Using deprecated TimelineItem.detail, migrate to TimelineItem.tooltip"),h=d.detail),{...d,id:d.id??void 0,handle:c,source:t,command:a.command?e.toInternal(a.command,n):void 0,icon:u,iconDark:m,themeIcon:g,tooltip:h,accessibilityInformation:a.accessibilityInformation}}}}registerTimelineProviderCore(t,e){if(this._providers.get(t.id))throw new Error(`Timeline Provider ${t.id} already exists.`);return this._proxy.$registerTimelineProvider({id:t.id,label:t.label,scheme:t.scheme}),this._providers.set(t.id,{provider:t,extension:e}),K(()=>{for(let o of this._itemsBySourceAndUriMap.values())o.get(t.id)?.clear();this._providers.delete(t.id),this._proxy.$unregisterTimelineProvider(t.id),t.dispose()})}};function R5(r){return r?.toString()}var bvt=p(5088,null),yvt=Su("default-view-icon",ce.window,p(5085,null)),qO;(e=>(e.ViewContainersRegistry="workbench.registry.view.containers",e.ViewsRegistry="workbench.registry.view"))(qO||={});var $O=class extends O{constructor(){super(...arguments);this._onDidRegister=this._register(new E);this.onDidRegister=this._onDidRegister.event;this._onDidDeregister=this._register(new E);this.onDidDeregister=this._onDidDeregister.event;this.viewContainers=new Map;this.defaultViewContainers=[]}get all(){return[...this.viewContainers.values()].flat()}registerViewContainer(e,n,o){let i=this.get(e.id);if(i)return i;let s=e;return s.openCommandActionDescriptor=o?.doNotRegisterOpenCommand?void 0:s.openCommandActionDescriptor??{id:s.id},NP(this.viewContainers,n,[]).push(s),o?.isDefault&&this.defaultViewContainers.push(s),this._onDidRegister.fire({viewContainer:s,viewContainerLocation:n}),s}deregisterViewContainer(e){for(let n of this.viewContainers.keys()){let o=this.viewContainers.get(n),i=o?.indexOf(e);if(i!==-1){o?.splice(i,1),o.length===0&&this.viewContainers.delete(n),this._onDidDeregister.fire({viewContainer:e,viewContainerLocation:n});return}}}get(e){return this.all.filter(n=>n.id===e)[0]}getViewContainers(e){return[...this.viewContainers.get(e)||[]]}getViewContainerLocation(e){return[...this.viewContainers.keys()].filter(n=>this.getViewContainers(n).filter(o=>o?.id===e.id).length>0)[0]}getDefaultViewContainers(e){return this.defaultViewContainers.filter(n=>this.getViewContainerLocation(n)===e)}};vt.add(qO.ViewContainersRegistry,new $O);function vQ(r,t){let e=r.group??"9_more",n=t.group??"9_more";return e!==n?e.localeCompare(n):(r.order??5)-(t.order??5)}var zO=class extends O{constructor(){super(...arguments);this._onViewsRegistered=this._register(new E);this.onViewsRegistered=this._onViewsRegistered.event;this._onViewsDeregistered=this._register(new E);this.onViewsDeregistered=this._onViewsDeregistered.event;this._onDidChangeContainer=this._register(new E);this.onDidChangeContainer=this._onDidChangeContainer.event;this._onDidChangeViewWelcomeContent=this._register(new E);this.onDidChangeViewWelcomeContent=this._onDidChangeViewWelcomeContent.event;this._viewContainers=[];this._views=new Map;this._viewWelcomeContents=new Ju}registerViews(e,n){this.registerViews2([{views:e,viewContainer:n}])}registerViews2(e){e.forEach(({views:n,viewContainer:o})=>this.addViews(n,o)),this._onViewsRegistered.fire(e)}deregisterViews(e,n){let o=this.removeViews(e,n);o.length&&this._onViewsDeregistered.fire({views:o,viewContainer:n})}moveViews(e,n){for(let o of this._views.keys())if(o!==n){let i=this.removeViews(e,o);i.length&&(this.addViews(i,n),this._onDidChangeContainer.fire({views:i,from:o,to:n}))}}getViews(e){return this._views.get(e)||[]}getView(e){for(let n of this._viewContainers){let o=(this._views.get(n)||[]).filter(i=>i.id===e)[0];if(o)return o}return null}getViewContainer(e){for(let n of this._viewContainers)if((this._views.get(n)||[]).filter(i=>i.id===e)[0])return n;return null}registerViewWelcomeContent(e,n){return this._viewWelcomeContents.add(e,n),this._onDidChangeViewWelcomeContent.fire(e),K(()=>{this._viewWelcomeContents.delete(e,n),this._onDidChangeViewWelcomeContent.fire(e)})}registerViewWelcomeContent2(e,n){let o=new Map;for(let[i,s]of n)this._viewWelcomeContents.add(e,s),o.set(i,K(()=>{this._viewWelcomeContents.delete(e,s),this._onDidChangeViewWelcomeContent.fire(e)}));return this._onDidChangeViewWelcomeContent.fire(e),o}getViewWelcomeContent(e){let n=[];return this._viewWelcomeContents.forEach(e,o=>n.push(o)),n.sort(vQ)}addViews(e,n){let o=this._views.get(n);o||(o=[],this._views.set(n,o),this._viewContainers.push(n));for(let i of e){if(this.getView(i.id)!==null)throw new Error(p(5086,null,i.id));o.push(i)}}removeViews(e,n){let o=this._views.get(n);if(!o)return[];let i=[],s=[];for(let a of o)e.includes(a)?i.push(a):s.push(a);return i.length&&(s.length?this._views.set(n,s):(this._views.delete(n),this._viewContainers.splice(this._viewContainers.indexOf(n),1))),i}};vt.add(qO.ViewsRegistry,new zO);var Ivt=R("viewDescriptorService");var li=class extends Error{constructor(e){super(p(5087,null,e));this.name="NoTreeViewError"}static is(e){return!!e&&e.name==="NoTreeViewError"}};var $k=class{constructor(){this._dragOperations=new Map}removeDragOperationTransfer(t){if(t&&this._dragOperations.has(t)){let e=this._dragOperations.get(t);return this._dragOperations.delete(t),e}}addDragOperationTransfer(t,e){this._dragOperations.set(t,e)}};function A5(r,t){if(De(r))return{label:r};if(r&&typeof r=="object"&&r.label){let e;if(Array.isArray(r.highlights)&&(e=r.highlights.filter((n=>n.length===2&&typeof n[0]=="number"&&typeof n[1]=="number")),e=e.length?e:void 0),De(r.label))return{label:r.label,highlights:e};if(Zt.isMarkdownString(r.label))return A(t,"treeItemMarkdownLabel"),{label:ue.from(r.label),highlights:e}}}var zk=class extends O{constructor(e,n,o){super();this._proxy=e;this._commands=n;this._logService=o;this._treeViews=new Map;this._treeDragAndDropService=new $k;function i(s){return s&&s.$treeViewId&&(s.$treeItemHandle||s.$selectedTreeItems||s.$focusedTreeItem)}n.registerArgumentProcessor({processArgument:s=>i(s)?this._convertArgument(s):Array.isArray(s)&&s.length>0?s.map(a=>i(a)?this._convertArgument(a):a):s})}registerTreeDataProvider(e,n,o){let i=this.createTreeView(e,{treeDataProvider:n},o);return{dispose:()=>i.dispose()}}createTreeView(e,n,o){if(!n||!n.treeDataProvider)throw new Error("Options with treeDataProvider is mandatory");let i=n.dragAndDropController?.dropMimeTypes??[],s=n.dragAndDropController?.dragMimeTypes??[],a=!!n.dragAndDropController?.handleDrag,l=!!n.dragAndDropController?.handleDrop,d=this._createExtHostTreeView(e,n,o),c={showCollapseAll:!!n.showCollapseAll,canSelectMany:!!n.canSelectMany,dropMimeTypes:i,dragMimeTypes:s,hasHandleDrag:a,hasHandleDrop:l,manuallyManageCheckboxes:!!n.manageCheckboxStateManually},u=this._proxy.$registerTreeViewDataProvider(e,c),m={get onDidCollapseElement(){return d.onDidCollapseElement},get onDidExpandElement(){return d.onDidExpandElement},get selection(){return d.selectedElements},get onDidChangeSelection(){return d.onDidChangeSelection},get activeItem(){return A(o,"treeViewActiveItem"),d.focusedElement},get onDidChangeActiveItem(){return A(o,"treeViewActiveItem"),d.onDidChangeActiveItem},get visible(){return d.visible},get onDidChangeVisibility(){return d.onDidChangeVisibility},get onDidChangeCheckboxState(){return d.onDidChangeCheckboxState},get message(){return d.message},set message(g){Uo(g)&&A(o,"treeViewMarkdownMessage"),d.message=g},get title(){return d.title},set title(g){d.title=g},get description(){return d.description},set description(g){d.description=g},get badge(){return d.badge},set badge(g){g!==void 0&&m1.isViewBadge(g)?d.badge={value:Math.floor(Math.abs(g.value)),tooltip:g.tooltip}:g===void 0&&(d.badge=void 0)},reveal:(g,h)=>d.reveal(g,h),dispose:async()=>{await u,this._treeViews.get(e)===d&&(this._treeViews.delete(e),this._proxy.$disposeTree(e)),d.dispose()}};return this._register(m),m}async $getChildren(e,n){let o=this._treeViews.get(e);if(!o)return Promise.reject(new li(e));if(!n){let s=await o.getChildren();return s?[[0,...s]]:void 0}let i=[];for(let s=0;s<n.length;s++){let a=n[s],l=await o.getChildren(a);l&&i.push([s,...l])}return i}async $handleDrop(e,n,o,i,s,a,l,d){let c=this._treeViews.get(e);if(!c)return Promise.reject(new li(e));let u=cu.toDataTransfer(o,async m=>(await this._proxy.$resolveDropFileData(e,n,m)).buffer);return l===e&&d&&await this._addAdditionalTransferItems(u,c,d,s,a),c.onDrop(u,i,s)}async _addAdditionalTransferItems(e,n,o,i,s){let a=this._treeDragAndDropService.removeDragOperationTransfer(s);if(a)(await a)?.forEach((l,d)=>{l&&e.set(d,l)});else if(s&&n.handleDrag){let l=n.handleDrag(o,e,i);this._treeDragAndDropService.addDragOperationTransfer(s,l),await l}return e}async $handleDrag(e,n,o,i){let s=this._treeViews.get(e);if(!s)return Promise.reject(new li(e));let a=await this._addAdditionalTransferItems(new Zr,s,n,i,o);if(!(!a||i.isCancellationRequested))return cu.from(a)}async $hasResolve(e){let n=this._treeViews.get(e);if(!n)throw new li(e);return n.hasResolve}$resolve(e,n,o){let i=this._treeViews.get(e);if(!i)throw new li(e);return i.resolveTreeItem(n,o)}$setExpanded(e,n,o){let i=this._treeViews.get(e);if(!i)throw new li(e);i.setExpanded(n,o)}$setSelectionAndFocus(e,n,o){let i=this._treeViews.get(e);if(!i)throw new li(e);i.setSelectionAndFocus(n,o)}$setVisible(e,n){let o=this._treeViews.get(e);if(!o){if(!n)return;throw new li(e)}o.setVisible(n)}$changeCheckboxState(e,n){let o=this._treeViews.get(e);if(!o)throw new li(e);o.setCheckboxState(n)}_createExtHostTreeView(e,n,o){let i=this._register(new KO(e,n,this._proxy,this._commands.converter,this._logService,o));return this._treeViews.set(e,i),i}_convertArgument(e){let n=this._treeViews.get(e.$treeViewId),o=e;return n&&o.$treeItemHandle?n.getExtensionElement(o.$treeItemHandle):n&&e.$focusedTreeItem?n.focusedElement:null}},KO=class r extends O{constructor(e,n,o,i,s,a){super();this._viewId=e;this._proxy=o;this._commands=i;this._logService=s;this._extension=a;this._roots=void 0;this._elements=new Map;this._nodes=new Map;this._childrenFetchTokens=new Map;this._globalFetchTokenCounter=0;this._visible=!1;this._selectedHandles=[];this._focusedHandle=void 0;this._onDidExpandElement=this._register(new E);this.onDidExpandElement=this._onDidExpandElement.event;this._onDidCollapseElement=this._register(new E);this.onDidCollapseElement=this._onDidCollapseElement.event;this._onDidChangeSelection=this._register(new E);this.onDidChangeSelection=this._onDidChangeSelection.event;this._onDidChangeActiveItem=this._register(new E);this.onDidChangeActiveItem=this._onDidChangeActiveItem.event;this._onDidChangeVisibility=this._register(new E);this.onDidChangeVisibility=this._onDidChangeVisibility.event;this._onDidChangeCheckboxState=this._register(new E);this.onDidChangeCheckboxState=this._onDidChangeCheckboxState.event;this._onDidChangeData=this._register(new E);this._refreshPromise=Promise.resolve();this._refreshQueue=Promise.resolve();this._nodesToClear=new Set;this._message="";this._title="";this._refreshCancellationSource=new Ce;if(a.contributes&&a.contributes.views)for(let u in a.contributes.views)for(let m of a.contributes.views[u])m.id===e&&(this._title=m.name);this._dataProvider=n.treeDataProvider,this._dndController=n.dragAndDropController,this._dataProvider.onDidChangeTreeData&&this._register(this._dataProvider.onDidChangeTreeData(u=>{Array.isArray(u)&&u.length===0||this._onDidChangeData.fire({message:!1,element:u})}));let l,d,c=he.debounce(this._onDidChangeData.event,(u,m)=>(u||(u={message:!1,elements:[]}),m.element!==!1&&(l||(l=new Promise(g=>d=g),this._refreshPromise=this._refreshPromise.then(()=>l)),Array.isArray(m.element)?u.elements.push(...m.element):u.elements.push(m.element)),m.message&&(u.message=!0),u),200,!0);this._register(c(({message:u,elements:m})=>{m.length&&(m=Br(m),this._refreshQueue=this._refreshQueue.then(()=>{let g=d;l=null;let h=Array.from(this._nodesToClear);return this._nodesToClear.clear(),this._debugLogRefresh("start",m,h),this._refresh(m).then(()=>(this._debugLogRefresh("done",m,h),this._clearNodes(h),g())).catch(f=>{let I=f instanceof Error?f.message:JSON.stringify(f);return this._debugLogRefresh("error",m,h),this._clearNodes(h),this._logService.error(`Unable to refresh tree view ${this._viewId}: ${I}`),g()})})),u&&this._proxy.$setMessage(this._viewId,ue.fromStrict(this._message)??"")}))}static{this.LABEL_HANDLE_PREFIX="0"}static{this.ID_HANDLE_PREFIX="1"}static{this.ROOT_FETCH_KEY=Symbol("extHostTreeViewRoot")}get visible(){return this._visible}get selectedElements(){return this._selectedHandles.map(e=>this.getExtensionElement(e)).filter(e=>!Ot(e))}get focusedElement(){return this._focusedHandle?this.getExtensionElement(this._focusedHandle):void 0}_debugCollectHandles(e){let n=[];for(let i of e){if(!i){n.push("<root>");continue}let s=this._nodes.get(i);s&&n.push(s.item.handle)}let o=this._roots?.map(i=>i.item.handle)??[];return{changed:n,roots:o}}_debugLogRefresh(e,n,o){if(this._isDebugLogging())try{let i=this._debugCollectHandles(n);i.clearing=o.map(l=>l.item.handle);let s=i.changed.length,a=o.length;this._logService.debug(`[TreeView:${this._viewId}] refresh ${e} changed=${s} nodesToClear=${a} elements.size=${this._elements.size} nodes.size=${this._nodes.size} handles=${JSON.stringify(i)}`)}catch{this._logService.debug(`[TreeView:${this._viewId}] refresh ${e} (snapshot failed)`)}}_isDebugLogging(){try{let e=this._logService.getLevel();return e===2||e===1}catch{return!1}}async getChildren(e){let n=e?this.getExtensionElement(e):void 0;if(e&&!n)return this._logService.error(`No tree item with id '${e}' found.`),Promise.resolve([]);let o=this._getChildrenNodes(e);return o||(o=await this._fetchChildrenNodes(n)),o?o.map(i=>i.item):void 0}getExtensionElement(e){return this._elements.get(e)}reveal(e,n){n=n||{select:!0,focus:!1};let o=Ot(n.select)?!0:n.select,i=Ot(n.focus)?!1:n.focus,s=Ot(n.expand)?!1:n.expand;return typeof this._dataProvider.getParent!="function"?Promise.reject(new Error("Required registered TreeDataProvider to implement 'getParent' method to access 'reveal' method")):e?this._refreshPromise.then(()=>this._resolveUnknownParentChain(e)).then(a=>this._resolveTreeNode(e,a[a.length-1]).then(l=>this._proxy.$reveal(this._viewId,{item:l.item,parentChain:a.map(d=>d.item)},{select:o,focus:i,expand:s})),a=>this._logService.error(a)):this._proxy.$reveal(this._viewId,void 0,{select:o,focus:i,expand:s})}get message(){return this._message}set message(e){this._message=e,this._onDidChangeData.fire({message:!0,element:!1})}get title(){return this._title}set title(e){this._title=e,this._proxy.$setTitle(this._viewId,e,this._description)}get description(){return this._description}set description(e){this._description=e,this._proxy.$setTitle(this._viewId,this._title,e)}get badge(){return this._badge}set badge(e){this._badge?.value===e?.value&&this._badge?.tooltip===e?.tooltip||(this._badge=ab.from(e),this._proxy.$setBadge(this._viewId,e))}setExpanded(e,n){let o=this.getExtensionElement(e);o&&(n?this._onDidExpandElement.fire(Object.freeze({element:o})):this._onDidCollapseElement.fire(Object.freeze({element:o})))}setSelectionAndFocus(e,n){let o=!rn(this._selectedHandles,e);this._selectedHandles=e;let i=this._focusedHandle!==n;this._focusedHandle=n,o&&this._onDidChangeSelection.fire(Object.freeze({selection:this.selectedElements})),i&&this._onDidChangeActiveItem.fire(Object.freeze({activeItem:this.focusedElement}))}setVisible(e){e!==this._visible&&(this._visible=e,this._onDidChangeVisibility.fire(Object.freeze({visible:this._visible})))}async setCheckboxState(e){let n=(await Promise.all(e.map(async o=>{let i=this.getExtensionElement(o.treeItemHandle);return i?{extensionItem:i,treeItem:await this._dataProvider.getTreeItem(i),newState:o.newState?1:0}:Promise.resolve(void 0)}))).filter(o=>o!==void 0);n.forEach(o=>{o.treeItem.checkboxState=o.newState?1:0}),this._onDidChangeCheckboxState.fire({items:n.map(o=>[o.extensionItem,o.newState])})}async handleDrag(e,n,o){let i=[];for(let s of e){let a=this.getExtensionElement(s);a&&i.push(a)}if(!(!this._dndController?.handleDrag||i.length===0))return await this._dndController.handleDrag(i,n,o),n}get hasHandleDrag(){return!!this._dndController?.handleDrag}async onDrop(e,n,o){let i=n?this.getExtensionElement(n):void 0;if(!(!i&&n||!this._dndController?.handleDrop))return hn(()=>this._dndController?.handleDrop?this._dndController.handleDrop(i,e,o):void 0)}get hasResolve(){return!!this._dataProvider.resolveTreeItem}async resolveTreeItem(e,n){if(!this._dataProvider.resolveTreeItem)return;let o=this._elements.get(e);if(o){let i=this._nodes.get(o);if(i){let s=await this._dataProvider.resolveTreeItem(i.extensionItem,o,n)??i.extensionItem;return this._validateTreeItem(s),i.item.tooltip=this._getTooltip(s.tooltip),i.item.command=this._getCommand(i.disposableStore,s.command),i.item}}}_resolveUnknownParentChain(e){return this._resolveParent(e).then(n=>n?this._resolveUnknownParentChain(n).then(o=>this._resolveTreeNode(n,o[o.length-1]).then(i=>(o.push(i),o))):Promise.resolve([]))}_resolveParent(e){let n=this._nodes.get(e);return n?Promise.resolve(n.parent?this._elements.get(n.parent.item.handle):void 0):hn(()=>this._dataProvider.getParent(e))}async _resolveTreeNode(e,n){let o=this._nodes.get(e);if(o)return o;let i=await hn(()=>this._dataProvider.getTreeItem(e)),s=this._createHandle(e,i,n,!0);await this.getChildren(n?n.item.handle:void 0);let a=this.getExtensionElement(s);if(a){let l=this._nodes.get(a);if(l)return l}throw this._logService.error(`[TreeView:${this._viewId}] Failed to resolve tree node for element ${s}`),this._proxy.$logResolveTreeNodeFailure(this._extension.identifier.value),new Error(`Cannot resolve tree item for element ${s} from extension ${this._extension.identifier.value}`)}_getChildrenNodes(e){if(e){let n;if(typeof e=="string"){let o=this.getExtensionElement(e);n=o?this._nodes.get(o):void 0}else n=e;return n&&n.children||void 0}return this._roots}_getFetchKey(e){return e??r.ROOT_FETCH_KEY}async _fetchChildrenNodes(e){this._addChildrenToClear(e);let n=this._getFetchKey(e),o=++this._globalFetchTokenCounter;this._childrenFetchTokens.set(n,o);let i=new Ce(this._refreshCancellationSource.token);try{let s=await this._dataProvider.getChildren(e);if(this._childrenFetchTokens.get(n)!==o)return;let a=e?this._nodes.get(e):void 0;if(i.token.isCancellationRequested)return;let l=tt(s||[]),d=await Promise.all(tt(l).map(u=>this._dataProvider.getTreeItem(u)));if(this._childrenFetchTokens.get(n)!==o||i.token.isCancellationRequested)return;let c=d.map((u,m)=>u?this._createAndRegisterTreeNode(l[m],u,a):null);return this._childrenFetchTokens.get(n)!==o?void 0:tt(c)}finally{i.dispose()}}_refresh(e){if(e.some(o=>!o))return this._refreshCancellationSource.dispose(!0),this._refreshCancellationSource=new Ce,this._addChildrenToClear(),this._proxy.$refresh(this._viewId);{let o=this._getHandlesToRefresh(e);if(o.length)return this._refreshHandles(o)}return Promise.resolve(void 0)}_getHandlesToRefresh(e){let n=new Set,o=e.map(s=>this._nodes.get(s));for(let s of o)if(s&&!n.has(s.item.handle)){let a=s;for(;a&&a.parent&&o.findIndex(l=>a&&a.parent&&l&&l.item.handle===a.parent.item.handle)===-1;){let l=this._elements.get(a.parent.item.handle);a=l?this._nodes.get(l):void 0}a&&!a.parent&&n.add(s.item.handle)}let i=[];return n.forEach(s=>{let a=this._elements.get(s);if(a){let l=this._nodes.get(a);l&&(!l.parent||!n.has(l.parent.item.handle))&&i.push(s)}}),i}_refreshHandles(e){let n={};return Promise.all(e.map(o=>this._refreshNode(o).then(i=>{i&&(n[o]=i.item)}))).then(()=>Object.keys(n).length?this._proxy.$refresh(this._viewId,n):void 0)}_refreshNode(e){let n=this.getExtensionElement(e);if(n){let o=this._nodes.get(n);if(o)return this._addChildrenToClear(n),hn(()=>this._dataProvider.getTreeItem(n)).then(i=>{if(i){let s=this._createTreeNode(n,i,o.parent);return this._updateNodeCache(n,s,o,o.parent),o.dispose(),s}return null})}return Promise.resolve(null)}_createAndRegisterTreeNode(e,n,o){let i=n.id?`${r.ID_HANDLE_PREFIX}/${n.id}`:void 0;if(i){let a=this._elements.get(i);if(a){let l=this._nodes.get(a);if(a!==e&&this._nodes.delete(a),l){let d=this._createTreeNode(e,n,o);return this._updateNodeCache(e,d,l,o),l.dispose(),d}}}let s=this._createTreeNode(e,n,o);return this._addNodeToCache(e,s),this._addNodeToParentCache(s,o),s}_getTooltip(e){return Zt.isMarkdownString(e)?ue.from(e):e}_getCommand(e,n){return n?{...this._commands.toInternal(n,e),originalId:n.command}:void 0}_getCheckbox(e){if(e.checkboxState===void 0)return;let n,o,i;return typeof e.checkboxState=="number"?n=e.checkboxState:(n=e.checkboxState.state,o=e.checkboxState.tooltip,i=e.checkboxState.accessibilityInformation),{isChecked:n===1,tooltip:o,accessibilityInformation:i}}_validateTreeItem(e){if(!Ts.isTreeItem(e,this._extension))throw new Error(`Extension ${this._extension.identifier.value} has provided an invalid tree item.`)}_createTreeNode(e,n,o){this._validateTreeItem(n);let i=this._register(new $),s=this._createHandle(e,n,o),a=this._getLightIconPath(n);return{item:{handle:s,parentHandle:o?o.item.handle:void 0,label:A5(n.label,this._extension),description:n.description,resourceUri:n.resourceUri,tooltip:this._getTooltip(n.tooltip),command:this._getCommand(i,n.command),contextValue:n.contextValue,icon:a,iconDark:this._getDarkIconPath(n)||a,themeIcon:this._getThemeIcon(n),collapsibleState:Ot(n.collapsibleState)?0:n.collapsibleState,accessibilityInformation:n.accessibilityInformation,checkbox:this._getCheckbox(n)},extensionItem:n,parent:o,children:void 0,disposableStore:i,dispose(){i.dispose()}}}_getThemeIcon(e){return e.iconPath instanceof un?e.iconPath:void 0}_createHandle(e,{id:n,label:o,resourceUri:i},s,a){if(n)return`${r.ID_HANDLE_PREFIX}/${n}`;let l=A5(o,this._extension),d=s?s.item.handle:r.LABEL_HANDLE_PREFIX,c="";l&&(Uo(l.label)?c=l.label.value:c=l.label);let u=c||(i?Tt(i):"");u=u.indexOf("/")!==-1?u.replace("/","//"):u;let m=this._nodes.has(e)?this._nodes.get(e).item.handle:void 0,g=this._getChildrenNodes(s)||[],h,f=0;do{if(h=`${d}/${f}:${u}`,a||!this._elements.has(h)||m===h)break;f++}while(f<=g.length);return h}_getLightIconPath(e){if(e.iconPath&&!(e.iconPath instanceof un))return typeof e.iconPath=="string"||b.isUri(e.iconPath)?this._getIconPath(e.iconPath):this._getIconPath(e.iconPath.light)}_getDarkIconPath(e){if(e.iconPath&&!(e.iconPath instanceof un)&&e.iconPath.dark)return this._getIconPath(e.iconPath.dark)}_getIconPath(e){return b.isUri(e)?e:b.file(e)}_addNodeToCache(e,n){this._elements.set(n.item.handle,e),this._nodes.set(e,n)}_updateNodeCache(e,n,o,i){this._elements.delete(n.item.handle),this._nodes.delete(e),n.item.handle!==o.item.handle&&this._elements.delete(o.item.handle),this._addNodeToCache(e,n);let s=this._getChildrenNodes(i)||[],a=s.filter(l=>l.item.handle===o.item.handle)[0];a&&s.splice(s.indexOf(a),1,n)}_addNodeToParentCache(e,n){n?(n.children||(n.children=[]),n.children.push(e)):(this._roots||(this._roots=[]),this._roots.push(e))}_addChildrenToClear(e){if(e){let n=this._nodes.get(e);if(n){if(n.children)for(let o of n.children){this._nodesToClear.add(o);let i=this._elements.get(o.item.handle);i&&(this._addChildrenToClear(i),this._nodes.delete(i),this._elements.delete(o.item.handle))}n.children=void 0}}else this._addAllToClear()}_addAllToClear(){this._roots=void 0,this._nodes.forEach(e=>{this._nodesToClear.add(e)}),this._nodes.clear(),this._elements.clear(),this._childrenFetchTokens.clear()}_clearNodes(e){Cn(e)}_clearAll(){this._roots=void 0,this._elements.clear(),Cn(this._nodes.values()),this._nodes.clear(),Cn(this._nodesToClear),this._nodesToClear.clear(),this._childrenFetchTokens.clear()}dispose(){super.dispose(),this._refreshCancellationSource.dispose(),this._clearAll()}};var qk=class r{constructor(t){this._openers=new Map;this._proxy=t.getProxy(F.MainThreadUriOpeners)}static{this.supportedSchemes=new Set([V.http,V.https])}registerExternalUriOpener(t,e,n,o){if(this._openers.has(e))throw new Error(`Opener with id '${e}' already registered`);let i=o.schemes.find(s=>!r.supportedSchemes.has(s));if(i)throw new Error(`Scheme '${i}' is not supported. Only http and https are currently supported.`);return this._openers.set(e,n),this._proxy.$registerUriOpener(e,o.schemes,t,o.label),K(()=>{this._openers.delete(e),this._proxy.$unregisterUriOpener(e)})}async $canOpenUri(t,e,n){let o=this._openers.get(t);if(!o)throw new Error(`Unknown opener with id: ${t}`);let i=b.revive(e);return o.canOpenExternalUri(i,n)}async $openUri(t,e,n){let o=this._openers.get(t);if(!o)throw new Error(`Unknown opener id: '${t}'`);return o.openExternalUri(b.revive(e.resolvedUri),{sourceUri:b.revive(e.sourceUri)},n)}};var jO=class extends O{constructor(e,n,o,i){super();this.#a=void 0;this.#d=!0;this.#r=!1;this.#u=this._register(new E);this.onDidDispose=this.#u.event;this.#p=this._register(new E);this.onDidChangeViewState=this.#p.event;this.#e=e,this.#t=n,this.#o=o,this.#n=i.viewType,this.#s=i.panelOptions,this.#a=i.viewColumn,this.#i=i.title,this.#c=i.active}#e;#t;#n;#o;#s;#i;#l;#a;#d;#c;#r;#u;#p;dispose(){this.#r||(this.#r=!0,this.#u.fire(),this.#t.$disposeWebview(this.#e),this.#o.dispose(),super.dispose())}get webview(){return this.assertNotDisposed(),this.#o}get viewType(){return this.assertNotDisposed(),this.#n}get title(){return this.assertNotDisposed(),this.#i}set title(e){this.assertNotDisposed(),this.#i!==e&&(this.#i=e,this.#t.$setTitle(this.#e,e))}get iconPath(){return this.assertNotDisposed(),this.#l}set iconPath(e){this.assertNotDisposed(),this.#l!==e&&(this.#l=e,b.isUri(e)?this.#t.$setIconPath(this.#e,{light:e,dark:e}):this.#t.$setIconPath(this.#e,e))}get options(){return this.#s}get viewColumn(){if(this.assertNotDisposed(),!(typeof this.#a=="number"&&this.#a<0))return this.#a}get active(){return this.assertNotDisposed(),this.#c}get visible(){return this.assertNotDisposed(),this.#d}_updateViewState(e){this.#r||(this.active!==e.active||this.visible!==e.visible||this.viewColumn!==e.viewColumn)&&(this.#c=e.active,this.#d=e.visible,this.#a=e.viewColumn,this.#p.fire({webviewPanel:this}))}reveal(e,n){this.assertNotDisposed(),this.#t.$reveal(this.#e,{viewColumn:typeof e>"u"?void 0:Vt.from(e),preserveFocus:!!n})}assertNotDisposed(){if(this.#r)throw new Error("Webview is disposed")}},Kk=class r extends O{constructor(e,n,o){super();this.webviews=n;this.workspace=o;this._webviewPanels=new Map;this._serializers=new Map;this._proxy=e.getProxy(F.MainThreadWebviewPanels)}static newHandle(){return Ae()}dispose(){super.dispose(),this._webviewPanels.forEach(e=>e.dispose()),this._webviewPanels.clear()}createWebviewPanel(e,n,o,i,s={}){let a=typeof i=="object"?i.viewColumn:i,l={viewColumn:Vt.from(a),preserveFocus:typeof i=="object"&&!!i.preserveFocus},d=qa(e),c=r.newHandle();this._proxy.$createWebviewPanel(Ru(e),c,n,{title:o,panelOptions:bQ(s),webviewOptions:OL(e,this.workspace,s),serializeBuffersForPostMessage:d},l);let u=this.webviews.createNewWebview(c,s,e);return this.createNewWebviewPanel(c,n,o,a,s,u,!0)}$onDidChangeWebviewPanelViewStates(e){let n=Object.keys(e);n.sort((o,i)=>{let s=e[o],a=e[i];return s.active?1:a.active?-1:+s.visible-+a.visible});for(let o of n){let i=this.getWebviewPanel(o);if(!i)continue;let s=e[o];i._updateViewState({active:s.active,visible:s.visible,viewColumn:Vt.to(s.position)})}}async $onDidDisposeWebviewPanel(e){this.getWebviewPanel(e)?.dispose(),this._webviewPanels.delete(e),this.webviews.deleteWebview(e)}registerWebviewPanelSerializer(e,n,o){if(this._serializers.has(n))throw new Error(`Serializer for '${n}' already registered`);return this._serializers.set(n,{serializer:o,extension:e}),this._proxy.$registerSerializer(n,{serializeBuffersForPostMessage:qa(e)}),new be(()=>{this._serializers.delete(n),this._proxy.$unregisterSerializer(n)})}async $deserializeWebviewPanel(e,n,o,i){let s=this._serializers.get(n);if(!s)throw new Error(`No serializer found for '${n}'`);let{serializer:a,extension:l}=s,d=this.webviews.createNewWebview(e,o.webviewOptions,l),c=this.createNewWebviewPanel(e,n,o.title,i,o.panelOptions,d,o.active);await a.deserializeWebviewPanel(c,o.state)}createNewWebviewPanel(e,n,o,i,s,a,l){let d=new jO(e,this._proxy,a,{viewType:n,title:o,viewColumn:i,panelOptions:s,active:l});return this._webviewPanels.set(e,d),d}getWebviewPanel(e){return this._webviewPanels.get(e)}};function bQ(r){return{enableFindWidget:r.enableFindWidget,retainContextWhenHidden:r.retainContextWhenHidden}}var GO=class extends O{constructor(e,n,o,i,s,a){super();this.#s=!1;this.#c=this._register(new E);this.onDidChangeVisibility=this.#c.event;this.#r=this._register(new E);this.onDidDispose=this.#r.event;this.#n=o,this.#l=i,this.#e=e,this.#t=n,this.#o=s,this.#i=a}#e;#t;#n;#o;#s;#i;#l;#a;#d;dispose(){this.#s||(this.#s=!0,this.#r.fire(),this.#o.dispose(),super.dispose())}#c;#r;get title(){return this.assertNotDisposed(),this.#l}set title(e){this.assertNotDisposed(),this.#l!==e&&(this.#l=e,this.#t.$setWebviewViewTitle(this.#e,e))}get description(){return this.assertNotDisposed(),this.#a}set description(e){this.assertNotDisposed(),this.#a!==e&&(this.#a=e,this.#t.$setWebviewViewDescription(this.#e,e))}get visible(){return this.#i}get webview(){return this.#o}get viewType(){return this.#n}_setVisible(e){e===this.#i||this.#s||(this.#i=e,this.#c.fire())}get badge(){return this.assertNotDisposed(),this.#d}set badge(e){this.assertNotDisposed(),!(e?.value===this.#d?.value&&e?.tooltip===this.#d?.tooltip)&&(this.#d=ab.from(e),this.#t.$setWebviewViewBadge(this.#e,e))}show(e){this.assertNotDisposed(),this.#t.$show(this.#e,!!e)}assertNotDisposed(){if(this.#s)throw new Error("Webview is disposed")}},jk=class{constructor(t,e){this._extHostWebview=e;this._viewProviders=new Map;this._webviewViews=new Map;this._proxy=t.getProxy(F.MainThreadWebviewViews)}registerWebviewViewProvider(t,e,n,o){if(this._viewProviders.has(e))throw new Error(`View provider for '${e}' already registered`);return this._viewProviders.set(e,{provider:n,extension:t}),this._proxy.$registerWebviewViewProvider(Ru(t),e,{retainContextWhenHidden:o?.retainContextWhenHidden,serializeBuffersForPostMessage:qa(t)}),new be(()=>{this._viewProviders.delete(e),this._proxy.$unregisterWebviewViewProvider(e)})}async $resolveWebviewView(t,e,n,o,i){let s=this._viewProviders.get(e);if(!s)throw new Error(`No view provider found for '${e}'`);let{provider:a,extension:l}=s,d=this._extHostWebview.createNewWebview(t,{},l),c=new GO(t,this._proxy,e,n,d,!0);this._webviewViews.set(t,c),await a.resolveWebviewView(c,{state:o},i)}async $onDidChangeWebviewViewVisibility(t,e){this.getWebviewView(t)._setVisible(e)}async $disposeWebviewView(t){let e=this.getWebviewView(t);this._webviewViews.delete(t),e.dispose(),this._extHostWebview.deleteWebview(t)}getWebviewView(t){let e=this._webviewViews.get(t);if(!e)throw new Error("No webview found");return e}};var Bf=class extends O{constructor(e,n){super();this._commands=n;this._handlePool=0;this._providers=new Map;this._itemPool=0;this._globalItems=new Map;this._providerItems=new Map;this._proxy=e.getProxy(F.MainThreadChatContext)}async $provideWorkspaceChatContext(e,n){this._clearProviderItems(e);let o=this._providers.get(e);if(!o||o.type!=="workspace")throw new Error("Workspace context provider not found");let i=o.provider,s=await i.provideWorkspaceChatContext?.(n)??await i.provideChatContext?.(n)??[];return this._convertItems(e,s)}async $provideExplicitChatContext(e,n){this._clearProviderItems(e);let o=this._providers.get(e);if(!o||o.type!=="explicit")throw new Error("Explicit context provider not found");let i=o.provider,s=await i.provideExplicitChatContext?.(n)??await i.provideChatContext?.(n)??[];return this._convertItems(e,s)}async $resolveExplicitChatContext(e,n,o){let i=this._providers.get(e);if(!i||i.type!=="explicit")throw new Error("Explicit context provider not found");let s=i.provider,a=this._globalItems.get(n.handle);if(!a)throw new Error("Chat context item not found");return this._doResolve((s.resolveExplicitChatContext??s.resolveChatContext)?.bind(s),n,a,o)}async $provideResourceChatContext(e,n,o){let i=this._providers.get(e);if(!i||i.type!=="resource")throw new Error("Resource context provider not found");let s=i.provider,a=await s.provideResourceChatContext?.({resource:b.revive(n.resource)},o)??await s.provideChatContext?.({resource:b.revive(n.resource)},o);if(!a)return;if(a.label===void 0&&a.resourceUri===void 0)throw new Error("ChatContextItem must have either a label or a resourceUri");let d={handle:this._addTrackedItem(e,a),icon:a.icon,label:a.label,resourceUri:a.resourceUri,modelDescription:a.modelDescription,tooltip:a.tooltip?ue.from(a.tooltip):void 0,value:n.withValue?a.value:void 0,command:a.command?{id:a.command.command}:void 0};if(n.withValue&&!d.value){let c=await(s.resolveResourceChatContext??s.resolveChatContext)?.bind(s)(a,o);d.value=c?.value,d.tooltip=c?.tooltip?ue.from(c.tooltip):d.tooltip}return d}async $resolveResourceChatContext(e,n,o){let i=this._providers.get(e);if(!i||i.type!=="resource")throw new Error("Resource context provider not found");let s=i.provider,a=this._globalItems.get(n.handle);if(!a)throw new Error("Chat context item not found");return this._doResolve((s.resolveResourceChatContext??s.resolveChatContext)?.bind(s),n,a,o)}async $executeChatContextItemCommand(e){let n=this._globalItems.get(e);if(!n)throw new Error("Chat context item not found");if(!n.command)throw new Error("Chat context item has no command");let o=n.command.arguments?[n,...n.command.arguments]:[n];await this._commands.executeCommand(n.command.command,...o)}registerChatWorkspaceContextProvider(e,n){let o=this._handlePool++,i=new $;return this._providers.set(o,{type:"workspace",provider:n,disposables:i}),this._listenForWorkspaceContextChanges(o,n,i),this._proxy.$registerChatWorkspaceContextProvider(o,e),{dispose:()=>{this._providers.delete(o),this._clearProviderItems(o),this._providerItems.delete(o),this._proxy.$unregisterChatContextProvider(o),i.dispose()}}}registerChatExplicitContextProvider(e,n){let o=this._handlePool++,i=new $;return this._providers.set(o,{type:"explicit",provider:n,disposables:i}),this._proxy.$registerChatExplicitContextProvider(o,e),{dispose:()=>{this._providers.delete(o),this._clearProviderItems(o),this._providerItems.delete(o),this._proxy.$unregisterChatContextProvider(o),i.dispose()}}}registerChatResourceContextProvider(e,n,o){let i=this._handlePool++,s=new $;return this._providers.set(i,{type:"resource",provider:o,disposables:s}),this._proxy.$registerChatResourceContextProvider(i,n,Fi.from(e)),{dispose:()=>{this._providers.delete(i),this._clearProviderItems(i),this._providerItems.delete(i),this._proxy.$unregisterChatContextProvider(i),s.dispose()}}}registerChatContextProvider(e,n,o){let i=[];if(o.provideWorkspaceChatContext){let s={onDidChangeWorkspaceChatContext:o.onDidChangeWorkspaceChatContext,provideWorkspaceChatContext:a=>o.provideWorkspaceChatContext(a)};i.push(this.registerChatWorkspaceContextProvider(n,s))}if(o.provideChatContextExplicit){let s={provideExplicitChatContext:a=>o.provideChatContextExplicit(a),resolveExplicitChatContext:o.resolveChatContext?(a,l)=>o.resolveChatContext(a,l):a=>a};i.push(this.registerChatExplicitContextProvider(n,s))}if(o.provideChatContextForResource&&e){let s={provideResourceChatContext:(a,l)=>o.provideChatContextForResource(a,l),resolveResourceChatContext:o.resolveChatContext?(a,l)=>o.resolveChatContext(a,l):a=>a};i.push(this.registerChatResourceContextProvider(e,n,s))}return{dispose:()=>{for(let s of i)s.dispose()}}}_clearProviderItems(e){let n=this._providerItems.get(e);if(n){for(let o of n)this._globalItems.delete(o);n.clear()}}_addTrackedItem(e,n){let o=this._itemPool++;return this._globalItems.set(o,n),this._providerItems.has(e)||this._providerItems.set(e,new Set),this._providerItems.get(e).add(o),o}_convertItems(e,n){let o=[];for(let i of n){if(i.label===void 0&&i.resourceUri===void 0)throw new Error("ChatContextItem must have either a label or a resourceUri");let s=this._addTrackedItem(e,i);o.push({handle:s,icon:i.icon,label:i.label,resourceUri:i.resourceUri,modelDescription:i.modelDescription,tooltip:i.tooltip?ue.from(i.tooltip):void 0,value:i.value,command:i.command?{id:i.command.command}:void 0})}return o}async _doResolve(e,n,o,i){let s=await e(o,i);return s?{handle:n.handle,icon:s.icon,label:s.label,resourceUri:s.resourceUri,modelDescription:s.modelDescription,tooltip:s.tooltip?ue.from(s.tooltip):void 0,value:s.value,command:s.command?{id:s.command.command}:void 0}:n}_listenForWorkspaceContextChanges(e,n,o){if(!n.onDidChangeWorkspaceChatContext)return;let i=async()=>{let s=await n.provideWorkspaceChatContext?.(ve.None)??await n.provideChatContext?.(ve.None),a=this._convertItems(e,s??[]);return this._proxy.$updateWorkspaceContextItems(e,a)};o.add(n.onDidChangeWorkspaceChatContext(async()=>i())),i()}dispose(){super.dispose();for(let{disposables:e}of this._providers.values())e.dispose()}};Bf=_([C(0,se),C(1,Nn)],Bf);var $f=class extends O{constructor(e){super();this._nextHandle=0;this._activeProgress=new Map;this._onDidAddCoreEvent=this._register(new E({onWillAddFirstListener:()=>this._proxy.$subscribeToCoreDebugEvents(),onDidRemoveLastListener:()=>this._proxy.$unsubscribeFromCoreDebugEvents()}));this.onDidAddCoreEvent=this._onDidAddCoreEvent.event;this._proxy=e.getProxy(F.MainThreadChatDebug)}_progressKey(e,n){return`${e}:${b.revive(n).toString()}`}_cleanupProgress(e){let n=this._activeProgress.get(e);n&&(n.dispose(),this._activeProgress.delete(e))}registerChatDebugLogProvider(e){if(this._provider)throw new Error("A ChatDebugLogProvider is already registered.");this._provider=e;let n=this._nextHandle++;return this._proxy.$registerChatDebugLogProvider(n),K(()=>{this._provider=void 0;for(let[o,i]of this._activeProgress)o.startsWith(`${n}:`)&&(i.dispose(),this._activeProgress.delete(o));this._proxy.$unregisterChatDebugLogProvider(n)})}async $provideChatDebugLog(e,n,o){if(!this._provider)return;let i=this._progressKey(e,n);this._cleanupProgress(i);let s=new $;this._activeProgress.set(i,s);let a=s.add(new E);s.add(a.event(l=>{let d=this._serializeEvent(l);d.sessionResource||(d.sessionResource=n),this._proxy.$acceptChatDebugEvent(e,d)})),s.add(o.onCancellationRequested(()=>{this._cleanupProgress(i)}));try{let l={report:u=>a.fire(u)},d=b.revive(n),c=await this._provider.provideChatDebugLog(d,l,o);return c?c.map(u=>this._serializeEvent(u)):void 0}catch(l){throw this._cleanupProgress(i),l}}_serializeEvent(e){let n={id:e.id,sessionResource:e.sessionResource,created:e.created.getTime(),parentEventId:e.parentEventId};switch(e._kind){case"toolCall":{let i=e;return{...n,kind:"toolCall",toolName:i.toolName,toolCallId:i.toolCallId,input:i.input,output:i.output,result:i.result===0?"success":i.result===1?"error":void 0,durationInMillis:i.durationInMillis}}case"modelTurn":{let i=e;return{...n,kind:"modelTurn",model:i.model,requestName:i.requestName,inputTokens:i.inputTokens,outputTokens:i.outputTokens,totalTokens:i.totalTokens,durationInMillis:i.durationInMillis}}case"generic":{let i=e;return{...n,kind:"generic",name:i.name,details:i.details,level:i.level,category:i.category}}case"subagentInvocation":{let i=e;return{...n,kind:"subagentInvocation",agentName:i.agentName,description:i.description,status:i.status===0?"running":i.status===1?"completed":i.status===2?"failed":void 0,durationInMillis:i.durationInMillis,toolCallCount:i.toolCallCount,modelTurnCount:i.modelTurnCount}}case"userMessage":{let i=e;return{...n,kind:"userMessage",message:i.message,sections:i.sections.map(s=>({name:s.name,content:s.content}))}}case"agentResponse":{let i=e;return{...n,kind:"agentResponse",message:i.message,sections:i.sections.map(s=>({name:s.name,content:s.content}))}}default:{let i=e,s=i.name,a=i.details;return{...n,kind:"generic",name:typeof s=="string"?s:"",details:typeof a=="string"?a:void 0,level:i.level??1,category:i.category}}}}async $resolveChatDebugLogEvent(e,n,o){if(!this._provider?.resolveChatDebugLogEvent)return;let i=await this._provider.resolveChatDebugLogEvent(n,o);if(!i)return;switch(i._kind){case"text":return{kind:"text",value:i.value};case"messageContent":{let a=i;return{kind:"message",type:a.type===0?"user":"agent",message:a.message,sections:a.sections.map(l=>({name:l.name,content:l.content}))}}case"userMessage":{let a=i;return{kind:"message",type:"user",message:a.message,sections:a.sections.map(l=>({name:l.name,content:l.content}))}}case"agentResponse":{let a=i;return{kind:"message",type:"agent",message:a.message,sections:a.sections.map(l=>({name:l.name,content:l.content}))}}case"toolCallContent":{let a=i;return{kind:"toolCall",toolName:a.toolName,result:a.result===0?"success":a.result===1?"error":void 0,durationInMillis:a.durationInMillis,input:a.input,output:a.output}}case"modelTurnContent":{let a=i;return{kind:"modelTurn",requestName:a.requestName,model:a.model,status:a.status,durationInMillis:a.durationInMillis,timeToFirstTokenInMillis:a.timeToFirstTokenInMillis,maxInputTokens:a.maxInputTokens,maxOutputTokens:a.maxOutputTokens,inputTokens:a.inputTokens,outputTokens:a.outputTokens,cachedTokens:a.cachedTokens,totalTokens:a.totalTokens,errorMessage:a.errorMessage,sections:a.sections?.map(l=>({name:l.name,content:l.content}))}}case"hookContent":{let a=i;return{kind:"hook",hookType:a.hookType,command:a.command,result:a.result===0?"success":a.result===1?"error":a.result===2?"nonBlockingError":void 0,durationInMillis:a.durationInMillis,input:a.input,output:a.output,exitCode:a.exitCode,errorMessage:a.errorMessage}}default:return}}_deserializeEvent(e){let n=new Date(e.created),o=e.sessionResource?b.revive(e.sessionResource):void 0;switch(e.kind){case"toolCall":{let i=new km(e.toolName,n);return i.id=e.id,i.sessionResource=o,i.parentEventId=e.parentEventId,i.toolCallId=e.toolCallId,i.input=e.input,i.output=e.output,i.result=e.result==="success"?0:e.result==="error"?1:void 0,i.durationInMillis=e.durationInMillis,i}case"modelTurn":{let i=new Pm(n);return i.id=e.id,i.sessionResource=o,i.parentEventId=e.parentEventId,i.model=e.model,i.inputTokens=e.inputTokens,i.outputTokens=e.outputTokens,i.totalTokens=e.totalTokens,i.durationInMillis=e.durationInMillis,i}case"generic":{let i=new _m(e.name,e.level,n);return i.id=e.id,i.sessionResource=o,i.parentEventId=e.parentEventId,i.details=e.details,i.category=e.category,i}case"subagentInvocation":{let i=new Dm(e.agentName,n);return i.id=e.id,i.sessionResource=o,i.parentEventId=e.parentEventId,i.description=e.description,i.status=e.status==="running"?0:e.status==="completed"?1:e.status==="failed"?2:void 0,i.durationInMillis=e.durationInMillis,i.toolCallCount=e.toolCallCount,i.modelTurnCount=e.modelTurnCount,i}case"userMessage":{let i=new Rm(e.message,n);return i.id=e.id,i.sessionResource=o,i.parentEventId=e.parentEventId,i.sections=e.sections.map(s=>new Yc(s.name,s.content)),i}case"agentResponse":{let i=new Am(e.message,n);return i.id=e.id,i.sessionResource=o,i.parentEventId=e.parentEventId,i.sections=e.sections.map(s=>new Yc(s.name,s.content)),i}default:return}}$onCoreDebugEvent(e){let n=this._deserializeEvent(e);n&&this._onDidAddCoreEvent.fire(n)}async $exportChatDebugLog(e,n,o,i,s){if(!this._provider?.provideChatDebugLogExport)return;let a=b.revive(n),d={coreEvents:o.map(u=>this._deserializeEvent(u)).filter(u=>u!==void 0),sessionTitle:i},c=await this._provider.provideChatDebugLogExport(a,d,s);if(c)return H.wrap(c)}async $importChatDebugLog(e,n,o){if(!this._provider?.resolveChatDebugLogImport)return;let i=await this._provider.resolveChatDebugLogImport(n.buffer,o);if(i)return{uri:i.uri,sessionTitle:i.sessionTitle}}dispose(){for(let e of this._activeProgress.values())e.dispose();this._activeProgress.clear(),super.dispose()}};$f=_([C(0,se)],$f);function M5(r){let t=r.get(Ye),e=r.get(Gr),n=r.get(Hs),o=r.get(go),i=r.get(On),s=r.get(Id),a=r.get(Sn),l=r.get(ds),d=r.get(se),c=r.get(cg),u=r.get(pg),m=r.get(Xo),g=r.get(oe),h=r.get(bd),f=r.get(Wi),I=r.get(bu),S=r.get(mE),T=r.get(yu),P=r.get(Dg),L=r.get(Bi),q=r.get(Lg),N=r.get(Iu),B=r.get(Cg),G=r.get(Tg),J=r.get(ku),Y=r.get(yE),re=r.get(xE),Pe=r.get(CE);d.set(pe.ExtHostFileSystemInfo,e),d.set(pe.ExtHostLogLevelServiceShape,m),d.set(pe.ExtHostWorkspace,i),d.set(pe.ExtHostConfiguration,a),d.set(pe.ExtHostExtensionService,o),d.set(pe.ExtHostStorage,c),d.set(pe.ExtHostTunnelService,h),d.set(pe.ExtHostWindow,I),d.set(pe.ExtHostPower,S),d.set(pe.ExtHostUrls,T),d.set(pe.ExtHostSecretState,P),d.set(pe.ExtHostTelemetry,s),d.set(pe.ExtHostEditorTabs,L),d.set(pe.ExtHostManagedSockets,q),d.set(pe.ExtHostProgress,N),d.set(pe.ExtHostAuthentication,B),d.set(pe.ExtHostChatProvider,G),d.set(pe.ExtHostDataChannels,Y),d.set(pe.ExtHostMeteredConnection,re),d.set(pe.ExtHostGitExtension,Pe);let ot=d.set(pe.ExtHostDecorations,r.get(ZT)),rt=d.set(pe.ExtHostDocumentsAndEditors,r.get(Hr)),ne=d.set(pe.ExtHostCommands,r.get(Nn)),ee=d.set(pe.ExtHostTerminalService,r.get(wo)),te=d.set(pe.ExtHostTerminalShellIntegration,r.get(Zg)),X=d.set(pe.ExtHostDebugService,r.get(jg)),de=d.set(pe.ExtHostSearch,r.get(Jg)),ge=d.set(pe.ExtHostTask,r.get(Bg)),Le=d.set(pe.ExtHostOutputService,r.get(XT)),gt=d.set(pe.ExtHostLocalization,r.get(Ag)),Ue=d.set(pe.ExtHostDocuments,new iw(d,rt)),wt=d.set(pe.ExtHostDocumentContentProviders,new ow(d,rt,g)),Ht=d.set(pe.ExtHostDocumentSaveParticipant,new rw(g,Ue,d.getProxy(F.MainThreadBulkEdits))),je=d.set(pe.ExtHostNotebook,new Dk(d,ne,rt,Ue,n,de,g)),_n=d.set(pe.ExtHostNotebookDocuments,new Ak(je)),_o=d.set(pe.ExtHostNotebookEditors,new Ff(g,je)),Qi=d.set(pe.ExtHostNotebookKernels,new Hf(d,t,je,ne,g)),Qa=d.set(pe.ExtHostNotebookRenderers,new Lk(d,je)),di=d.set(pe.ExtHostNotebookDocumentSaveParticipant,new Rk(g,je,d.getProxy(F.MainThreadBulkEdits))),ye=d.set(pe.ExtHostEditors,new Vk(d,rt)),kt=d.set(pe.ExtHostTreeViews,new zk(d.getProxy(F.MainThreadTreeViews),ne,g)),nh=d.set(pe.ExtHostEditorInsets,new QE(d.getProxy(F.MainThreadEditorInsets),ye,t.remote)),wr=d.set(pe.ExtHostDiagnostics,new ai(d,g,e,rt)),Ko=d.set(pe.ExtHostLanguages,new vk(d,Ue,ne.converter,l)),et=d.set(pe.ExtHostLanguageFeatures,new Lw(d,l,Ue,ne,wr,g,f,s)),Fd=d.set(pe.ExtHostCodeMapper,new JE(d)),zu=d.set(pe.ExtHostFileSystem,new dw(d,et)),ci=d.set(pe.ExtHostFileSystemEventService,new gw(d,g,rt)),Ji=d.set(pe.ExtHostQuickOpen,k5(d,i,ne)),Hd=d.set(pe.ExtHostSCM,new Wf(d,ne,Ue,g)),Wd=d.set(pe.ExtHostQuickDiff,new Nk(d,l)),jo=d.set(pe.ExtHostShare,new Uk(d,l)),Ja=d.set(pe.ExtHostComments,_B(d,ne,Ue)),pn=d.set(pe.ExtHostLabelService,new hw(d)),Xn=d.set(pe.ExtHostTheming,new Vf(d)),Uy=d.set(pe.ExtHostTimeline,new Bk(d,ne)),Vd=d.set(pe.ExtHostWebviews,new XE(d,t.remote,i,g,f)),Qs=d.set(pe.ExtHostWebviewPanels,new Kk(d,Vd,i)),qu=d.set(pe.ExtHostCustomEditors,new ew(d,Ue,u,Vd,Qs)),M=d.set(pe.ExtHostWebviewViews,new jk(d,Vd)),z=d.set(pe.ExtHostTesting,r.get(za)),Q=d.set(pe.ExtHostUriOpeners,new qk(d)),_e=d.set(pe.ExtHostProfileContentHandlers,new Ok(d)),$e=d.set(pe.ExtHostChatOutputRenderer,new qE(d,Vd));d.set(pe.ExtHostInteractive,new fw(d,je,rt,ne,g));let mn=d.set(pe.ExtHostLanguageModelTools,new hk(d,G)),Ct=d.set(pe.ExtHostChatSessions,new hf(ne,G,d,g)),Dt=d.set(pe.ExtHostChatAgents2,new $E(d,g,ne,Ue,rt,G,wr,mn)),nn=d.set(pe.ExtHostChatContext,new Bf(d,ne)),Bn=d.set(pe.ExtHostChatDebug,new $f(d)),ir=d.set(pe.ExtHostAiRelatedInformation,new HE(d)),bn=d.set(pe.ExtHostAiEmbeddingVector,new aw(d)),$n=d.set(pe.ExtHostAiSettingsSearch,new WE(d)),io=d.set(pe.ExtHostStatusBar,new Wk(d,ne.converter)),sr=d.set(pe.ExtHostSpeech,new Fk(d)),Ve=d.set(pe.ExtHostEmbeddings,new sw(d)),Je=d.set(pe.ExtHostBrowsers,new Hk(d));d.set(pe.ExtHostMcp,r.get(ku));let zt=Object.values(pe);d.assertRegistered(zt);let on=new gf(d,rt),zn=new GE(d),Bd=new Of(d,g),Js=new nw(d),ie=new jE(d);return BE.register(ne),function(k,Ya,EP){function ae(y){return(x,D,Se)=>{let It=y(yn=>{try{x.call(D,yn)}catch($$){qd(new Sp(k.identifier,$$,"FAILED to handle event"))}});return Se?.push(It),It}}let Lt=(function(){let y=!k.isUnderDevelopment;function x(){y||(g.info(`Extension '${k.identifier.value}' uses a document selector without scheme. Learn more about this: https://go.microsoft.com/fwlink/?linkid=872305`),y=!0)}return function D(Se){if(Array.isArray(Se))Se.forEach(D);else if(typeof Se=="string")x();else{let It=Se;typeof It.scheme>"u"&&x(),typeof It.exclusive=="boolean"&&A(k,"documentFiltersExclusive")}return Se}})(),w$={getSession(y,x,D){return(typeof D?.forceNewSession=="object"&&D.forceNewSession.learnMore||typeof D?.createIfNone=="object"&&D.createIfNone.learnMore)&&A(k,"authLearnMore"),D?.authorizationServer&&A(k,"authIssuers"),B.getSession(k,y,x,D)},getAccounts(y){return B.getAccounts(y)},async hasSession(y,x){return A(k,"authSession"),!!await B.getSession(k,y,x,{silent:!0})},get onDidChangeSessions(){return ae(B.getExtensionScopedSessionsEvent(k.identifier.value))},registerAuthenticationProvider(y,x,D,Se){return Se?.supportedAuthorizationServers&&A(k,"authIssuers"),B.registerAuthenticationProvider(y,x,D,Se)}},k$={registerCommand(y,x,D){return ne.registerCommand(!0,y,x,D,void 0,k)},registerTextEditorCommand(y,x,D){return ne.registerCommand(!0,y,(...Se)=>{let It=ye.getActiveTextEditor();if(!It){g.warn("Cannot execute "+y+" because there is no active text editor.");return}return It.edit(yn=>{x.apply(D,[It,yn,...Se])}).then(yn=>{yn||g.warn("Edits from command "+y+" were not applied.")},yn=>{g.warn("An error occurred while running command "+y,yn)})},void 0,void 0,k)},registerDiffInformationCommand:(y,x,D)=>(A(k,"diffCommand"),ne.registerCommand(!0,y,async(...Se)=>{let It=rt.activeEditor(!0);if(!It){g.warn("Cannot execute "+y+" because there is no active text editor.");return}let yn=await ye.getDiffInformation(It.id);x.apply(D,[yn,...Se])},void 0,void 0,k)),executeCommand(y,...x){return ne.executeCommand(y,...x)},getCommands(y=!1){return ne.getCommands(y)}},EN={get machineId(){return t.telemetryInfo.machineId},get devDeviceId(){return A(k,"devDeviceId"),t.telemetryInfo.devDeviceId??t.telemetryInfo.machineId},get isAppPortable(){return t.environment.isPortable??!1},get sessionId(){return t.telemetryInfo.sessionId},get language(){return t.environment.appLanguage},get appName(){return t.environment.appName},get appRoot(){return t.environment.appRoot?.fsPath??""},get appHost(){return t.environment.appHost},get uriScheme(){return t.environment.appUriScheme},get clipboard(){return zn.value},get shell(){return ee.getDefaultShell(!1)},get onDidChangeShell(){return ae(ee.onDidChangeShell)},get isTelemetryEnabled(){return s.getTelemetryConfiguration()},get onDidChangeTelemetryEnabled(){return ae(s.onDidChangeTelemetryEnabled)},get telemetryConfiguration(){return A(k,"telemetry"),s.getTelemetryDetails()},get onDidChangeTelemetryConfiguration(){return A(k,"telemetry"),ae(s.onDidChangeTelemetryConfiguration)},get isMeteredConnection(){return A(k,"envIsConnectionMetered"),re.isConnectionMetered},get onDidChangeMeteredConnection(){return A(k,"envIsConnectionMetered"),ae(re.onDidChangeIsConnectionMetered)},get isNewAppInstall(){return GM(t.telemetryInfo.firstSessionDate)},createTelemetryLogger(y,x){return Tb.validateSender(y),s.instantiateLogger(k,y,x)},async openExternal(y,x){return I.openUri(y,{allowTunneling:t.remote.isRemote??(t.remote.authority?await h.hasTunnelProvider():!1),allowContributedOpeners:x?.allowContributedOpeners})},async asExternalUri(y){if(y.scheme===t.environment.appUriScheme)return T.createAppUri(y);try{return await I.asExternalUri(y,{allowTunneling:!!t.remote.authority})}catch(x){if(II(y,V.http)||II(y,V.https))return y;throw x}},get remoteName(){return zh(t.remote.authority)},get remoteAuthority(){return A(k,"resolvers"),t.remote.authority},get uiKind(){return t.uiKind},get logLevel(){return g.getLevel()},get onDidChangeLogLevel(){return ae(g.onDidChangeLogLevel)},get appQuality(){return A(k,"resolvers"),t.quality},get appCommit(){return A(k,"resolvers"),t.commit},getDataChannel(y){return A(k,"dataChannels"),Y.createDataChannel(k,y)},get power(){return A(k,"environmentPower"),{get onDidSuspend(){return ae(S.onDidSuspend)},get onDidResume(){return ae(S.onDidResume)},get onDidChangeOnBatteryPower(){return ae(S.onDidChangeOnBatteryPower)},get onDidChangeThermalState(){return ae(S.onDidChangeThermalState)},get onDidChangeSpeedLimit(){return ae(S.onDidChangeSpeedLimit)},get onWillShutdown(){return ae(S.onWillShutdown)},get onDidLockScreen(){return ae(S.onDidLockScreen)},get onDidUnlockScreen(){return ae(S.onDidUnlockScreen)},getSystemIdleState(y){return S.getSystemIdleState(y)},getSystemIdleTime(){return S.getSystemIdleTime()},getCurrentThermalState(){return S.getCurrentThermalState()},isOnBatteryPower(){return S.isOnBatteryPower()},async startPowerSaveBlocker(y){let x=await S.startPowerSaveBlocker(y);return{id:x.id,get isStarted(){return x.isStarted},dispose(){x.dispose()}}}}}};t.environment.extensionTestsLocationURI||Object.freeze(EN);let P$={createTestController(y,x,D){return z.createTestController(k,y,x,D)},createTestObserver(){return A(k,"testObserver"),z.createTestObserver()},runTests(y){return A(k,"testObserver"),z.runTests(y)},registerTestFollowupProvider(y){return A(k,"testObserver"),z.registerTestFollowupProvider(y)},get onDidChangeTestResults(){return A(k,"testObserver"),ae(z.onResultsChanged)},get testResults(){return A(k,"testObserver"),z.results}},Fy=t.remote.isRemote?2:1,_$={getExtension(y,x){He(k,"extensionsAny")||(x=!1);let D=Ya.mine.getExtensionDescription(y);if(D)return new Ed(o,k.identifier,D,Fy,!1);if(x){let Se=Ya.all.getExtensionDescription(y);if(Se)return new Ed(o,k.identifier,Se,Fy,!0)}},get all(){let y=[];for(let x of Ya.mine.getAllExtensionDescriptions())y.push(new Ed(o,k.identifier,x,Fy,!1));return y},get allAcrossExtensionHosts(){A(k,"extensionsAny");let y=new No(Ya.mine.getAllExtensionDescriptions().map(D=>D.identifier)),x=[];for(let D of Ya.all.getAllExtensionDescriptions()){let Se=!y.has(D.identifier);x.push(new Ed(o,k.identifier,D,Fy,Se))}return x},get onDidChange(){return He(k,"extensionsAny")?ae(he.any(Ya.mine.onDidChange,Ya.all.onDidChange)):ae(Ya.mine.onDidChange)}},D$={createDiagnosticCollection(y){return wr.createDiagnosticCollection(k.identifier,y)},get onDidChangeDiagnostics(){return ae(wr.onDidChangeDiagnostics)},getDiagnostics:y=>wr.getDiagnostics(y),getLanguages(){return Ko.getLanguages()},setTextDocumentLanguage(y,x){return Ko.changeLanguage(y.uri,x)},match(y,x){let D=aM.from(y),Se;return CL(D)&&(Se=je.notebookDocuments.find(It=>It.apiNotebook.getCells().find(yn=>yn.document===x))?.apiNotebook),SL(D,x.uri,x.languageId,!0,Se?.uri,Se?.notebookType)},registerCodeActionsProvider(y,x,D){return et.registerCodeActionProvider(k,Lt(y),x,D)},registerDocumentPasteEditProvider(y,x,D){return et.registerDocumentPasteEditProvider(k,Lt(y),x,D)},registerCodeLensProvider(y,x){return et.registerCodeLensProvider(k,Lt(y),x)},registerDefinitionProvider(y,x){return et.registerDefinitionProvider(k,Lt(y),x)},registerDeclarationProvider(y,x){return et.registerDeclarationProvider(k,Lt(y),x)},registerImplementationProvider(y,x){return et.registerImplementationProvider(k,Lt(y),x)},registerTypeDefinitionProvider(y,x){return et.registerTypeDefinitionProvider(k,Lt(y),x)},registerHoverProvider(y,x){return et.registerHoverProvider(k,Lt(y),x,k.identifier)},registerEvaluatableExpressionProvider(y,x){return et.registerEvaluatableExpressionProvider(k,Lt(y),x,k.identifier)},registerInlineValuesProvider(y,x){return et.registerInlineValuesProvider(k,Lt(y),x,k.identifier)},registerDocumentHighlightProvider(y,x){return et.registerDocumentHighlightProvider(k,Lt(y),x)},registerMultiDocumentHighlightProvider(y,x){return et.registerMultiDocumentHighlightProvider(k,Lt(y),x)},registerLinkedEditingRangeProvider(y,x){return et.registerLinkedEditingRangeProvider(k,Lt(y),x)},registerReferenceProvider(y,x){return et.registerReferenceProvider(k,Lt(y),x)},registerRenameProvider(y,x){return et.registerRenameProvider(k,Lt(y),x)},registerNewSymbolNamesProvider(y,x){return A(k,"newSymbolNamesProvider"),et.registerNewSymbolNamesProvider(k,Lt(y),x)},registerDocumentSymbolProvider(y,x,D){return et.registerDocumentSymbolProvider(k,Lt(y),x,D)},registerWorkspaceSymbolProvider(y){return et.registerWorkspaceSymbolProvider(k,y)},registerDocumentFormattingEditProvider(y,x){return et.registerDocumentFormattingEditProvider(k,Lt(y),x)},registerDocumentRangeFormattingEditProvider(y,x){return et.registerDocumentRangeFormattingEditProvider(k,Lt(y),x)},registerOnTypeFormattingEditProvider(y,x,D,...Se){return et.registerOnTypeFormattingEditProvider(k,Lt(y),x,[D].concat(Se))},registerDocumentSemanticTokensProvider(y,x,D){return et.registerDocumentSemanticTokensProvider(k,Lt(y),x,D)},registerDocumentRangeSemanticTokensProvider(y,x,D){return et.registerDocumentRangeSemanticTokensProvider(k,Lt(y),x,D)},registerSignatureHelpProvider(y,x,D,...Se){return typeof D=="object"?et.registerSignatureHelpProvider(k,Lt(y),x,D):et.registerSignatureHelpProvider(k,Lt(y),x,typeof D>"u"?[]:[D,...Se])},registerCompletionItemProvider(y,x,...D){return et.registerCompletionItemProvider(k,Lt(y),x,D)},registerInlineCompletionItemProvider(y,x,D){return x.handleDidShowCompletionItem&&A(k,"inlineCompletionsAdditions"),x.handleDidPartiallyAcceptCompletionItem&&A(k,"inlineCompletionsAdditions"),D&&A(k,"inlineCompletionsAdditions"),et.registerInlineCompletionsProvider(k,Lt(y),x,D)},get inlineCompletionsUnificationState(){return A(k,"inlineCompletionsAdditions"),et.inlineCompletionsUnificationState},onDidChangeCompletionsUnificationState(y,x,D){return A(k,"inlineCompletionsAdditions"),ae(et.onDidChangeInlineCompletionsUnificationState)(y,x,D)},registerDocumentLinkProvider(y,x){return et.registerDocumentLinkProvider(k,Lt(y),x)},registerColorProvider(y,x){return et.registerColorProvider(k,Lt(y),x)},registerFoldingRangeProvider(y,x){return et.registerFoldingRangeProvider(k,Lt(y),x)},registerSelectionRangeProvider(y,x){return et.registerSelectionRangeProvider(k,y,x)},registerCallHierarchyProvider(y,x){return et.registerCallHierarchyProvider(k,y,x)},registerTypeHierarchyProvider(y,x){return et.registerTypeHierarchyProvider(k,y,x)},setLanguageConfiguration:(y,x)=>et.setLanguageConfiguration(k,y,x),getTokenInformationAtPosition(y,x){return A(k,"tokenInformation"),Ko.tokenAtPosition(y,x)},registerInlayHintsProvider(y,x){return et.registerInlayHintsProvider(k,y,x)},createLanguageStatusItem(y,x){return Ko.createLanguageStatusItem(k,y,x)},registerDocumentDropEditProvider(y,x,D){return et.registerDocumentOnDropEditProvider(k,y,x,D)}},R$={get activeTextEditor(){return ye.getActiveTextEditor()},get visibleTextEditors(){return ye.getVisibleTextEditors()},get activeTerminal(){return ee.activeTerminal},get terminals(){return ee.terminals},async showTextDocument(y,x,D){b.isUri(y)&&y.scheme===V.vscodeRemote&&!y.authority&&f.report("workspace.showTextDocument",k,"A URI of 'vscode-remote' scheme requires an authority.");let Se=await(b.isUri(y)?Promise.resolve(wN.openTextDocument(y)):Promise.resolve(y));return ye.showTextDocument(Se,x,D)},createTextEditorDecorationType(y){return ye.createTextEditorDecorationType(k,y)},onDidChangeActiveTextEditor(y,x,D){return ae(ye.onDidChangeActiveTextEditor)(y,x,D)},onDidChangeVisibleTextEditors(y,x,D){return ae(ye.onDidChangeVisibleTextEditors)(y,x,D)},onDidChangeTextEditorSelection(y,x,D){return ae(ye.onDidChangeTextEditorSelection)(y,x,D)},onDidChangeTextEditorOptions(y,x,D){return ae(ye.onDidChangeTextEditorOptions)(y,x,D)},onDidChangeTextEditorVisibleRanges(y,x,D){return ae(ye.onDidChangeTextEditorVisibleRanges)(y,x,D)},onDidChangeTextEditorViewColumn(y,x,D){return ae(ye.onDidChangeTextEditorViewColumn)(y,x,D)},onDidChangeTextEditorDiffInformation(y,x,D){return A(k,"textEditorDiffInformation"),ae(ye.onDidChangeTextEditorDiffInformation)(y,x,D)},onDidCloseTerminal(y,x,D){return ae(ee.onDidCloseTerminal)(y,x,D)},onDidOpenTerminal(y,x,D){return ae(ee.onDidOpenTerminal)(y,x,D)},onDidChangeActiveTerminal(y,x,D){return ae(ee.onDidChangeActiveTerminal)(y,x,D)},onDidChangeTerminalDimensions(y,x,D){return A(k,"terminalDimensions"),ae(ee.onDidChangeTerminalDimensions)(y,x,D)},onDidChangeTerminalState(y,x,D){return ae(ee.onDidChangeTerminalState)(y,x,D)},onDidWriteTerminalData(y,x,D){return A(k,"terminalDataWriteEvent"),ae(ee.onDidWriteTerminalData)(y,x,D)},onDidExecuteTerminalCommand(y,x,D){return A(k,"terminalExecuteCommandEvent"),ae(ee.onDidExecuteTerminalCommand)(y,x,D)},onDidChangeTerminalShellIntegration(y,x,D){return ae(te.onDidChangeTerminalShellIntegration)(y,x,D)},onDidStartTerminalShellExecution(y,x,D){return ae(te.onDidStartTerminalShellExecution)(y,x,D)},onDidEndTerminalShellExecution(y,x,D){return ae(te.onDidEndTerminalShellExecution)(y,x,D)},get state(){return I.getState()},onDidChangeWindowState(y,x,D){return ae(I.onDidChangeWindowState)(y,x,D)},showInformationMessage(y,...x){return Bd.showMessage(k,Xe.Info,y,x[0],x.slice(1))},showWarningMessage(y,...x){return Bd.showMessage(k,Xe.Warning,y,x[0],x.slice(1))},showErrorMessage(y,...x){return Bd.showMessage(k,Xe.Error,y,x[0],x.slice(1))},showQuickPick(y,x,D){return Ji.showQuickPick(k,y,x,D)},showWorkspaceFolderPick(y){return Ji.showWorkspaceFolderPick(y)},showInputBox(y,x){return Ji.showInput(y,x)},showOpenDialog(y){return Js.showOpenDialog(y)},showSaveDialog(y){return Js.showSaveDialog(y)},createStatusBarItem(y,x,D){let Se,It,yn;return typeof y=="string"?(Se=y,It=x,yn=D):(It=y,yn=x),io.createStatusBarEntry(k,Se,It,yn)},setStatusBarMessage(y,x){return io.setStatusBarMessage(y,x)},withScmProgress(y){return f.report("window.withScmProgress",k,"Use 'withProgress' instead."),N.withProgress(k,{location:1},(x,D)=>y({report(Se){}}))},withProgress(y,x){return N.withProgress(k,y,x)},createOutputChannel(y,x){return Le.createOutputChannel(y,x,k)},createWebviewPanel(y,x,D,Se){return Qs.createWebviewPanel(k,y,x,D,Se)},createWebviewTextEditorInset(y,x,D,Se){return A(k,"editorInsets"),nh.createWebviewEditorInset(y,x,D,Se,k)},createTerminal(y,x,D){if(typeof y=="object"){let Se=y;return!He(k,"terminalTitle")&&"titleTemplate"in y&&y.titleTemplate!==void 0&&(console.error(`[${k.identifier.value}] \`titleTemplate\` was provided to window.createTerminal but is ignored because the \`terminalTitle\` proposed API is not enabled.`),Se={...y,titleTemplate:void 0}),"pty"in Se?ee.createExtensionTerminal(Se):ee.createTerminalFromOptions(Se)}return ee.createTerminal(y,x,D)},registerTerminalLinkProvider(y){return ee.registerLinkProvider(y)},registerTerminalProfileProvider(y,x){return ee.registerProfileProvider(k,y,x)},registerTerminalCompletionProvider(y,...x){return A(k,"terminalCompletionProvider"),ee.registerTerminalCompletionProvider(k,y,...x)},registerTerminalQuickFixProvider(y,x){return A(k,"terminalQuickFixProvider"),ee.registerTerminalQuickFixProvider(y,k.identifier.value,x)},registerTreeDataProvider(y,x){return kt.registerTreeDataProvider(y,x,k)},createTreeView(y,x){return kt.createTreeView(y,x,k)},registerWebviewPanelSerializer:(y,x)=>Qs.registerWebviewPanelSerializer(k,y,x),registerCustomEditorProvider:(y,x,D={})=>qu.registerCustomEditorProvider(k,y,x,D),registerFileDecorationProvider(y){return ot.registerFileDecorationProvider(y,k)},registerUriHandler(y){return T.registerUriHandler(k,y)},createQuickPick(){return Ji.createQuickPick(k)},createInputBox(){return Ji.createInputBox(k)},get activeColorTheme(){return Xn.activeColorTheme},onDidChangeActiveColorTheme(y,x,D){return ae(Xn.onDidChangeActiveColorTheme)(y,x,D)},registerWebviewViewProvider(y,x,D){return M.registerWebviewViewProvider(k,y,x,D?.webviewOptions)},get activeNotebookEditor(){return je.activeNotebookEditor},onDidChangeActiveNotebookEditor(y,x,D){return ae(je.onDidChangeActiveNotebookEditor)(y,x,D)},get visibleNotebookEditors(){return je.visibleNotebookEditors},get onDidChangeVisibleNotebookEditors(){return ae(je.onDidChangeVisibleNotebookEditors)},onDidChangeNotebookEditorSelection(y,x,D){return ae(_o.onDidChangeNotebookEditorSelection)(y,x,D)},onDidChangeNotebookEditorVisibleRanges(y,x,D){return ae(_o.onDidChangeNotebookEditorVisibleRanges)(y,x,D)},showNotebookDocument(y,x){return je.showNotebookDocument(y,x)},registerExternalUriOpener(y,x,D){return A(k,"externalUriOpener"),Q.registerExternalUriOpener(k.identifier,y,x,D)},registerProfileContentHandler(y,x){return A(k,"profileContentHandlers"),_e.registerProfileContentHandler(k,y,x)},registerQuickDiffProvider(y,x,D,Se,It){return A(k,"quickDiffProvider"),Wd.registerQuickDiffProvider(k,Lt(y),x,D,Se,It)},get tabGroups(){return L.tabGroups},registerShareProvider(y,x){return A(k,"shareProvider"),jo.registerShareProvider(Lt(y),x)},get nativeHandle(){return A(k,"nativeWindowHandle"),I.nativeHandle},createChatStatusItem:y=>(A(k,"chatStatusItem"),ie.createChatStatusItem(k,y)),get activeChatPanelSessionResource(){return A(k,"chatParticipantPrivate"),Dt.activeChatPanelSessionResource},onDidChangeActiveChatPanelSessionResource:(y,x,D)=>(A(k,"chatParticipantPrivate"),ae(Dt.onDidChangeActiveChatPanelSessionResource)(y,x,D)),get browserTabs(){return A(k,"browser"),Je.browserTabs},onDidOpenBrowserTab(y,x,D){return A(k,"browser"),ae(Je.onDidOpenBrowserTab)(y,x,D)},onDidCloseBrowserTab(y,x,D){return A(k,"browser"),ae(Je.onDidCloseBrowserTab)(y,x,D)},get activeBrowserTab(){return A(k,"browser"),Je.activeBrowserTab},onDidChangeActiveBrowserTab(y,x,D){return A(k,"browser"),ae(Je.onDidChangeActiveBrowserTab)(y,x,D)},onDidChangeBrowserTabState(y,x,D){return A(k,"browser"),ae(Je.onDidChangeBrowserTabState)(y,x,D)},openBrowserTab(y,x){return A(k,"browser"),Je.openBrowserTab(y,x)}},wN={get rootPath(){return f.report("workspace.rootPath",k,"Please use 'workspace.workspaceFolders' instead. More details: https://aka.ms/vscode-eliminating-rootpath"),i.getPath()},set rootPath(y){throw new ui("rootPath")},getWorkspaceFolder(y){return i.getWorkspaceFolder(y)},get workspaceFolders(){return i.getWorkspaceFolders()},get name(){return i.name},set name(y){throw new ui("name")},get workspaceFile(){return i.workspaceFile},set workspaceFile(y){throw new ui("workspaceFile")},get isAgentSessionsWorkspace(){return A(k,"agentSessionsWorkspace"),!!t.environment.isSessionsWindow},updateWorkspaceFolders:(y,x,...D)=>i.updateWorkspaceFolders(k,y,x||0,...D),onDidChangeWorkspaceFolders:function(y,x,D){return ae(i.onDidChangeWorkspace)(y,x,D)},asRelativePath:(y,x)=>i.getRelativePath(y,x),findFiles:(y,x,D,Se)=>i.findFiles(y,x,D,k.identifier,Se),findFiles2:(y,x,D)=>(A(k,"findFiles2"),i.findFiles2(y,x,k.identifier,D)),findTextInFiles:(y,x,D,Se)=>{A(k,"findTextInFiles");let It,yn;return typeof x=="object"?(It=x,yn=D):(It={},yn=x,Se=D),i.findTextInFiles(y,It||{},yn,k.identifier,Se)},findTextInFiles2:(y,x,D)=>(A(k,"findTextInFiles2"),A(k,"textSearchProvider2"),i.findTextInFiles2(y,x,k.identifier,D)),save:y=>i.save(y),saveAs:y=>i.saveAs(y),saveAll:y=>i.saveAll(y),applyEdit(y,x){return on.applyWorkspaceEdit(y,k,x)},createFileSystemWatcher:(y,x,D,Se)=>{let It={ignoreCreateEvents:!!x,ignoreChangeEvents:!!D,ignoreDeleteEvents:!!Se};return ci.createFileSystemWatcher(i,EP,e,k,y,It)},get textDocuments(){return Ue.getAllDocumentData().map(y=>y.document)},set textDocuments(y){throw new ui("textDocuments")},openTextDocument(y,x){let D;if(x=x??y,typeof y=="string")D=Promise.resolve(b.file(y));else if(b.isUri(y))D=Promise.resolve(y);else if(!x||typeof x=="object")D=Ue.createDocumentData(x);else throw new Error("illegal argument - uriOrFileNameOrOptions");return D.then(Se=>(g.trace(`openTextDocument from ${k.identifier}`),Se.scheme===V.vscodeRemote&&!Se.authority&&f.report("workspace.openTextDocument",k,"A URI of 'vscode-remote' scheme requires an authority."),Ue.ensureDocumentData(Se,x).then(It=>It.document)))},onDidOpenTextDocument:(y,x,D)=>ae(Ue.onDidAddDocument)(y,x,D),onDidCloseTextDocument:(y,x,D)=>ae(Ue.onDidRemoveDocument)(y,x,D),onDidChangeTextDocument:(y,x,D)=>He(k,"textDocumentChangeReason")?ae(Ue.onDidChangeDocumentWithReason)(y,x,D):ae(Ue.onDidChangeDocument)(y,x,D),onDidSaveTextDocument:(y,x,D)=>ae(Ue.onDidSaveDocument)(y,x,D),onWillSaveTextDocument:(y,x,D)=>ae(Ht.getOnWillSaveTextDocumentEvent(k))(y,x,D),get notebookDocuments(){return je.notebookDocuments.map(y=>y.apiNotebook)},async openNotebookDocument(y,x){let D;if(b.isUri(y))D=y,await je.openNotebookDocument(y);else if(typeof y=="string")D=b.revive(await je.createNotebookDocument({viewType:y,content:x}));else throw new Error("Invalid arguments");return je.getNotebookDocument(D).apiNotebook},onDidSaveNotebookDocument(y,x,D){return ae(_n.onDidSaveNotebookDocument)(y,x,D)},onDidChangeNotebookDocument(y,x,D){return ae(_n.onDidChangeNotebookDocument)(y,x,D)},onWillSaveNotebookDocument(y,x,D){return ae(di.getOnWillSaveNotebookDocumentEvent(k))(y,x,D)},get onDidOpenNotebookDocument(){return ae(je.onDidOpenNotebookDocument)},get onDidCloseNotebookDocument(){return ae(je.onDidCloseNotebookDocument)},registerNotebookSerializer(y,x,D,Se){return je.registerNotebookSerializer(k,y,x,D,He(k,"notebookLiveShare")?Se:void 0)},onDidChangeConfiguration:(y,x,D)=>ae(EP.onDidChangeConfiguration)(y,x,D),getConfiguration(y,x){return x=arguments.length===1?void 0:x,EP.getConfiguration(y,x,k)},registerTextDocumentContentProvider(y,x){return wt.registerTextDocumentContentProvider(y,x)},registerTaskProvider:(y,x)=>(f.report("window.registerTaskProvider",k,"Use the corresponding function on the 'tasks' namespace instead"),ge.registerTaskProvider(k,y,x)),registerFileSystemProvider(y,x,D){return np(zu.registerFileSystemProvider(k,y,x,D),n.addFileSystemProvider(y,x,D))},get fs(){return n.value},registerFileSearchProvider:(y,x)=>(A(k,"fileSearchProvider"),de.registerFileSearchProviderOld(y,x)),registerTextSearchProvider:(y,x)=>(A(k,"textSearchProvider"),de.registerTextSearchProviderOld(y,x)),registerAITextSearchProvider:(y,x)=>(A(k,"aiTextSearchProvider"),A(k,"textSearchProvider2"),de.registerAITextSearchProvider(y,x)),registerFileSearchProvider2:(y,x)=>(A(k,"fileSearchProvider2"),de.registerFileSearchProvider(y,x)),registerTextSearchProvider2:(y,x)=>(A(k,"textSearchProvider2"),de.registerTextSearchProvider(y,x)),registerRemoteAuthorityResolver:(y,x)=>(A(k,"resolvers"),o.registerRemoteAuthorityResolver(y,x)),registerResourceLabelFormatter:y=>(A(k,"resolvers"),pn.$registerResourceLabelFormatter(y)),getRemoteExecServer:y=>(A(k,"resolvers"),o.getRemoteExecServer(y)),onDidCreateFiles:(y,x,D)=>ae(ci.onDidCreateFile)(y,x,D),onDidDeleteFiles:(y,x,D)=>ae(ci.onDidDeleteFile)(y,x,D),onDidRenameFiles:(y,x,D)=>ae(ci.onDidRenameFile)(y,x,D),onWillCreateFiles:(y,x,D)=>ae(ci.getOnWillCreateFileEvent(k))(y,x,D),onWillDeleteFiles:(y,x,D)=>ae(ci.getOnWillDeleteFileEvent(k))(y,x,D),onWillRenameFiles:(y,x,D)=>ae(ci.getOnWillRenameFileEvent(k))(y,x,D),openTunnel:y=>(A(k,"tunnels"),h.openTunnel(k,y).then(x=>{if(!x)throw new Error("cannot open tunnel");return x})),get tunnels(){return A(k,"tunnels"),h.getTunnels()},onDidChangeTunnels:(y,x,D)=>(A(k,"tunnels"),ae(h.onDidChangeTunnels)(y,x,D)),registerPortAttributesProvider:(y,x)=>(A(k,"portsAttributes"),h.registerPortsAttributesProvider(y,x)),registerTunnelProvider:(y,x)=>(A(k,"tunnelFactory"),h.registerTunnelProvider(y,x)),registerTimelineProvider:(y,x)=>(A(k,"timeline"),Uy.registerTimelineProvider(y,x,k.identifier,ne.converter)),get isTrusted(){return i.trusted},requestResourceTrust:y=>(A(k,"workspaceTrust"),i.requestResourceTrust(y)),requestWorkspaceTrust:y=>(A(k,"workspaceTrust"),i.requestWorkspaceTrust(y)),isResourceTrusted:y=>(A(k,"workspaceTrust"),i.isResourceTrusted(y)),onDidChangeWorkspaceTrustedFolders:(y,x,D)=>(A(k,"workspaceTrust"),ae(i.onDidChangeWorkspaceTrustedFolders)(y,x,D)),onDidGrantWorkspaceTrust:(y,x,D)=>ae(i.onDidGrantWorkspaceTrust)(y,x,D),registerEditSessionIdentityProvider:(y,x)=>(A(k,"editSessionIdentityProvider"),i.registerEditSessionIdentityProvider(y,x)),onWillCreateEditSessionIdentity:(y,x,D)=>(A(k,"editSessionIdentityProvider"),ae(i.getOnWillCreateEditSessionIdentityEvent(k))(y,x,D)),registerCanonicalUriProvider:(y,x)=>(A(k,"canonicalUriProvider"),i.registerCanonicalUriProvider(y,x)),getCanonicalUri:(y,x,D)=>(A(k,"canonicalUriProvider"),i.provideCanonicalUri(y,x,D)),decode(y,x){return i.decode(y,x)},encode(y,x){return i.encode(y,x)}},A$={get inputBox(){return f.report("scm.inputBox",k,"Use 'SourceControl.inputBox' instead"),Hd.getLastInputBox(k)},createSourceControl(y,x,D,Se,It,yn){return(Se||It||yn)&&A(k,"scmProviderOptions"),Hd.createSourceControl(k,y,x,D,Se,It,yn)}},M$={createCommentController(y,x){return Ja.createCommentController(k,y,x)}},L$={get activeDebugSession(){return X.activeDebugSession},get activeDebugConsole(){return X.activeDebugConsole},get breakpoints(){return X.breakpoints},get activeStackItem(){return X.activeStackItem},registerDebugVisualizationProvider(y,x){return A(k,"debugVisualization"),X.registerDebugVisualizationProvider(k,y,x)},registerDebugVisualizationTreeProvider(y,x){return A(k,"debugVisualization"),X.registerDebugVisualizationTree(k,y,x)},onDidStartDebugSession(y,x,D){return ae(X.onDidStartDebugSession)(y,x,D)},onDidTerminateDebugSession(y,x,D){return ae(X.onDidTerminateDebugSession)(y,x,D)},onDidChangeActiveDebugSession(y,x,D){return ae(X.onDidChangeActiveDebugSession)(y,x,D)},onDidReceiveDebugSessionCustomEvent(y,x,D){return ae(X.onDidReceiveDebugSessionCustomEvent)(y,x,D)},onDidChangeBreakpoints(y,x,D){return ae(X.onDidChangeBreakpoints)(y,x,D)},onDidChangeActiveStackItem(y,x,D){return ae(X.onDidChangeActiveStackItem)(y,x,D)},registerDebugConfigurationProvider(y,x,D){return X.registerDebugConfigurationProvider(y,x,D||1)},registerDebugAdapterDescriptorFactory(y,x){return X.registerDebugAdapterDescriptorFactory(k,y,x)},registerDebugAdapterTrackerFactory(y,x){return X.registerDebugAdapterTrackerFactory(y,x)},startDebugging(y,x,D){return!D||typeof D=="object"&&"configuration"in D?X.startDebugging(y,x,{parentSession:D}):X.startDebugging(y,x,D||{})},stopDebugging(y){return X.stopDebugging(y)},addBreakpoints(y){return X.addBreakpoints(y)},removeBreakpoints(y){return X.removeBreakpoints(y)},asDebugSourceUri(y,x){return X.asDebugSourceUri(y,x)}},O$={registerTaskProvider:(y,x)=>ge.registerTaskProvider(k,y,x),fetchTasks:y=>ge.fetchTasks(y),executeTask:y=>ge.executeTask(k,y),get taskExecutions(){return ge.taskExecutions},onDidStartTask:(y,x,D)=>{let Se=It=>{He(k,"taskExecutionTerminal")||It?.execution?.terminal!==void 0&&(It.execution.terminal=void 0);let yn={...It,execution:It.execution};return y.call(x,yn)};return ae(ge.onDidStartTask)(Se,x,D)},onDidEndTask:(y,x,D)=>ae(ge.onDidEndTask)(y,x,D),onDidStartTaskProcess:(y,x,D)=>ae(ge.onDidStartTaskProcess)(y,x,D),onDidEndTaskProcess:(y,x,D)=>ae(ge.onDidEndTaskProcess)(y,x,D),onDidStartTaskProblemMatchers:(y,x,D)=>(A(k,"taskProblemMatcherStatus"),ae(ge.onDidStartTaskProblemMatchers)(y,x,D)),onDidEndTaskProblemMatchers:(y,x,D)=>(A(k,"taskProblemMatcherStatus"),ae(ge.onDidEndTaskProblemMatchers)(y,x,D))},N$={createNotebookController(y,x,D,Se,It){return Qi.createNotebookController(k,y,x,D,Se,He(k,"notebookMessaging")?It:void 0)},registerNotebookCellStatusBarItemProvider:(y,x)=>je.registerNotebookCellStatusBarItemProvider(k,y,x),createRendererMessaging(y){return Qa.createRendererMessaging(k,y)},createNotebookControllerDetectionTask(y){return A(k,"notebookKernelSource"),Qi.createNotebookControllerDetectionTask(k,y)},registerKernelSourceActionProvider(y,x){return A(k,"notebookKernelSource"),Qi.registerKernelSourceActionProvider(k,y,x)}},U$={t(...y){if(typeof y[0]=="string"){let x=y.shift(),D=!y||typeof y[0]!="object"?y:y[0];return gt.getMessage(k.identifier.value,{message:x,args:D})}return gt.getMessage(k.identifier.value,y[0])},get bundle(){return gt.getBundle(k.identifier.value)},get uri(){return gt.getBundleUri(k.identifier.value)}},F$={transferActiveChat(y){return A(k,"interactive"),Dt.transferActiveChat(y)}},H$={getRelatedInformation(y,x){return A(k,"aiRelatedInformation"),ir.getRelatedInformation(k,y,x)},registerRelatedInformationProvider(y,x){return A(k,"aiRelatedInformation"),ir.registerRelatedInformationProvider(k,y,x)},registerEmbeddingVectorProvider(y,x){return A(k,"aiRelatedInformation"),bn.registerEmbeddingVectorProvider(k,y,x)},registerSettingsSearchProvider(y){return A(k,"aiSettingsSearch"),$n.registerSettingsSearchProvider(k,y)}},W$={registerMappedEditsProvider(y,x){return A(k,"mappedEditsProvider"),{dispose(){}}},registerMappedEditsProvider2(y){return A(k,"mappedEditsProvider"),Fd.registerMappedEditsProvider(k,y)},createChatParticipant(y,x){return Dt.createChatAgent(k,y,x)},createDynamicChatParticipant(y,x,D){return A(k,"chatParticipantPrivate"),Dt.createDynamicChatAgent(k,y,x,D)},registerChatParticipantDetectionProvider(y){return A(k,"chatParticipantPrivate"),Dt.registerChatParticipantDetectionProvider(k,y)},onDidDisposeChatSession:(y,x,D)=>(A(k,"chatParticipantPrivate"),ae(Dt.onDidDisposeChatSession)(y,x,D)),registerChatSessionItemProvider:(y,x)=>(A(k,"chatSessionsProvider"),f.report("chat.registerChatSessionItemProvider",k,"Please migrate to the new chat session controller API",{usageId:y}),Ct.registerChatSessionItemProvider(k,y,x)),createChatSessionItemController:(y,x)=>(A(k,"chatSessionsProvider"),Ct.createChatSessionItemController(k,y,x)),registerChatSessionContentProvider(y,x,D,Se){return A(k,"chatSessionsProvider"),Ct.registerChatSessionContentProvider(k,y,D,x,Se)},registerChatOutputRenderer:(y,x)=>(A(k,"chatOutputRenderer"),$e.registerChatOutputRenderer(k,y,x)),registerChatWorkspaceContextProvider(y,x){return A(k,"chatContextProvider"),nn.registerChatWorkspaceContextProvider(`${k.id}-${y}`,x)},registerChatExplicitContextProvider(y,x){return A(k,"chatContextProvider"),nn.registerChatExplicitContextProvider(`${k.id}-${y}`,x)},registerChatResourceContextProvider(y,x,D){return A(k,"chatContextProvider"),nn.registerChatResourceContextProvider(Lt(y),`${k.id}-${x}`,D)},registerChatContextProvider(y,x,D){return A(k,"chatContextProvider"),nn.registerChatContextProvider(y?Lt(y):void 0,`${k.id}-${x}`,D)},registerCustomAgentProvider(y){return A(k,"chatPromptFiles"),Dt.registerPromptFileProvider(k,"agent",y)},registerInstructionsProvider(y){return A(k,"chatPromptFiles"),Dt.registerPromptFileProvider(k,"instructions",y)},registerPromptFileProvider(y){return A(k,"chatPromptFiles"),Dt.registerPromptFileProvider(k,"prompt",y)},registerSkillProvider(y){return A(k,"chatPromptFiles"),Dt.registerPromptFileProvider(k,"skill",y)},registerChatDebugLogProvider(y){return A(k,"chatDebug"),Bn.registerChatDebugLogProvider(y)},onDidReceiveChatDebugEvent:(y,x,D)=>(A(k,"chatDebug"),Bn.onDidAddCoreEvent(y,x,D)),get customAgents(){return A(k,"chatPromptFiles"),Dt.customAgents},onDidChangeCustomAgents:(y,x,D)=>(A(k,"chatPromptFiles"),Dt.onDidChangeCustomAgents(y,x,D)),get instructions(){return A(k,"chatPromptFiles"),Dt.instructions},onDidChangeInstructions:(y,x,D)=>(A(k,"chatPromptFiles"),Dt.onDidChangeInstructions(y,x,D)),get skills(){return A(k,"chatPromptFiles"),Dt.skills},onDidChangeSkills:(y,x,D)=>(A(k,"chatPromptFiles"),Dt.onDidChangeSkills(y,x,D)),registerChatSessionCustomizationProvider(y,x,D){return A(k,"chatSessionCustomizationProvider"),Dt.registerChatSessionCustomizationProvider(k,y,x,D)}},V$={selectChatModels:y=>G.selectLanguageModels(k,y??{}),onDidChangeChatModels:(y,x,D)=>G.onDidChangeProviders(y,x,D),registerLanguageModelChatProvider:(y,x)=>G.registerLanguageModelChatProvider(k,y,x),get isModelProxyAvailable(){return A(k,"languageModelProxy"),G.isModelProxyAvailable},onDidChangeModelProxyAvailability:(y,x,D)=>(A(k,"languageModelProxy"),G.onDidChangeModelProxyAvailability(y,x,D)),getModelProxy:()=>(A(k,"languageModelProxy"),G.getModelProxy(k)),registerLanguageModelProxyProvider:y=>(A(k,"chatParticipantPrivate"),G.registerLanguageModelProxyProvider(k,y)),get embeddingModels(){return A(k,"embeddings"),Ve.embeddingsModels},onDidChangeEmbeddingModels:(y,x,D)=>(A(k,"embeddings"),Ve.onDidChange(y,x,D)),registerEmbeddingsProvider(y,x){return A(k,"embeddings"),Ve.registerEmbeddingsProvider(k,y,x)},async computeEmbeddings(y,x,D){return A(k,"embeddings"),Ve.computeEmbeddings(y,x,D)},registerTool(y,x){return mn.registerTool(k,y,x)},registerToolDefinition(y,x){return mn.registerToolDefinition(k,y,x)},invokeTool(y,x,D){return typeof y!="string"&&A(k,"chatParticipantAdditions"),mn.invokeTool(k,y,x,D)},get tools(){return mn.getTools(k)},fileIsIgnored(y,x){return G.fileIsIgnored(k,y,x)},registerIgnoredFileProvider(y){return G.registerIgnoredFileProvider(k,y)},registerMcpServerDefinitionProvider(y,x){return J.registerMcpConfigurationProvider(k,y,x)},onDidChangeMcpServerDefinitions:(...y)=>(A(k,"mcpServerDefinitions"),ae(J.onDidChangeMcpServerDefinitions)(...y)),get mcpServerDefinitions(){return A(k,"mcpServerDefinitions"),J.mcpServerDefinitions},startMcpGateway(){return A(k,"mcpServerDefinitions"),J.startMcpGateway()},onDidChangeChatRequestTools(...y){return A(k,"chatParticipantAdditions"),ae(Dt.onDidChangeChatRequestTools)(...y)}},B$={registerSpeechProvider(y,x){return A(k,"speech"),sr.registerProvider(k.identifier,y,x)}};return{version:t.version,ai:H$,authentication:w$,commands:k$,comments:M$,chat:W$,debug:L$,env:EN,extensions:_$,interactive:F$,l10n:U$,languages:D$,lm:V$,notebooks:N$,scm:A$,speech:B$,tasks:O$,tests:P$,window:R$,workspace:wN,Breakpoint:Sa,TerminalOutputAnchor:e1,ChatResultFeedbackKind:$C,ChatVariableLevel:k1,ChatCompletionItem:FS,ChatReferenceDiagnostic:ld,CallHierarchyIncomingCall:lm,CallHierarchyItem:Jl,CallHierarchyOutgoingCall:dm,CancellationError:Be,CancellationTokenSource:Ce,CandidatePortSource:nR,CodeAction:xs,CodeActionKind:St,CodeActionTriggerKind:eC,CodeLens:Ul,Color:_i,ColorInformation:Bl,ColorPresentation:$l,ColorThemeKind:LC,CommentMode:h1,CommentState:v1,CommentThreadCollapsibleState:wC,CommentThreadState:kC,CommentThreadApplicability:PC,CommentThreadFocus:_C,CompletionItem:Wl,CompletionItemKind:Wv,CompletionItemTag:oC,CompletionList:Pi,CompletionTriggerKind:nC,ConfigurationTarget:IC,CustomExecution:zc,DebugAdapterExecutable:Mi,DebugAdapterInlineImplementation:Ca,DebugAdapterNamedPipeServer:ws,DebugAdapterServer:Li,DebugConfigurationProviderTriggerKind:_A,DebugConsoleMode:DC,DebugVisualization:RS,DecorationRangeBehavior:gC,Diagnostic:ba,DiagnosticRelatedInformation:vs,DiagnosticSeverity:Mc,DiagnosticTag:Nv,Disposable:be,DocumentHighlight:Ol,DocumentHighlightKind:ZS,MultiDocumentHighlight:Nl,DocumentLink:Vl,DocumentSymbol:Nr,EndOfLine:Nc,EnvironmentVariableMutatorType:XS,EvaluatableExpression:zl,InlineValueText:ql,InlineValueVariableLookup:Kl,InlineValueEvaluatableExpression:jl,InlineCompletionTriggerKind:xC,InlineCompletionsDisposeReasonKind:SC,EventEmitter:E,ExtensionKind:MC,ExtensionMode:HC,ExternalUriOpenerPriority:S1,FileChangeType:TC,FileDecoration:Kc,FileDecoration2:Kc,FileSystemError:bt,FileType:gc,FilePermission:fc,FoldingRange:sm,FoldingRangeKind:EC,FunctionBreakpoint:Ai,InlineCompletionItem:nm,InlineCompletionList:om,Hover:Uc,VerboseHover:Ll,HoverVerbosityAction:t1,IndentAction:TL,Location:en,MarkdownString:Zt,OverviewRulerLane:LR,ParameterInformation:Zp,PortAutoForwardAction:T1,Position:we,ProcessExecution:Cs,ProgressLocation:Vv,QuickInputButtonLocation:b1,QuickInputButtons:Is,Range:fe,RelativePattern:Es,Selection:Jn,SelectionRange:Ss,SemanticTokens:Oi,SemanticTokensBuilder:DS,SemanticTokensEdit:pm,SemanticTokensEdits:Xl,SemanticTokensLegend:qc,ShellExecution:Di,ShellQuoting:u1,SignatureHelp:tm,SignatureHelpTriggerKind:n1,SignatureInformation:em,SnippetString:Yn,SourceBreakpoint:Ri,StandardTokenType:Bv,StatusBarAlignment:lC,SymbolInformation:Or,SymbolKind:Xp,SymbolTag:Fv,Task:Vn,TaskEventKind:d1,TaskGroup:Mn,TaskPanelKind:c1,TaskRevealKind:l1,TaskRunOn:p1,TaskScope:vC,TerminalLink:IS,TerminalQuickFixTerminalCommand:SS,TerminalQuickFixOpener:xS,TerminalLocation:s1,TerminalProfile:CS,TerminalExitReason:r1,TerminalShellExecutionCommandLineConfidence:hC,TerminalCompletionItem:TS,TerminalCompletionItemKind:a1,TerminalCompletionList:ES,TerminalShellType:i1,TextDocumentSaveReason:cC,TextEdit:Wn,SnippetTextEdit:ya,TextEditorCursorStyle:eR,TextEditorChangeKind:pC,TextEditorLineNumbersStyle:dC,TextEditorRevealType:uC,TextEditorSelectionChangeKind:eu,SyntaxTokenType:tu,TextDocumentChangeReason:mC,ThemeColor:xa,ThemeIcon:un,TreeItem:Ts,TreeItemCheckboxState:yC,TreeItemCollapsibleState:bC,TypeHierarchyItem:Zl,UIKind:BT,Uri:b,ViewColumn:aC,WorkspaceEdit:Cr,DocumentPasteTriggerKind:g1,DocumentDropEdit:rm,DocumentDropOrPasteEditKind:ei,DocumentPasteEdit:PS,InlayHint:Hl,InlayHintLabelPart:Fl,InlayHintKind:o1,RemoteAuthorityResolverError:Ps,ResolvedAuthority:yS,ManagedResolvedAuthority:Ql,SourceControlInputBoxValidationType:fC,ExtensionRuntime:WC,TimelineItem:am,NotebookRange:oo,NotebookCellKind:Uv,NotebookCellExecutionState:y1,NotebookCellData:bs,NotebookData:Lc,NotebookRendererScript:mm,NotebookCellStatusBarAlignment:OC,NotebookEditorRevealType:NC,NotebookCellOutput:ys,NotebookCellOutputItem:Oc,CellErrorStackFrame:AS,NotebookCellStatusBarItem:MS,NotebookControllerAffinity:I1,NotebookControllerAffinity2:UC,NotebookEdit:Bo,NotebookKernelSourceAction:LS,NotebookVariablesRequestKind:FC,PortAttributes:NS,LinkedEditingRanges:OS,TestResultState:x1,TestRunRequest:Gl,TestMessage:ks,TestMessageStackFrame:US,TestTag:Ta,TestRunProfileKind:VC,TextSearchCompleteMessageType:ub,DataTransfer:Zr,DataTransferItem:Fc,TestCoverageCount:$c,FileCoverage:Ea,StatementCoverage:fm,BranchCoverage:hm,DeclarationCoverage:vm,WorkspaceTrustState:C1,LanguageStatusSeverity:tC,QuickPickItemKind:RC,InputBoxValidationSeverity:AC,TabInputText:ed,TabInputTextDiff:wa,TabInputTextMerge:bm,TabInputCustom:td,TabInputNotebook:nd,TabInputNotebookDiff:od,TabInputWebview:ym,TabInputTerminal:Im,TabInputInteractiveWindow:xm,TabInputChat:Sm,TabInputTextMultiDiff:Cm,TelemetryTrustedValue:Rl,LogLevel:aa,EditSessionIdentityMatch:EL,InteractiveSessionVoteDirection:E1,ChatCopyKind:w1,ChatSessionChangedFile:jS,ChatSessionChangedFile2:GS,ChatEditingSessionActionOutcome:BC,InteractiveEditorResponseFeedbackKind:_1,DebugStackFrame:cm,DebugThread:um,RelatedInformationType:N1,SpeechToTextStatus:F1,TextToSpeechStatus:H1,PartialAcceptTriggerKind:rC,InlineCompletionEndOfLifeReasonKind:iC,InlineCompletionDisplayLocationKind:sC,KeywordRecognitionStatus:W1,ChatImageMimeType:O1,ChatResponseMarkdownPart:ka,ChatResponseFileTreePart:_a,ChatResponseAnchorPart:Ds,ChatResponseProgressPart:Qc,ChatResponseProgressPart2:rd,ChatResponseThinkingProgressPart:Ni,ChatResponseHookPart:Da,ChatResponseReferencePart:ti,ChatResponseReferencePart2:ti,ChatResponseCodeCitationPart:Ma,ChatResponseCodeblockUriPart:Aa,ChatResponseWarningPart:Rs,ChatResponseTextEditPart:Ms,ChatResponseNotebookEditPart:Oa,ChatResponseWorkspaceEditPart:ad,ChatResponseMarkdownWithVulnerabilitiesPart:_s,ChatResponseCommandButtonPart:Ra,ChatResponseConfirmationPart:Pa,ChatQuestion:Em,ChatQuestionType:zC,ChatResponseQuestionCarouselPart:As,ChatResponseMovePart:La,ChatResponseExtensionsPart:id,ChatResponseExternalEditPart:Gc,ChatResponsePullRequestPart:sd,ChatResponseMultiDiffPart:jc,ChatResponseReferencePartStatusKind:A1,ChatResponseClearToPreviousToolInvocationReason:M1,ChatRequestTurn:Ls,ChatRequestTurn2:Ls,ChatResponseTurn:wm,ChatResponseTurn2:WS,ChatSubagentToolInvocationData:Tm,ChatToolInvocationPart:Jc,ChatLocation:jC,ChatSessionStatus:D1,ChatSessionCustomizationType:VS,ChatDebugLogLevel:R1,ChatDebugToolCallResult:GC,ChatDebugHookResult:QC,ChatDebugToolCallEvent:km,ChatDebugModelTurnEvent:Pm,ChatDebugGenericEvent:_m,ChatDebugSubagentInvocationEvent:Dm,ChatDebugUserMessageEvent:Rm,ChatDebugAgentResponseEvent:Am,ChatDebugMessageSection:Yc,ChatDebugEventTextContent:BS,ChatDebugMessageContentType:JC,ChatDebugEventMessageContent:$S,ChatDebugEventToolCallContent:zS,ChatDebugEventModelTurnContent:qS,ChatDebugEventHookContent:KS,ChatRequestEditorData:Mm,ChatRequestNotebookData:Lm,ChatReferenceBinaryData:Om,ChatRequestEditedFileEventKind:P1,LanguageModelChatMessageRole:zv,LanguageModelChatMessage:Nm,LanguageModelChatMessage2:Um,LanguageModelToolResultPart:Os,LanguageModelToolResultPart2:Os,LanguageModelTextPart:tn,LanguageModelTextPart2:tn,LanguageModelPartAudience:YC,ToolResultAudience:YC,LanguageModelToolCallPart:ni,LanguageModelThinkingPart:Ui,LanguageModelError:Tr,LanguageModelToolResult:dd,LanguageModelToolResult2:QS,LanguageModelDataPart:Ln,LanguageModelDataPart2:Ln,LanguageModelToolExtensionSource:Fm,LanguageModelToolMCPSource:Hm,ExtendedLanguageModelToolResult:JS,LanguageModelChatToolMode:XC,LanguageModelPromptTsxPart:oi,NewSymbolName:_S,NewSymbolNameTag:f1,NewSymbolNameTriggerKind:CC,ExcludeSettingOptions:ET,TextSearchContext2:Us,TextSearchMatch2:zo,AISearchKeyword:pu,TextSearchCompleteMessageTypeNew:ub,ChatErrorLevel:L1,McpHttpServerDefinition:Zc,McpHttpServerDefinition2:Zc,McpStdioServerDefinition:Xc,McpStdioServerDefinition2:Xc,McpToolAvailability:ZC,McpToolInvocationContentData:HS,SettingsSearchResultKind:U1,ChatTodoStatus:qC,ChatDebugSubagentStatus:KC}}}var Wu=class{constructor(t,e,n,o,i,s,a){this._apiFactory=t;this._extensionRegistry=e;this._instaService=n;this._extHostConfiguration=o;this._extHostExtensionService=i;this._initData=s;this._logService=a;this._factories=new Map,this._alternatives=[]}async install(){this._installInterceptor(),Ft("code/extHost/willWaitForConfig");let t=await this._extHostConfiguration.getConfigProvider();Ft("code/extHost/didWaitForConfig");let e=await this._extHostExtensionService.getExtensionPathIndex();this.register(new QO(this._apiFactory,e,this._extensionRegistry,t,this._logService)),this.register(this._instaService.createInstance(Nd)),this._initData.remote.isRemote&&this.register(this._instaService.createInstance(wy,e,this._initData.environment.appUriScheme))}register(t){if("nodeModuleName"in t)if(Array.isArray(t.nodeModuleName))for(let e of t.nodeModuleName)this._factories.set(e,t);else this._factories.set(t.nodeModuleName,t);typeof t.alternativeModuleName=="function"&&this._alternatives.push(e=>t.alternativeModuleName(e))}};Wu=_([C(2,Jo),C(3,Sn),C(4,go),C(5,Ye),C(6,oe)],Wu);var Nd=class{static{this.aliased=new Map([["vscode-ripgrep","@vscode/ripgrep"],["vscode-windows-registry","@vscode/windows-registry"]])}constructor(t){if(t.environment.appRoot&&Nd.aliased.size){let e=pr(this.forceForwardSlashes(t.environment.appRoot.fsPath)),n="[a-z0-9_.-]",o=`@${n}+\\/${n}+|${n}+`,i="node_modules|node_modules\\.asar(?:\\.unpacked)?";this.re=new RegExp(`^(${e}/${i}\\/)(${o})(.*)$`,"i")}}alternativeModuleName(t){if(!this.re)return;let e=this.re.exec(this.forceForwardSlashes(t));if(!e)return;let[,n,o,i]=e,s=Nd.aliased.get(o);if(s!==void 0)return console.warn(`${o} as been renamed to ${s}, please update your imports`),n+s+i}forceForwardSlashes(t){return t.replace(/\\/g,"/")}};Nd=_([C(0,Ye)],Nd);var QO=class{constructor(t,e,n,o,i){this._apiFactory=t;this._extensionPaths=e;this._extensionRegistry=n;this._configProvider=o;this._logService=i;this.nodeModuleName="vscode";this._extApiImpl=new uo}load(t,e){let n=this._extensionPaths.findSubstr(e);if(n){let o=this._extApiImpl.get(n.identifier);return o||(o=this._apiFactory(n,this._extensionRegistry,this._configProvider),this._extApiImpl.set(n.identifier,o)),o}if(!this._defaultApiImpl){let o="";this._extensionPaths.forEach((i,s)=>o+=`	${s} -> ${i.identifier.value}
`),this._logService.warn(`Could not identify extension for 'vscode' require call from ${e}. These are the extension path mappings: 
${o}`),this._defaultApiImpl=this._apiFactory(cW,this._extensionRegistry,this._configProvider)}return this._defaultApiImpl}},wy=class{constructor(t,e,n){this._extensionPaths=t;this._appUriScheme=e;this.nodeModuleName=["open","opn"];this._mainThreadTelemetry=n.getProxy(F.MainThreadTelemetry);let o=n.getProxy(F.MainThreadWindow);this._impl=(i,s)=>{let a=b.parse(i);return s?this.callOriginal(i,s):a.scheme==="http"||a.scheme==="https"?o.$openUri(a,i,{allowTunneling:!0}):a.scheme==="mailto"||a.scheme===this._appUriScheme?o.$openUri(a,i,{}):this.callOriginal(i,s)}}load(t,e,n){let o=this._extensionPaths.findSubstr(e);return o&&(this._extensionId=o.identifier.value,this.sendShimmingTelemetry()),this._original=n(t),this._impl}callOriginal(t,e){return this.sendNoForwardTelemetry(),this._original(t,e)}sendShimmingTelemetry(){this._extensionId&&this._mainThreadTelemetry.$publicLog2("shimming.open",{extension:this._extensionId})}sendNoForwardTelemetry(){this._extensionId&&this._mainThreadTelemetry.$publicLog2("shimming.open.call.noForward",{extension:this._extensionId})}};wy=_([C(2,se)],wy);import{LogLevel as Bu,createHttpPatch as $5,createProxyResolver as WQ,createTlsPatch as VQ,createNetPatch as BQ,loadSystemCertificates as z5}from"@vscode/proxy-agent";import{createRequire as $Q}from"node:module";import{parse as V5}from"url";import{spawn as RQ}from"child_process";import{userInfo as kQ}from"os";import*as JO from"os";var L5=/^\d+$/,yQ=/^Microsoft.PowerShell_.*/,IQ=/^Microsoft.PowerShellPreview_.*/;var ky;switch(process.arch){case"ia32":ky=1;break;case"arm":case"arm64":ky=2;break;default:ky=0;break}var zf;process.env.PROCESSOR_ARCHITEW6432?zf=process.env.PROCESSOR_ARCHITEW6432==="ARM64"?2:0:process.env.PROCESSOR_ARCHITECTURE==="ARM64"?zf=2:process.env.PROCESSOR_ARCHITECTURE==="X86"?zf=1:zf=0;var Vu=class{constructor(t,e,n){this.exePath=t;this.displayName=e;this.knownToExist=n}async exists(){return this.knownToExist===void 0&&(this.knownToExist=await Mo.existsFile(this.exePath)),this.knownToExist}};function xQ({useAlternateBitness:r=!1}={}){return r?ky===0?process.env["ProgramFiles(x86)"]||null:zf===0&&process.env.ProgramW6432||null:process.env.ProgramFiles||null}async function Gk({useAlternateBitness:r=!1,findPreview:t=!1}={}){let e=xQ({useAlternateBitness:r});if(!e)return null;let n=Ne(e,"PowerShell");if(!await Mo.existsDirectory(n))return null;let o=-1,i=null;for(let l of await st.readdir(n)){let d=-1;if(t){let u=l.indexOf("-");if(u<0)continue;let m=l.substring(0,u);if(!L5.test(m)||l.substring(u+1)!=="preview")continue;d=parseInt(m,10)}else{if(!L5.test(l))continue;d=parseInt(l,10)}if(d<=o)continue;let c=Ne(n,l,"pwsh.exe");await Mo.existsFile(c)&&(i=c,o=d)}if(!i)return null;let s=e.includes("x86")?" (x86)":"",a=t?" Preview":"";return new Vu(i,`PowerShell${a}${s}`,!0)}async function O5({findPreview:r}={}){if(!process.env.LOCALAPPDATA)return null;let t=Ne(process.env.LOCALAPPDATA,"Microsoft","WindowsApps");if(!await Mo.existsDirectory(t))return null;let{pwshMsixDirRegex:e,pwshMsixName:n}=r?{pwshMsixDirRegex:IQ,pwshMsixName:"PowerShell Preview (Store)"}:{pwshMsixDirRegex:yQ,pwshMsixName:"PowerShell (Store)"};for(let o of await st.readdir(t))if(e.test(o)){let i=Ne(t,o,"pwsh.exe");return new Vu(i,n)}return null}function SQ(){let r=Ne(JO.homedir(),".dotnet","tools","pwsh.exe");return new Vu(r,".NET Core PowerShell Global Tool")}function CQ(){let r=Ne(JO.homedir(),"scoop","apps"),t=Ne(r,"pwsh","current","pwsh.exe");return new Vu(t,"PowerShell (Scoop)")}function TQ(){let r=Ne(process.env.windir,ky===1&&zf!==1?"SysNative":"System32","WindowsPowerShell","v1.0","powershell.exe");return new Vu(r,"Windows PowerShell",!0)}async function*EQ(){let r=await Gk();r&&(yield r),r=await Gk({useAlternateBitness:!0}),r&&(yield r),r=await O5(),r&&(yield r),r=SQ(),r&&(yield r),r=await Gk({findPreview:!0}),r&&(yield r),r=await O5({findPreview:!0}),r&&(yield r),r=await Gk({useAlternateBitness:!0,findPreview:!0}),r&&(yield r),r=await CQ(),r&&(yield r),r=TQ(),r&&(yield r)}async function*wQ(){for await(let r of EQ())await r.exists()&&(yield r)}async function N5(){for await(let r of wQ())return r;return null}async function U5(r,t){return r===1?Ie?_Q():TE(t):PQ(r,t)}var YO=null;function PQ(r,t){if(Qe&&r===2||pt&&r===3)return"/bin/bash";if(!YO){let e;if(Ie)e="/bin/bash";else{if(e=t.SHELL,!e)try{e=kQ().shell}catch{}e||(e="sh"),e==="/bin/false"&&(e="/bin/bash")}YO=e}return YO}var XO=null;async function _Q(){return XO||(XO=(await N5()).exePath),XO}import _xt from"assert";import xxt from"minimist";var Txt={o:p(1980,null),e:p(1964,null),t:p(1995,null),m:p(1975,null)};var DQ={chat:{type:"subcommand",description:"Pass in a prompt to run in a chat session in the current working directory.",options:{_:{type:"string[]",description:p(1984,null)},mode:{type:"string",cat:"o",alias:"m",args:"mode",description:p(1952,null)},"add-file":{type:"string[]",cat:"o",alias:"a",args:"path",description:p(1948,null)},maximize:{type:"boolean",cat:"o",description:p(1951,null)},"reuse-window":{type:"boolean",cat:"o",alias:"r",description:p(1987,null)},"new-window":{type:"boolean",cat:"o",alias:"n",description:p(1978,null)},profile:{type:"string",cat:"o",args:"profileName",description:p(1983,null)},help:{type:"boolean",alias:"h",description:p(1966,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:p(1953,null)},"disable-telemetry":{type:"boolean"},"telemetry-level":{type:"string"}}},"agent-host":{type:"subcommand",description:"Run a server that hosts agents.",options:{"cli-data-dir":{type:"string",args:"dir",description:p(1953,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:p(1953,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:p(1956,null)},merge:{type:"boolean",cat:"o",alias:"m",args:["path1","path2","base","result"],description:p(1976,null)},add:{type:"boolean",cat:"o",alias:"a",args:"folder",description:p(1947,null)},remove:{type:"boolean",cat:"o",args:"folder",description:p(1985,null)},goto:{type:"boolean",cat:"o",alias:"g",args:"file:line[:character]",description:p(1965,null)},"new-window":{type:"boolean",cat:"o",alias:"n",description:p(1977,null)},"reuse-window":{type:"boolean",cat:"o",alias:"r",description:p(1986,null)},sessions:{type:"boolean",cat:"o",description:p(1988,null)},wait:{type:"boolean",cat:"o",alias:"w",description:p(2005,null)},waitMarkerFilePath:{type:"string"},locale:{type:"string",cat:"o",args:"locale",description:p(1972,null)},"user-data-dir":{type:"string",cat:"o",args:"dir",description:p(2002,null)},profile:{type:"string",cat:"o",args:"profileName",description:p(1983,null)},help:{type:"boolean",cat:"o",alias:"h",description:p(1966,null)},"extensions-dir":{type:"string",deprecates:["extensionHomePath"],cat:"e",args:"dir",description:p(1963,null)},"extensions-download-dir":{type:"string"},"builtin-extensions-dir":{type:"string"},"list-extensions":{type:"boolean",cat:"e",description:p(1971,null)},"agent-plugins-dir":{type:"string"},"show-versions":{type:"boolean",cat:"e",description:p(1989,null)},category:{type:"string",allowEmptyValue:!0,cat:"e",description:p(1950,null),args:"category"},"install-extension":{type:"string[]",cat:"e",args:"ext-id | path",description:p(1970,null)},"pre-release":{type:"boolean",cat:"e",description:p(1969,null)},"uninstall-extension":{type:"string[]",cat:"e",args:"ext-id",description:p(1997,null)},"update-extensions":{type:"boolean",cat:"e",description:p(2000,null)},"enable-proposed-api":{type:"string[]",allowEmptyValue:!0,cat:"e",args:"ext-id",description:p(1962,null)},"add-mcp":{type:"string[]",cat:"m",args:"json",description:p(1949,null)},version:{type:"boolean",cat:"t",alias:"v",description:p(2004,null)},verbose:{type:"boolean",cat:"t",global:!0,description:p(2003,null)},log:{type:"string[]",cat:"t",args:"level",global:!0,description:p(1974,null)},status:{type:"boolean",alias:"s",cat:"t",description:p(1990,null)},"prof-startup":{type:"boolean",cat:"t",description:p(1982,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:p(1959,null)},"disable-extension":{type:"string[]",cat:"t",args:"ext-id",description:p(1958,null)},sync:{type:"string",cat:"t",description:p(1996,null),args:["on | off"]},"inspect-extensions":{type:"string",allowEmptyValue:!0,deprecates:["debugPluginHost"],args:"port",cat:"t",description:p(1968,null)},"inspect-brk-extensions":{type:"string",allowEmptyValue:!0,deprecates:["debugBrkPluginHost"],args:"port",cat:"t",description:p(1967,null)},"disable-lcd-text":{type:"boolean",cat:"t",description:p(1961,null)},"disable-gpu":{type:"boolean",cat:"t",description:p(1960,null)},"disable-chromium-sandbox":{type:"boolean",cat:"t",description:p(1957,null)},sandbox:{type:"boolean"},"locate-shell-integration-path":{type:"string",cat:"t",args:["shell"],description:p(1973,null)},telemetry:{type:"boolean",cat:"t",description:p(1993,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-search":{type:"string",deprecates:["debugSearch"],allowEmptyValue:!0},"inspect-brk-search":{type:"string",deprecates:["debugBrkSearch"],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"},"disable-updates":{type:"boolean"},transient:{type:"boolean",cat:"t",description:p(1994,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[]"}};function ZO(r){return r.VSCODE_CLI==="1"}var eN;async function F5(r,t,e,n){return e["force-disable-user-env"]?(t.trace("resolveShellEnv(): skipped (--force-disable-user-env)"),{}):Ie?(t.trace("resolveShellEnv(): skipped (Windows)"),{}):ZO(n)&&!e["force-user-env"]?(t.trace("resolveShellEnv(): skipped (VSCODE_CLI is set)"),{}):(ZO(n)?t.trace("resolveShellEnv(): running (--force-user-env)"):t.trace("resolveShellEnv(): running (macOS/Linux)"),eN||(eN=Kr.withAsyncBody(async(o,i)=>{let s=new Ce,a=1e4,l=r.getValue("application.shellEnvironmentResolutionTimeout");typeof l=="number"&&(a=r2(l,1,120)*1e3);let d=setTimeout(()=>{s.dispose(!0),i(new Error(p(2351,null)))},a);try{o(await AQ(t,s.token))}catch(c){!Qt(c)&&!s.token.isCancellationRequested?i(new Error(p(2349,null,Io(c)))):o({})}finally{clearTimeout(d),s.dispose()}})),eN)}async function AQ(r,t){let e=process.env.ELECTRON_RUN_AS_NODE;r.trace("getUnixShellEnvironment#runAsNode",e);let n=process.env.ELECTRON_NO_ATTACH_CONSOLE;r.trace("getUnixShellEnvironment#noAttach",n);let o=Ae().replace(/-/g,"").substr(0,12),i=new RegExp(o+"({.*})"+o),s={...process.env,ELECTRON_RUN_AS_NODE:"1",ELECTRON_NO_ATTACH_CONSOLE:"1",VSCODE_RESOLVING_ENVIRONMENT:"1"};r.trace("getUnixShellEnvironment#env",s);let a=await U5(lr,s);return r.trace("getUnixShellEnvironment#shell",a),new Promise((l,d)=>{if(t.isCancellationRequested)return d(new Be);let c=nt(a),u,m,g="";/^(?:pwsh|powershell)(?:-preview)?$/.test(c)?(u=`& '${process.execPath}' ${g} -p '''${o}'' + JSON.stringify(process.env) + ''${o}'''`,m=["-Login","-Command"]):c==="nu"?(u=`^'${process.execPath}' ${g} -p '"${o}" + JSON.stringify(process.env) + "${o}"'`,m=["-i","-l","-c"]):c==="xonsh"?(u=`import os, json; print("${o}", json.dumps(dict(os.environ)), "${o}")`,m=["-i","-l","-c"]):(u=`'${process.execPath}' ${g} -p '"${o}" + JSON.stringify(process.env) + "${o}"'`,c==="tcsh"||c==="csh"?m=["-ic"]:m=["-i","-l","-c"]),r.trace("getUnixShellEnvironment#spawn",JSON.stringify(m),u);let h=RQ(a,[...m,u],{detached:!0,stdio:["ignore","pipe","pipe"],env:s});t.onCancellationRequested(()=>(h.kill(),d(new Be))),h.on("error",S=>{r.error("getUnixShellEnvironment#errorChildProcess",Io(S)),d(S)});let f=[];h.stdout.on("data",S=>f.push(S));let I=[];h.stderr.on("data",S=>I.push(S)),h.on("close",(S,T)=>{let P=Buffer.concat(f).toString("utf8");r.trace("getUnixShellEnvironment#raw",P);let L=Buffer.concat(I).toString("utf8");if(L.trim()&&r.trace("getUnixShellEnvironment#stderr",L),S||T)return d(new Error(p(2350,null,S,T)));let q=i.exec(P),N=q?q[1]:"{}";try{let B=JSON.parse(N);e?B.ELECTRON_RUN_AS_NODE=e:delete B.ELECTRON_RUN_AS_NODE,n?B.ELECTRON_NO_ATTACH_CONSOLE=n:delete B.ELECTRON_NO_ATTACH_CONSOLE,delete B.VSCODE_RESOLVING_ENVIRONMENT,delete B.XDG_RUNTIME_DIR,r.trace("getUnixShellEnvironment#result",B),l(B)}catch(B){r.error("getUnixShellEnvironment#errorCaught",Io(B)),d(B)}})})}import{parse as H5}from"url";function MQ(r,t){return r.protocol==="http:"?t.HTTP_PROXY||t.http_proxy||null:r.protocol==="https:"&&(t.HTTPS_PROXY||t.https_proxy||t.HTTP_PROXY||t.http_proxy)||null}async function W5(r,t,e={}){let n=H5(r),o=e.proxyUrl||MQ(n,t);if(!o)return null;let i=H5(o);if(!/^https?:$/.test(i.protocol||""))return null;let s={host:i.hostname||"",port:(i.port?+i.port:0)||(i.protocol==="https"?443:80),auth:i.auth,rejectUnauthorized:By(e.strictSSL)?e.strictSSL:!0};if(n.protocol==="http:"){let{default:a}=await import("http-proxy-agent");return new a.HttpProxyAgent(o,s)}else{let{default:a}=await import("https-proxy-agent");return new a.HttpsProxyAgent(o,s)}}import{createGunzip as LQ}from"zlib";var OQ=new Set(["EAI_AGAIN","ECONNREFUSED","EHOSTDOWN","EHOSTUNREACH","ENETDOWN","ENETUNREACH","EPROTO"]),NQ=/^(GET|HEAD|OPTIONS)$/i;function UQ(r){if(r instanceof Error){let t=r.code;return!!t&&OQ.has(t)}return!1}var Qk=class extends Wx{constructor(e,n,o,i){super(i);this.machine=e;this.configurationService=n;this.environmentService=o;this.configure(),this._register(n.onDidChangeConfiguration(s=>{s.affectsConfiguration("http")&&this.configure()}))}configure(){this.proxyUrl=this.getConfigValue("http.proxy"),this.strictSSL=!!this.getConfigValue("http.proxyStrictSSL"),this.authorization=this.getConfigValue("http.proxyAuthorization")}async request(e,n){let{proxyUrl:o,strictSSL:i}=this,s;try{s=await F5(this.configurationService,this.logService,this.environmentService.args,process.env)}catch(d){this.shellEnvErrorLogged||(this.shellEnvErrorLogged=!0,this.logService.error("resolving shell environment failed",Xi(d)))}let a={...process.env,...s},l=e.agent?e.agent:await W5(e.url||"",a,{proxyUrl:o,strictSSL:i});return e.agent=l,e.strictSSL=i,this.authorization&&(e.headers={...e.headers||{},"Proxy-Authorization":this.authorization}),this.logAndRequest(e,()=>B5(e,n))}async resolveProxy(e){}async lookupAuthorization(e){}async lookupKerberosAuthorization(e){try{let n=this.getConfigValue("http.proxyKerberosServicePrincipal");return"Negotiate "+await tN(e,n,this.logService,"RequestService#lookupKerberosAuthorization")}catch(n){this.logService.debug("RequestService#lookupKerberosAuthorization Kerberos authentication failed",n);return}}async loadCertificates(){return(await import("@vscode/proxy-agent")).loadSystemCertificates({loadSystemCertificatesFromNode:()=>this.getConfigValue("http.systemCertificatesNode",Wp),log:this.logService})}getConfigValue(e,n){if(this.machine==="remote")return this.configurationService.getValue(e);let o=this.configurationService.inspect(e);return o.userLocalValue??o.defaultValue??n}};Qk=_([C(1,Kt),C(2,eW),C(3,oe)],Qk);async function tN(r,t,e,n){let o=await import("kerberos"),i=o.default||o,s=new URL(r),a=t||(process.platform==="win32"?`HTTP/${s.hostname}`:`HTTP@${s.hostname}`);return e.debug(`${n} Kerberos authentication lookup`,`proxyURL:${s}`,`spn:${a}`),(await i.initializeClient(a)).step("")}async function FQ(r){return(V5(r.url).protocol==="https:"?await import("https"):await import("http")).request}async function B5(r,t){let n,o=NQ.test(r.type||"GET");for(let i=1;i<=3;i++)try{return await HQ(r,t)}catch(s){if(n=s,s instanceof Be||!o||!UQ(s)||i===3)throw s;await Ut(100*i,t)}throw n}async function HQ(r,t){return Kr.withAsyncBody(async(e,n)=>{let o=V5(r.url),i=r.getRawRequest?r.getRawRequest(r):await FQ(r),s={hostname:o.hostname,port:o.port?parseInt(o.port):o.protocol==="https:"?443:80,protocol:o.protocol,path:o.path,method:r.type||"GET",headers:r.headers,agent:r.agent,rejectUnauthorized:By(r.strictSSL)?r.strictSSL:!0};r.user&&r.password&&(s.auth=r.user+":"+r.password),r.disableCache&&(s.cache="no-store");let a=i(s,d=>{let c=Un(r.followRedirects)?r.followRedirects:3;if(d.statusCode&&d.statusCode>=300&&d.statusCode<400&&c>0&&d.headers.location)B5({...r,url:d.headers.location,followRedirects:c-1},t).then(e,n);else{let u=d;!r.isChromiumNetwork&&d.headers["content-encoding"]==="gzip"&&(u=d.pipe(LQ())),e({res:d,stream:cF(u)})}});if(a.on("error",n),r.timeout)if(r.isChromiumNetwork){let d=setTimeout(()=>{a.abort(),n(new Error(`Request timeout after ${r.timeout}ms`))},r.timeout);a.on("response",()=>clearTimeout(d)),a.on("error",()=>clearTimeout(d)),a.on("abort",()=>clearTimeout(d))}else a.setTimeout(r.timeout);r.isChromiumNetwork&&a.removeHeader("Content-Length"),r.data&&typeof r.data=="string"&&a.write(r.data),a.end();let l=t.onCancellationRequested(()=>{l.dispose(),a.abort(),n(new Be)});a.on("response",()=>l.dispose()),a.on("error",()=>l.dispose())})}import*as ja from"@vscode/proxy-agent";var Kf=$Q(import.meta.url),q5=Kf("http"),Yk=Kf("https"),Xk=Kf("tls"),K5=Kf("net"),X5=!1,j5=!1;function Z5(r,t,e,n,o,i,s){let a=i.remote.isRemote,l=i.environment.useHostProxy??!a,d=l,c=l,u=()=>!a||t.getConfiguration("http").get("useLocalProxyConfiguration",l),g={resolveProxy:ZQ(r,o),lookupProxyAuthorization:rJ.bind(void 0,r,n,o,t,{},{},i.remote.isRemote,d),getProxyURL:()=>Vr(t,a,"http.proxy"),getProxySupport:()=>Vr(t,a,"http.proxySupport")||"off",getNoProxyConfig:()=>Vr(t,a,"http.noProxy")||[],isAdditionalFetchSupportEnabled:()=>Vr(t,a,"http.fetchAdditionalSupport",!0),isWebSocketPatchEnabled:()=>Vr(t,a,"http.webSocketAdditionalSupport",!0),addCertificatesV1:()=>tJ(t,a),addCertificatesV2:()=>nJ(t,a),loadSystemCertificatesFromNode:()=>Vr(t,a,"http.systemCertificatesNode",Wp),log:n,getLogLevel:()=>{let T=n.getLevel();switch(T){case 1:return Bu.Trace;case 2:return Bu.Debug;case 3:return Bu.Info;case 4:return Bu.Warning;case 5:return Bu.Error;case 0:return Bu.Off;default:return P(T)}function P(L){return n.error("Unknown log level",L),Bu.Debug}},proxyResolveTelemetry:()=>{},isUseHostProxyEnabled:u,getNetworkInterfaceCheckInterval:()=>Vr(t,a,"http.experimental.networkInterfaceCheckInterval",300)*1e3,loadAdditionalCertificates:async()=>{let T=Vr(t,a,"http.systemCertificatesNode",Wp),P=[];if(a&&P.push(z5({loadSystemCertificatesFromNode:()=>T,log:n})),c)if(!a&&T)P.push(z5({loadSystemCertificatesFromNode:()=>T,log:n}));else{n.trace("ProxyResolver#loadAdditionalCertificates: Loading certificates from main process");let N=r.loadCertificates();N.then(B=>n.trace("ProxyResolver#loadAdditionalCertificates: Loaded certificates from main process",B.length)),P.push(N)}i.environment.extensionTestsLocationURI&&Yk.globalAgent.testCertificates?.length&&(n.trace("ProxyResolver#loadAdditionalCertificates: Loading test certificates"),P.push(Promise.resolve(Yk.globalAgent.testCertificates)));let L=(await Promise.all(P)).flat(),q=GQ(T,n);return o.$publicLog2("additionalCertificates",{count:L.length,isRemote:a,loadLocalCertificates:c,useNodeSystemCerts:T,nodeSystemCertErrors:q}),L},env:process.env},{resolveProxyWithRequest:h,resolveProxyURL:f}=WQ(g),I=ja.default||ja;I.resolveProxyURL=f,qQ(g,t,o,i,f,s),KQ(g,f);let S=eJ(g,h);return oJ(e,S)}var zQ=["content-length","host","trailer","te","upgrade","cookie2","keep-alive","transfer-encoding","set-cookie"];function qQ(r,t,e,n,o,i){if(!globalThis.__vscodeOriginalFetch){let s=globalThis.fetch;globalThis.__vscodeOriginalFetch=s;let a=ja.createFetchPatch(r,s,o);globalThis.__vscodePatchedFetch=a;let l=!1;n.remote.isRemote||(l=t.getConfiguration("http").get("electronFetch",j5),i.add(t.onDidChangeConfiguration(d=>{d.affectsConfiguration("http.electronFetch")&&(l=t.getConfiguration("http").get("electronFetch",j5))}))),globalThis.fetch=async function(c,u){function m(q){return u&&q in u?u[q]:typeof c=="object"&&"cache"in c?c[q]:void 0}let g=typeof c=="string"?c:"cache"in c?c.url:c.toString(),h=g.startsWith("data:");h&&qf(e,"data");let f=g.startsWith("blob:");f&&qf(e,"blob");let I=m("redirect")==="manual";I&&qf(e,"manualRedirect");let S=m("integrity");if(S&&qf(e,"integrity"),!l||h||f||I||S){let q=await a(c,u);return G5(e,q,g),q}if(u?.headers){let q=new Headers(u.headers);for(let N of zQ)q.delete(N);u={...u,headers:q}}let T=c instanceof URL?c.toString():c,L=await Kf("electron").net.fetch(T,u);return G5(e,L,g),L}}}function KQ(r,t){if(!globalThis.__vscodeOriginalWebSocket){let e=globalThis.WebSocket;globalThis.__vscodeOriginalWebSocket=e,globalThis.WebSocket=ja.createWebSocketPatch(r,e,t)}}function G5(r,t,e){let n=t.url;Object.defineProperty(t,"url",{get(){return qf(r,"url"),n||e}});let o=t.type;Object.defineProperty(t,"type",{get(){return qf(r,"typeProperty"),o!=="default"?o:"basic"}})}var Q5={url:0,typeProperty:0,data:0,blob:0,integrity:0,manualRedirect:0},Jk,jQ=!1;function qf(r,t){jQ&&!Q5[t]++&&(Jk&&clearTimeout(Jk),Jk=setTimeout(()=>{r.$publicLog2("fetchFeatureUse",Q5)},1e4),Jk.unref?.())}function GQ(r,t){if(!r){let e="Not using Node.js system certificates";return t.debug(`ProxyResolver#collectNodeSystemCertErrors: ${e}`),e}if(typeof Xk.getSystemCACertificatesErrors!="function"){let e="tls.getSystemCACertificatesErrors is not available";return t.debug(`ProxyResolver#collectNodeSystemCertErrors: ${e}`),e}try{let e=Xk.getSystemCACertificatesErrors();if(!e||typeof e!="object"){let i="tls.getSystemCACertificatesErrors() did not return an object";return t.debug(`ProxyResolver#collectNodeSystemCertErrors: ${i}`),i}let n=new Map;for(let[i,s]of Object.entries(e))if(Array.isArray(s))for(let a of s){let l=a.errorCode??"missing code",d=`${i}: ${JQ(a.errorMessage??"missing message")}`,c=`${d} (${l})`,u=n.get(c);u?u.count++:n.set(c,{error:d,code:l,count:1})}let o=JSON.stringify([...n.values()].sort((i,s)=>s.count-i.count));return t.trace(`ProxyResolver#collectNodeSystemCertErrors: ${o}`),o}catch(e){return t.debug("ProxyResolver#collectNodeSystemCertErrors: Failed to get certificate errors",e),`Error: ${e instanceof Error?e.message:String(e)}`}}var QQ=[["key usage flags","k usage flags"],["check dh key","check dh k"],["key type mismatch","k type mismatch"],["key values mismatch","k values mismatch"],["public key decode error","public k decode error"],["public key encode error","public k encode error"],["unable to get certs public key","unable to get certs public k"],["unknown key type","unknown k type"],["key type not supported","k type not supported"],["public key type","public k type"],["sig parse error","s parse error"],["sig invalid mime type","s invalid mime type"],["sig content type","s content type"],["signature algorithm","s algorithm"]];function JQ(r){for(let[t,e]of QQ)r=r.replaceAll(t,e);return r}var ro={count:0,totalDuration:0,minDuration:Number.MAX_SAFE_INTEGER,maxDuration:0,lastSentTime:0},YQ=3600*1e3;function XQ(r){if(ro.count>0){let t=ro.totalDuration/ro.count;r.$publicLog2("proxyResolveStats",{count:ro.count,totalDuration:ro.totalDuration,minDuration:ro.minDuration,maxDuration:ro.maxDuration,avgDuration:t}),ro.count=0,ro.totalDuration=0,ro.minDuration=Number.MAX_SAFE_INTEGER,ro.maxDuration=0}ro.lastSentTime=Date.now()}function ZQ(r,t){return async e=>{let n=performance.now();try{return await r.resolveProxy(e)}finally{let o=performance.now()-n;ro.count++,ro.totalDuration+=o,ro.minDuration=Math.min(ro.minDuration,o),ro.maxDuration=Math.max(ro.maxDuration,o),Date.now()-ro.lastSentTime>=YQ&&XQ(t)}}}function eJ(r,t){function e(n,o){let i=n.default||n;return i.__vscodeOriginal=Object.assign({},i),Object.assign(i,o)}return{http:e(q5,$5(r,q5,t)),https:e(Yk,$5(r,Yk,t)),net:e(K5,BQ(r,K5)),tls:e(Xk,VQ(r,Xk))}}function tJ(r,t){return!Vr(r,t,"http.experimental.systemCertificatesV2",X5)&&!!Vr(r,t,"http.systemCertificates")}function nJ(r,t){return!!Vr(r,t,"http.experimental.systemCertificatesV2",X5)&&!!Vr(r,t,"http.systemCertificates")}var J5=new Map;function oJ(r,t){return r.getExtensionPathIndex().then(e=>{let n=Kf("module"),o=n._load;n._load=function(s,a,l){if(s==="net")return t.net;if(s==="tls")return t.tls;if(s!=="http"&&s!=="https"&&s!=="undici")return o.apply(this,arguments);let d=e.findSubstr(b.file(a.filename)),c=J5.get(d);if(c||J5.set(d,c={}),!c[s])if(s==="undici"){let u=o.apply(this,arguments);ja.patchUndici(u),c[s]=u}else{let u=t[s];c[s]={...u}}return c[s]}})}async function rJ(r,t,e,n,o,i,s,a,l,d,c){l=l.replace(/\/+$/,"");let u=o[l];d&&(o[l]=d),t.trace("ProxyResolver#lookupProxyAuthorization callback",`proxyURL:${l}`,`proxyAuthenticate:${d}`,`proxyAuthenticateCache:${u}`);let m=d||u,g=Array.isArray(m)?m:typeof m=="string"?[m]:[];if(sJ(e,g,s),g.some(f=>/^(Negotiate|Kerberos)( |$)/i.test(f))&&!c.kerberosRequested){c.kerberosRequested=!0;try{let f=Vr(n,s,"http.proxyKerberosServicePrincipal");return"Negotiate "+await tN(l,f,t,"ProxyResolver#lookupProxyAuthorization")}catch(f){t.debug("ProxyResolver#lookupProxyAuthorization Kerberos authentication failed",f)}if(s&&a){t.debug("ProxyResolver#lookupProxyAuthorization Kerberos authentication lookup on host",`proxyURL:${l}`);let f=await r.lookupKerberosAuthorization(l);if(f)return"Negotiate "+f}}let h=g.find(f=>/^Basic( |$)/i.test(f));if(h)try{let f=i[l];if(f)if(c.basicAuthCacheUsed)t.debug("ProxyResolver#lookupProxyAuthorization Basic authentication deleting cached credentials",`proxyURL:${l}`),delete i[l];else return t.debug("ProxyResolver#lookupProxyAuthorization Basic authentication using cached credentials",`proxyURL:${l}`),c.basicAuthCacheUsed=!0,f;c.basicAuthAttempt=(c.basicAuthAttempt||0)+1;let I=/ realm="([^"]+)"/i.exec(h)?.[1];t.debug("ProxyResolver#lookupProxyAuthorization Basic authentication lookup",`proxyURL:${l}`,`realm:${I}`);let S=new URL(l),T={scheme:"basic",host:S.hostname,port:Number(S.port),realm:I||"",isProxy:!0,attempt:c.basicAuthAttempt},P=await r.lookupAuthorization(T);if(P){t.debug("ProxyResolver#lookupProxyAuthorization Basic authentication received credentials",`proxyURL:${l}`,`realm:${I}`);let L="Basic "+Buffer.from(`${P.username}:${P.password}`).toString("base64");return i[l]=L,L}else t.debug("ProxyResolver#lookupProxyAuthorization Basic authentication received no credentials",`proxyURL:${l}`,`realm:${I}`)}catch(f){t.error("ProxyResolver#lookupProxyAuthorization Basic authentication failed",f)}}var Y5=!1,iJ=!1;function sJ(r,t,e){!iJ||Y5||!t.length||(Y5=!0,r.$publicLog2("proxyAuthenticationRequest",{authenticationType:t.map(n=>n.split(" ")[0]).join(","),extensionHostType:e?"remote":"local"}))}function Vr(r,t,e,n){if(t)return r.getConfiguration().get(e)??n;let o=r.getConfiguration().inspect(e);return o?.globalLocalValue??o?.defaultValue??n}import{tmpdir as aJ}from"os";var jf=class extends O{constructor(t,e){super();let n=t.getProxy(F.MainThreadDownloadService);e.registerCommand(!1,"_workbench.downloadResource",async o=>{let i=b.file(Ne(aJ(),Ae()));return await n.$download(o,i),i})}};jf=_([C(0,se),C(1,Nn)],jf);import*as Zk from"fs";var nN=class{constructor(t,e,n){this._commands=t;this.logService=e;this._ipcHandlePath=n;this._server=void 0;this._disposed=!1;this.setup()}get ipcHandlePath(){return this._ipcHandlePath}async setup(){try{let t=await import("http");if(this._disposed)return;this._server=t.createServer((e,n)=>this.onRequest(e,n));try{this._server.listen(this.ipcHandlePath),this._server.on("error",e=>this.logService.error(e))}catch{this.logService.error("Could not start open from terminal server.")}}catch(t){this.logService.error("Error setting up CLI server",t)}}onRequest(t,e){let n=(i,s)=>{e.writeHead(i,{"content-type":"application/json"}),e.end(JSON.stringify(s||null),a=>a&&this.logService.error(a))},o=[];t.setEncoding("utf8"),t.on("data",i=>o.push(i)),t.on("end",async()=>{try{let i=JSON.parse(o.join("")),s;switch(i.type){case"open":s=await this.open(i);break;case"openExternal":s=await this.openExternal(i);break;case"status":s=await this.getStatus(i);break;case"extensionManagement":s=await this.manageExtensions(i);break;default:n(404,`Unknown message type: ${i.type}`);break}n(200,s)}catch(i){let s=i instanceof Error?i.message:JSON.stringify(i);n(500,s),this.logService.error("Error while processing pipe request",i)}})}async open(t){let{fileURIs:e,folderURIs:n,forceNewWindow:o,diffMode:i,mergeMode:s,addMode:a,removeMode:l,forceReuseWindow:d,gotoLineMode:c,waitMarkerFilePath:u,remoteAuthority:m}=t,g=[];if(Array.isArray(n))for(let S of n)try{g.push({folderUri:b.parse(S)})}catch{}if(Array.isArray(e))for(let S of e)try{g2(S)?g.push({workspaceUri:b.parse(S)}):g.push({fileUri:b.parse(S)})}catch{}let h=u?b.file(u):void 0,I={forceNewWindow:o,diffMode:i,mergeMode:s,addMode:a,removeMode:l,gotoLineMode:c,forceReuseWindow:d,preferNewWindow:!d&&!h&&!a&&!l,waitMarkerFileURI:h,remoteAuthority:m};this._commands.executeCommand("_remoteCLI.windowOpen",g,I)}async openExternal(t){for(let e of t.uris)b.parse(e).scheme!=="file"&&await this._commands.executeCommand("_remoteCLI.openExternal",e)}async manageExtensions(t){let e=o=>o?.map(i=>/\.vsix$/i.test(i)?b.parse(i):i),n={list:t.list,install:e(t.install),uninstall:e(t.uninstall),force:t.force};return await this._commands.executeCommand("_remoteCLI.manageExtensions",n)}async getStatus(t){return await this._commands.executeCommand("_remoteCLI.getSystemStatus")}dispose(){this._disposed=!0,this._server?.close(),this._ipcHandlePath&&process.platform!=="win32"&&Zk.existsSync(this._ipcHandlePath)&&Zk.unlinkSync(this._ipcHandlePath)}},Gf=class extends nN{constructor(t,e){super(t,e,RF())}};Gf=_([C(0,Nn),C(1,oe)],Gf);var Qf=class{constructor(t,e){this._mainThreadConsole=t.getProxy(F.MainThreadConsole),this._includeStack=e.consoleForward.includeStack,this._logNative=e.consoleForward.logNative,this._wrapConsoleMethod("info","log"),this._wrapConsoleMethod("log","log"),this._wrapConsoleMethod("warn","warn"),this._wrapConsoleMethod("debug","debug"),this._wrapConsoleMethod("error","error")}_wrapConsoleMethod(t,e){let n=this,o=console[t];Object.defineProperty(console,t,{set:()=>{},get:()=>(...i)=>{n._handleConsoleCall(t,e,o,i)}})}_handleConsoleCall(t,e,n,o){this._mainThreadConsole.$logExtensionHostMessage({type:"__$console",severity:e,arguments:dJ(o,this._includeStack)}),this._logNative&&this._nativeConsoleLogMessage(t,n,o)}};Qf=_([C(0,se),C(1,Ye)],Qf);var lJ=1e5;function dJ(r,t){let e=[];if(r.length)for(let n=0;n<r.length;n++){let o=r[n];if(typeof o>"u")o="undefined";else if(o instanceof Error){let i=o;i.stack?o=i.stack:o=i.toString()}e.push(o)}if(t){let n=new Error().stack;n&&e.push({__$stack:n.split(`
`).slice(3).join(`
`)})}try{let n=Y_(e);return n.length>lJ?"Output omitted for a large object that exceeds the limits":n}catch(n){return`Output omitted for an object that cannot be inspected ('${n.toString()}')`}}var cJ=1024*1024,Jf=class extends Qf{constructor(e,n){super(e,n);this._isMakingConsoleCall=!1;this._wrapStream("stderr","error"),this._wrapStream("stdout","log")}_nativeConsoleLogMessage(e,n,o){let i=e==="error"||e==="warn"?process.stderr:process.stdout;this._isMakingConsoleCall=!0,i.write(`
START_NATIVE_LOG
`),n.apply(console,o),i.write(`
END_NATIVE_LOG
`),this._isMakingConsoleCall=!1}_wrapStream(e,n){let o=process[e],i=o.write,s="";Object.defineProperty(o,"write",{set:()=>{},get:()=>(a,l,d)=>{if(!this._isMakingConsoleCall){s+=a.toString(l);let c=s.length>cJ?s.length:s.lastIndexOf(`
`);c!==-1&&(console[n](s.slice(0,c)),s=s.slice(c+1))}i.call(o,a,l,d)}})}};Jf=_([C(0,se),C(1,Ye)],Jf);import{constants as rN,promises as $u}from"fs";async function e$(r,t,e,n,o,i){let s;try{await uJ(r,t,e,n,o,i)}catch(a){s=a}finally{s&&o.errorTransformer&&(s=o.errorTransformer(s)),typeof s<"u"&&e.error(s),e.end()}}async function uJ(r,t,e,n,o,i){oN(i);let s=await r.open(t,{create:!1});try{oN(i);let a=0,l=0,d=o&&typeof o.length=="number"?o.length:void 0,c=H.alloc(Math.min(o.bufferSize,typeof d=="number"?d:o.bufferSize)),u=o&&typeof o.position=="number"?o.position:0,m=0;do l=await r.read(s,u,c.buffer,m,c.byteLength-m),u+=l,m+=l,a+=l,typeof d=="number"&&(d-=l),m===c.byteLength&&(await e.write(n(c)),c=H.alloc(Math.min(o.bufferSize,typeof d=="number"?d:o.bufferSize)),m=0);while(l>0&&(typeof d!="number"||d>0)&&oN(i)&&pJ(a,o));if(m>0){let g=m;typeof d=="number"&&(g=Math.min(m,d)),e.write(n(c.slice(0,g)))}}catch(a){throw s2(a)}finally{await r.close(s)}}function oN(r){if(r.isCancellationRequested)throw Ys();return!0}function pJ(r,t){if(typeof t?.limits?.size=="number"&&r>t.limits.size)throw Si(p(2158,null),"EntryTooLarge");return!0}var eP=class extends O{constructor(e,n){super();this.logService=e;this.options=n;this._onDidChangeFile=this._register(new E);this.onDidChangeFile=this._onDidChangeFile.event;this._onDidWatchError=this._register(new E);this.onDidWatchError=this._onDidWatchError.event;this.universalWatchRequests=[];this.universalWatchRequestDelayer=this._register(new vi(this.getRefreshWatchersDelay(this.universalWatchRequests.length)));this.nonRecursiveWatchRequests=[];this.nonRecursiveWatchRequestDelayer=this._register(new vi(this.getRefreshWatchersDelay(this.nonRecursiveWatchRequests.length)))}watch(e,n){return n.recursive||this.options?.watcher?.forceUniversal?this.watchUniversal(e,n):this.watchNonRecursive(e,n)}getRefreshWatchersDelay(e){return e>200?500:0}watchUniversal(e,n){let o=this.toWatchRequest(e,n),i=RP(this.universalWatchRequests,o);return this.refreshUniversalWatchers(),K(()=>{i(),this.refreshUniversalWatchers()})}toWatchRequest(e,n){let o={path:this.toWatchPath(e),excludes:n.excludes,includes:n.includes,recursive:n.recursive,filter:n.filter,correlationId:n.correlationId};if(MB(o)){let i=this.options?.watcher?.recursive?.usePolling;i===!0?o.pollingInterval=this.options?.watcher?.recursive?.pollingInterval??5e3:Array.isArray(i)&&i.includes(o.path)&&(o.pollingInterval=this.options?.watcher?.recursive?.pollingInterval??5e3)}return o}refreshUniversalWatchers(){this.universalWatchRequestDelayer.trigger(()=>this.doRefreshUniversalWatchers(),this.getRefreshWatchersDelay(this.universalWatchRequests.length)).catch(e=>ze(e))}doRefreshUniversalWatchers(){return this.universalWatcher||(this.universalWatcher=this._register(this.createUniversalWatcher(e=>this._onDidChangeFile.fire(zL(e)),e=>this.onWatcherLogMessage(e),this.logService.getLevel()===1)),this._register(this.logService.onDidChangeLogLevel(()=>{this.universalWatcher?.setVerboseLogging(this.logService.getLevel()===1)}))),this.universalWatcher.watch(this.universalWatchRequests)}watchNonRecursive(e,n){let o={path:this.toWatchPath(e),excludes:n.excludes,includes:n.includes,recursive:!1,filter:n.filter,correlationId:n.correlationId},i=RP(this.nonRecursiveWatchRequests,o);return this.refreshNonRecursiveWatchers(),K(()=>{i(),this.refreshNonRecursiveWatchers()})}refreshNonRecursiveWatchers(){this.nonRecursiveWatchRequestDelayer.trigger(()=>this.doRefreshNonRecursiveWatchers(),this.getRefreshWatchersDelay(this.nonRecursiveWatchRequests.length)).catch(e=>ze(e))}doRefreshNonRecursiveWatchers(){return this.nonRecursiveWatcher||(this.nonRecursiveWatcher=this._register(this.createNonRecursiveWatcher(e=>this._onDidChangeFile.fire(zL(e)),e=>this.onWatcherLogMessage(e),this.logService.getLevel()===1)),this._register(this.logService.onDidChangeLogLevel(()=>{this.nonRecursiveWatcher?.setVerboseLogging(this.logService.getLevel()===1)}))),this.nonRecursiveWatcher.watch(this.nonRecursiveWatchRequests)}onWatcherLogMessage(e){e.type==="error"&&this._onDidWatchError.fire(e.message),this.logWatcherMessage(e)}logWatcherMessage(e){this.logService[e.type](e.message)}toFilePath(e){return bo(e.fsPath)}toWatchPath(e){let n=this.toFilePath(e);return HU(n)}};import{fork as fJ}from"child_process";function t$(r){let t=r;return t&&typeof t.type=="string"&&typeof t.severity=="string"}function mJ(r){let t=[],e;try{let n=JSON.parse(r.arguments),o=n[n.length-1];o&&o.__$stack&&(n.pop(),e=o.__$stack),t.push(...n)}catch{t.push("Unable to log remote console arguments",r.arguments)}return{args:t,stack:e}}function gJ(r){if(!r)return r;let t=r.indexOf(`
`);return t===-1?r:r.substring(0,t)}function n$(r,t){let{args:e,stack:n}=mJ(r),o=typeof e[0]=="string"&&e.length===1,i=gJ(n);i&&(i=`(${i.trim()})`);let s=[];if(typeof e[0]=="string"?i&&o?s=[`%c[${t}] %c${e[0]} %c${i}`,Yf("blue"),Yf(""),Yf("grey")]:s=[`%c[${t}] %c${e[0]}`,Yf("blue"),Yf(""),...e.slice(1)]:s=[`%c[${t}]%`,Yf("blue"),...e],i&&!o&&s.push(i),typeof console[r.severity]!="function")throw new Error("Unknown console method");console[r.severity].apply(console,s)}function Yf(r){return`color: ${r}`}var tP=class{constructor(t,e){this.modulePath=t;this.options=e;this.activeRequests=new Set;this.channels=new Map;this._onDidProcessExit=new E;this.onDidProcessExit=this._onDidProcessExit.event;let n=e.timeout||6e4;this.disposeDelayer=new yh(n),this.child=null,this._client=null}getChannel(t){let e=this;return{call(n,o,i){return e.requestPromise(t,n,o,i)},listen(n,o){return e.requestEvent(t,n,o)}}}requestPromise(t,e,n,o=ve.None){if(!this.disposeDelayer)return Promise.reject(new Error("disposed"));if(o.isCancellationRequested)return Promise.reject(Ys());this.disposeDelayer.cancel();let i=this.getCachedChannel(t),s=fr(d=>i.call(e,n,d)),a=o.onCancellationRequested(()=>s.cancel()),l=K(()=>s.cancel());return this.activeRequests.add(l),s.finally(()=>{a.dispose(),this.activeRequests.delete(l),this.activeRequests.size===0&&this.disposeDelayer&&this.disposeDelayer.trigger(()=>this.disposeClient())}),s}requestEvent(t,e,n){if(!this.disposeDelayer)return he.None;this.disposeDelayer.cancel();let o,i=new E({onWillAddFirstListener:()=>{o=this.getCachedChannel(t).listen(e,n)(i.fire,i),this.activeRequests.add(o)},onDidRemoveLastListener:()=>{this.activeRequests.delete(o),o.dispose(),this.activeRequests.size===0&&this.disposeDelayer&&this.disposeDelayer.trigger(()=>this.disposeClient())}});return i.event}get client(){if(!this._client){let t=this.options.args||[],e=Object.create(null);e.env={...at(process.env),VSCODE_PARENT_PID:String(process.pid)},this.options.env&&(e.env={...e.env,...this.options.env}),this.options.freshExecArgv&&(e.execArgv=[]),typeof this.options.debug=="number"&&(e.execArgv=["--nolazy","--inspect="+this.options.debug]),typeof this.options.debugBrk=="number"&&(e.execArgv=["--nolazy","--inspect-brk="+this.options.debugBrk]),e.execArgv===void 0&&(e.execArgv=process.execArgv.filter(u=>!/^--inspect(-brk)?=/.test(u)).filter(u=>!u.startsWith("--vscode-"))),$V(e.env),this.child=fJ(this.modulePath,t,e);let n=new E,i=he.fromNodeEventEmitter(this.child,"message",u=>u)(u=>{if(t$(u)){n$(u,`IPC Library: ${this.options.serverName}`);return}n.fire(H.wrap(Buffer.from(u,"base64")))}),s=this.options.useQueue?qV(this.child):this.child,a=u=>this.child?.connected&&s.send(u.buffer.toString("base64")),l=n.event,d={send:a,onMessage:l};this._client=new _h(d);let c=()=>this.disposeClient();process.once("exit",c),this.child.on("error",u=>console.warn('IPC "'+this.options.serverName+'" errored with '+u)),this.child.on("exit",(u,m)=>{process.removeListener("exit",c),i.dispose(),this.activeRequests.forEach(g=>Cn(g)),this.activeRequests.clear(),u!==0&&m!=="SIGTERM"&&console.warn('IPC "'+this.options.serverName+'" crashed with exit code '+u+" and signal "+m),this.disposeDelayer?.cancel(),this.disposeClient(),this._onDidProcessExit.fire({code:u,signal:m})})}return this._client}getCachedChannel(t){let e=this.channels.get(t);return e||(e=this.client.getChannel(t),this.channels.set(t,e)),e}disposeClient(){this._client&&(this.child&&(this.child.kill(),this.child=null),this._client=null,this.channels.clear())}dispose(){this._onDidProcessExit.dispose(),this.disposeDelayer?.cancel(),this.disposeDelayer=void 0,this.disposeClient(),this.activeRequests.clear()}};var nP=class extends pw{constructor(t,e,n){super(t,e,n),this.init()}createWatcher(t){let e=t.add(new tP(ul.asFileUri("bootstrap-fork").fsPath,{serverName:"File Watcher",args:["--type=fileWatcher"],env:{VSCODE_ESM_ENTRYPOINT:"vs/platform/files/node/watcher/watcherMain",VSCODE_PIPE_LOGGING:"true",VSCODE_VERBOSE_LOGGING:"true"}}));return t.add(e.onDidProcessExit(({code:n,signal:o})=>this.onError(`terminated by itself with code ${n}, signal: ${o} (ETERM)`))),V_.toService(kF(e.getChannel("watcher")))}};import{watchFile as hJ,unwatchFile as vJ}from"fs";var oP=class extends O{constructor(){super();this._onDidChangeFile=this._register(new E);this.onDidChangeFile=this._onDidChangeFile.event;this._onDidLogMessage=this._register(new E);this.onDidLogMessage=this._onDidLogMessage.event;this._onDidWatchFail=this._register(new E);this.onDidWatchFail=this._onDidWatchFail.event;this.correlatedWatchRequests=new Map;this.nonCorrelatedWatchRequests=new Map;this.suspendedWatchRequests=this._register(new Fn);this.suspendedWatchRequestsWithPolling=new Set;this.updateWatchersDelayer=this._register(new vi(this.getUpdateWatchersDelay()));this.suspendedWatchRequestPollingInterval=5007;this.joinWatch=new Jt;this.verboseLogging=!1;this._register(this.onDidWatchFail(e=>this.suspendWatchRequest({id:this.computeId(e),correlationId:this.isCorrelated(e)?e.correlationId:void 0,path:e.path})))}isCorrelated(e){return mw(e)}computeId(e){return this.isCorrelated(e)?e.correlationId:Gn(e)}async watch(e){this.joinWatch.isSettled||this.joinWatch.complete(),this.joinWatch=new Jt;try{this.correlatedWatchRequests.clear(),this.nonCorrelatedWatchRequests.clear();for(let n of e)this.isCorrelated(n)?this.correlatedWatchRequests.set(n.correlationId,n):this.nonCorrelatedWatchRequests.set(this.computeId(n),n);for(let[n]of this.suspendedWatchRequests)!this.nonCorrelatedWatchRequests.has(n)&&!this.correlatedWatchRequests.has(n)&&(this.suspendedWatchRequests.deleteAndDispose(n),this.suspendedWatchRequestsWithPolling.delete(n));return await this.updateWatchers(!1)}finally{this.joinWatch.complete()}}updateWatchers(e){let n=[];for(let[o,i]of[...this.nonCorrelatedWatchRequests,...this.correlatedWatchRequests])this.suspendedWatchRequests.has(o)||n.push(i);return this.updateWatchersDelayer.trigger(()=>this.doWatch(n),e?this.getUpdateWatchersDelay():0).catch(o=>ze(o))}getUpdateWatchersDelay(){return 800}isSuspended(e){let n=this.computeId(e);return this.suspendedWatchRequestsWithPolling.has(n)?"polling":this.suspendedWatchRequests.has(n)}async suspendWatchRequest(e){if(this.suspendedWatchRequests.has(e.id))return;let n=new $;this.suspendedWatchRequests.set(e.id,n),await this.joinWatch.p,!n.isDisposed&&(this.monitorSuspendedWatchRequest(e,n),this.updateWatchers(!0))}resumeWatchRequest(e){this.suspendedWatchRequests.deleteAndDispose(e.id),this.suspendedWatchRequestsWithPolling.delete(e.id),this.updateWatchers(!1)}monitorSuspendedWatchRequest(e,n){this.doMonitorWithExistingWatcher(e,n)?(this.trace(`reusing an existing recursive watcher to monitor ${e.path}`),this.suspendedWatchRequestsWithPolling.delete(e.id)):(this.doMonitorWithNodeJS(e,n),this.suspendedWatchRequestsWithPolling.add(e.id))}doMonitorWithExistingWatcher(e,n){let o=this.recursiveWatcher?.subscribe(e.path,(i,s)=>{n.isDisposed||(i?this.monitorSuspendedWatchRequest(e,n):s?.type===1&&this.onMonitoredPathAdded(e))});return o?(n.add(o),!0):!1}doMonitorWithNodeJS(e,n){let o=!1,i=(s,a)=>{if(n.isDisposed)return;let l=this.isPathNotFound(s),d=this.isPathNotFound(a),c=o;o=l,!l&&(d||c)&&this.onMonitoredPathAdded(e)};this.trace(`starting fs.watchFile() on ${e.path} (correlationId: ${e.correlationId})`);try{hJ(e.path,{persistent:!1,interval:this.suspendedWatchRequestPollingInterval},i)}catch(s){this.warn(`fs.watchFile() failed with error ${s} on path ${e.path} (correlationId: ${e.correlationId})`)}n.add(K(()=>{this.trace(`stopping fs.watchFile() on ${e.path} (correlationId: ${e.correlationId})`);try{vJ(e.path,i)}catch(s){this.warn(`fs.unwatchFile() failed with error ${s} on path ${e.path} (correlationId: ${e.correlationId})`)}}))}onMonitoredPathAdded(e){this.trace(`detected ${e.path} exists again, resuming watcher (correlationId: ${e.correlationId})`);let n={resource:b.file(e.path),type:1,cId:e.correlationId};this._onDidChangeFile.fire([n]),this.traceEvent(n,e),this.resumeWatchRequest(e)}isPathNotFound(e){return e.ctimeMs===0&&e.ino===0}async stop(){this.suspendedWatchRequests.clearAndDisposeAll(),this.suspendedWatchRequestsWithPolling.clear()}traceEvent(e,n){if(this.verboseLogging){let o=` >> normalized ${e.type===1?"[ADDED]":e.type===2?"[DELETED]":"[CHANGED]"} ${e.resource.fsPath}`;this.traceWithCorrelation(o,n)}}traceWithCorrelation(e,n){this.verboseLogging&&this.trace(`${e}${typeof n.correlationId=="number"?` <${n.correlationId}> `:""}`)}requestToString(e){return`${e.path} (excludes: ${e.excludes.length>0?e.excludes:"<none>"}, includes: ${e.includes&&e.includes.length>0?JSON.stringify(e.includes):"<all>"}, filter: ${NB(e.filter)}, correlationId: ${typeof e.correlationId=="number"?e.correlationId:"<none>"})`}async setVerboseLogging(e){this.verboseLogging=e}};import{watch as bJ,promises as yJ}from"fs";var rP=class r extends O{constructor(e,n,o,i,s,a){super();this.request=e;this.recursiveWatcher=n;this.onDidFilesChange=o;this.onDidWatchFail=i;this.onLogMessage=s;this.verboseLogging=a;this.throttledFileChangesEmitter=this._register(new up({maxWorkChunkSize:100,throttleDelay:200,maxBufferedWork:1e4},e=>this.onDidFilesChange(e)));this.fileChangesAggregator=this._register(new TI(e=>this.handleFileChanges(e),r.FILE_CHANGES_HANDLER_DELAY));this.cts=new Ce;this.realPath=new mt(async()=>{let e=this.request.path;try{e=await st.realpath(this.request.path),this.request.path!==e&&this.trace(`correcting a path to watch that seems to be a symbolic link (original: ${this.request.path}, real: ${e})`)}catch{}return e});this._isReusingRecursiveWatcher=!1;this.didFail=!1;let l=!Qe;this.excludes=KL(this.request.path,this.request.excludes,l),this.includes=this.request.includes?KL(this.request.path,this.request.includes,l):void 0,this.filter=mw(this.request)?this.request.filter:void 0,this.ready=this.watch()}static{this.FILE_DELETE_HANDLER_DELAY=100}static{this.FILE_CHANGES_HANDLER_DELAY=75}get isReusingRecursiveWatcher(){return this._isReusingRecursiveWatcher}get failed(){return this.didFail}async watch(){try{let e=await yJ.stat(this.request.path);if(this.cts.token.isCancellationRequested)return;this._register(await this.doWatch(e.isDirectory()))}catch(e){e.code!=="ENOENT"?this.error(e):this.trace(`ignoring a path for watching who's stat info failed to resolve: ${this.request.path} (error: ${e})`),this.notifyWatchFailed()}}notifyWatchFailed(){this.didFail=!0,this.onDidWatchFail?.()}async doWatch(e){let n=new $;return this.doWatchWithExistingWatcher(e,n)?(this.trace(`reusing an existing recursive watcher for ${this.request.path}`),this._isReusingRecursiveWatcher=!0):(this._isReusingRecursiveWatcher=!1,await this.doWatchWithNodeJS(e,n)),n}doWatchWithExistingWatcher(e,n){if(e)return!1;let o=b.file(this.request.path),i=this.recursiveWatcher?.subscribe(this.request.path,async(s,a)=>{n.isDisposed||(s?await ZN(this.doWatch(e),n):a&&(typeof a.cId=="number"||typeof this.request.correlationId=="number")&&this.onFileChange({resource:o,type:a.type,cId:this.request.correlationId},!0))});return i?(n.add(i),!0):!1}async doWatchWithNodeJS(e,n){let o=await this.realPath.value;if(this.cts.token.isCancellationRequested)return;if(pt&&_r(o,"/Volumes/",!0)){this.error(`Refusing to watch ${o} for changes using fs.watch() for possibly being a network share where watching is unreliable and unstable.`);return}let i=new Ce(this.cts.token);n.add(K(()=>i.dispose(!0)));let s=new $;n.add(s);try{let a=b.file(this.request.path),l=nt(o),d=bJ(o);s.add(K(()=>{d.removeAllListeners(),d.close()})),this.trace(`Started watching: '${o}'`);let c=new Set;if(e)try{for(let m of await st.readdir(o))c.add(m)}catch(m){this.error(m)}if(i.token.isCancellationRequested)return;let u=new Map;s.add(K(()=>{for(let[,m]of u)m.dispose();u.clear()})),d.on("error",(m,g)=>{i.token.isCancellationRequested||(this.error(`Failed to watch ${o} for changes using fs.watch() (${m}, ${g})`),this.notifyWatchFailed())}),d.on("change",(m,g)=>{if(i.token.isCancellationRequested)return;this.verboseLogging&&this.traceWithCorrelation(`[raw] ["${m}"] ${g}`);let h="";if(g&&(h=g.toString(),pt&&(h=oc(h))),!(!h||m!=="change"&&m!=="rename"))if(e)if(m==="rename"){u.get(h)?.dispose();let f=setTimeout(async()=>{if(u.delete(h),ap(h,l,!Qe)&&!await st.exists(o)){this.onWatchedPathDeleted(a);return}if(i.token.isCancellationRequested)return;let I=await this.existsChildStrictCase(Ne(o,h));if(i.token.isCancellationRequested)return;let S;I?c.has(h)?S=0:(S=1,c.add(h)):(c.delete(h),S=2),this.onFileChange({resource:Et(a,h),type:S,cId:this.request.correlationId})},r.FILE_DELETE_HANDLER_DELAY);u.set(h,K(()=>clearTimeout(f)))}else{let f;c.has(h)?f=0:(f=1,c.add(h)),this.onFileChange({resource:Et(a,h),type:f,cId:this.request.correlationId})}else if(m==="rename"||!ap(h,l,!Qe)){let f=setTimeout(async()=>{let I=await st.exists(o);i.token.isCancellationRequested||(I?(this.onFileChange({resource:a,type:0,cId:this.request.correlationId},!0),s.add(await this.doWatch(!1))):this.onWatchedPathDeleted(a))},r.FILE_DELETE_HANDLER_DELAY);s.clear(),s.add(K(()=>clearTimeout(f)))}else this.onFileChange({resource:a,type:0,cId:this.request.correlationId},!0)})}catch(a){if(i.token.isCancellationRequested)return;this.error(`Failed to watch ${o} for changes using fs.watch() (${a.toString()})`),this.notifyWatchFailed()}}onWatchedPathDeleted(e){this.warn("Watcher shutdown because watched path got deleted"),this.onFileChange({resource:e,type:2,cId:this.request.correlationId},!0),this.fileChangesAggregator.flush(),this.notifyWatchFailed()}onFileChange(e,n=!1){this.cts.token.isCancellationRequested||(this.verboseLogging&&this.traceWithCorrelation(`${e.type===1?"[ADDED]":e.type===2?"[DELETED]":"[CHANGED]"} ${e.resource.fsPath}`),!n&&this.excludes.some(o=>o(e.resource.fsPath))?this.verboseLogging&&this.traceWithCorrelation(` >> ignored (excluded) ${e.resource.fsPath}`):!n&&this.includes&&this.includes.length>0&&!this.includes.some(o=>o(e.resource.fsPath))?this.verboseLogging&&this.traceWithCorrelation(` >> ignored (not included) ${e.resource.fsPath}`):this.fileChangesAggregator.work(e))}handleFileChanges(e){let n=LB(e),o=[];for(let s of n){if(OB(s,this.filter)){this.verboseLogging&&this.traceWithCorrelation(` >> ignored (filtered) ${s.resource.fsPath}`);continue}o.push(s)}if(o.length===0)return;if(this.verboseLogging)for(let s of o)this.traceWithCorrelation(` >> normalized ${s.type===1?"[ADDED]":s.type===2?"[DELETED]":"[CHANGED]"} ${s.resource.fsPath}`);this.throttledFileChangesEmitter.work(o)?this.throttledFileChangesEmitter.pending>0&&this.trace(`started throttling events due to large amount of file change events at once (pending: ${this.throttledFileChangesEmitter.pending}, most recent change: ${o[0].resource.fsPath}). Use 'files.watcherExclude' setting to exclude folders with lots of changing files (e.g. compilation output).`):this.warn(`started ignoring events due to too many file change events at once (incoming: ${o.length}, most recent change: ${o[0].resource.fsPath}). Use 'files.watcherExclude' setting to exclude folders with lots of changing files (e.g. compilation output).`)}async existsChildStrictCase(e){if(Qe)return st.exists(e);try{let n=nt(e);return(await st.readdir(cn(e))).some(i=>i===n)}catch(n){return this.trace(n),!1}}setVerboseLogging(e){this.verboseLogging=e}error(e){this.cts.token.isCancellationRequested||this.onLogMessage?.({type:"error",message:`[File Watcher (node.js)] ${e}`})}warn(e){this.cts.token.isCancellationRequested||this.onLogMessage?.({type:"warn",message:`[File Watcher (node.js)] ${e}`})}trace(e){!this.cts.token.isCancellationRequested&&this.verboseLogging&&this.onLogMessage?.({type:"trace",message:`[File Watcher (node.js)] ${e}`})}traceWithCorrelation(e){!this.cts.token.isCancellationRequested&&this.verboseLogging&&this.trace(`${e}${typeof this.request.correlationId=="number"?` <${this.request.correlationId}> `:""}`)}dispose(){this.cts.dispose(!0),super.dispose()}};var iP=class extends oP{constructor(e){super();this.recursiveWatcher=e;this.onDidError=he.None;this._watchers=new Map;this.worker=this._register(new sn)}get watchers(){return this._watchers.values()}async doWatch(e){e=this.removeDuplicateRequests(e);let n=[],o=new Set(Array.from(this.watchers));for(let i of e){let s=this._watchers.get(this.requestToWatcherKey(i));s&&OA(s.request.excludes,i.excludes)&&OA(s.request.includes,i.includes)?o.delete(s):n.push(i)}n.length&&this.trace(`Request to start watching: ${n.map(i=>this.requestToString(i)).join(",")}`),o.size&&this.trace(`Request to stop watching: ${Array.from(o).map(i=>this.requestToString(i.request)).join(",")}`),this.worker.clear();for(let i of o)this.stopWatching(i);this.createWatchWorker().work(n)}createWatchWorker(){return this.worker.value=new up({maxWorkChunkSize:100,throttleDelay:100,maxBufferedWork:Number.MAX_VALUE},e=>{for(let n of e)this.startWatching(n)}),this.worker.value}requestToWatcherKey(e){return typeof e.correlationId=="number"?e.correlationId:this.pathToWatcherKey(e.path)}pathToWatcherKey(e){return Qe?e:e.toLowerCase()}startWatching(e){let n=new rP(e,this.recursiveWatcher,i=>this._onDidChangeFile.fire(i),()=>this._onDidWatchFail.fire(e),i=>this._onDidLogMessage.fire(i),this.verboseLogging),o={request:e,instance:n};this._watchers.set(this.requestToWatcherKey(e),o)}async stop(){await super.stop();for(let e of this.watchers)this.stopWatching(e)}stopWatching(e){this.trace("stopping file watcher",e),this._watchers.delete(this.requestToWatcherKey(e.request)),e.instance.dispose()}removeDuplicateRequests(e){let n=new Map;for(let o of e){let i=n.get(o.correlationId);i||(i=new Map,n.set(o.correlationId,i));let s=this.pathToWatcherKey(o.path);i.has(s)&&this.trace(`ignoring a request for watching who's path is already watched: ${this.requestToString(o)}`),i.set(s,o)}return Array.from(n.values()).flatMap(o=>Array.from(o.values()))}async setVerboseLogging(e){super.setVerboseLogging(e);for(let n of this.watchers)n.instance.setVerboseLogging(e)}trace(e,n){this.verboseLogging&&this._onDidLogMessage.fire({type:"trace",message:this.toMessage(e,n)})}warn(e){this._onDidLogMessage.fire({type:"warn",message:this.toMessage(e)})}toMessage(e,n){return n?`[File Watcher (node.js)] ${e} (${this.requestToString(n.request)})`:`[File Watcher (node.js)] ${e}`}};var sP=class extends uw{constructor(t,e,n){super(t,e,n),this.init()}createWatcher(t){return t.add(new iP(void 0))}};var aP=class r extends eP{constructor(){super(...arguments);this.onDidChangeCapabilities=he.None;this.resourceLocks=new Ke(e=>tc.getComparisonKey(e));this.mapHandleToPos=new Map;this.mapHandleToLock=new Map;this.writeHandles=new Map}static{this.TRACE_LOG_RESOURCE_LOCKS=!1}get capabilities(){return this._capabilities||(this._capabilities=1040414,Qe&&(this._capabilities|=1024)),this._capabilities}async stat(e){try{let{stat:n,symbolicLink:o}=await Mo.stat(this.toFilePath(e)),i;return(n.mode&128)===0&&(i=2),(n.mode&rN.S_IXUSR||n.mode&rN.S_IXGRP||n.mode&rN.S_IXOTH)&&(i=(i??0)|4),{type:this.toType(n,o),ctime:n.birthtime.getTime(),mtime:n.mtime.getTime(),size:n.size,permissions:i}}catch(n){throw this.toFileSystemProviderError(n)}}async statIgnoreError(e){try{return await this.stat(e)}catch{return}}async realpath(e){let n=this.toFilePath(e);return st.realpath(n)}async readdir(e){try{let n=await st.readdir(this.toFilePath(e),{withFileTypes:!0}),o=[];return await Promise.all(n.map(async i=>{try{let s;i.isSymbolicLink()?s=(await this.stat(Et(e,i.name))).type:s=this.toType(i),o.push([i.name,s])}catch(s){this.logService.trace(s)}})),o}catch(n){throw this.toFileSystemProviderError(n)}}toType(e,n){let o;return n?.dangling?o=0:e.isFile()?o=1:e.isDirectory()?o=2:o=0,n&&(o|=64),o}async createResourceLock(e){let n=this.toFilePath(e);this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - request to acquire resource lock (${n})`);let o;for(;o=this.resourceLocks.get(e);)this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - waiting for resource lock to be released (${n})`),await o.wait();let i=new In;return this.resourceLocks.set(e,i),this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - new resource lock created (${n})`),K(()=>{this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - resource lock dispose() (${n})`),this.resourceLocks.get(e)===i&&(this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - resource lock removed from resource-lock map (${n})`),this.resourceLocks.delete(e)),this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - resource lock barrier open() (${n})`),i.open()})}async readFile(e,n){let o;try{n?.atomic&&(this.traceLock(`[Disk FileSystemProvider]: atomic read operation started (${this.toFilePath(e)})`),o=await this.createResourceLock(e));let i=this.toFilePath(e);return await $u.readFile(i)}catch(i){throw this.toFileSystemProviderError(i)}finally{o?.dispose()}}traceLock(e){r.TRACE_LOG_RESOURCE_LOCKS&&this.logService.trace(e)}readFileStream(e,n,o){let i=nc(s=>H.concat(s.map(a=>H.wrap(a))).buffer);return e$(this,e,i,s=>s.buffer,{...n,bufferSize:256*1024},o),i}async writeFile(e,n,o){return o?.atomic!==!1&&o?.atomic?.postfix&&await this.canWriteFileAtomic(e)?this.doWriteFileAtomic(e,Et(Go(e),`${Tt(e)}${o.atomic.postfix}`),n,o):this.doWriteFile(e,n,o)}async canWriteFileAtomic(e){try{let n=this.toFilePath(e),{symbolicLink:o}=await Mo.stat(n);if(o)return!1}catch{}return!0}async doWriteFileAtomic(e,n,o,i){let s=new $;try{s.add(await this.createResourceLock(e)),s.add(await this.createResourceLock(n)),await this.doWriteFile(n,o,{...i,create:!0,overwrite:!0},!0);try{await this.rename(n,e,{overwrite:!0})}catch(a){try{await this.delete(n,{recursive:!1,useTrash:!1,atomic:!1})}catch{}throw a}}finally{s.dispose()}}async doWriteFile(e,n,o,i){let s;try{let a=this.toFilePath(e);if(!o.create||!o.overwrite){if(await st.exists(a)){if(!o.overwrite)throw Si(p(2163,null),"EntryExists")}else if(!o.create)throw Si(p(2166,null),"EntryNotFound")}s=await this.open(e,{create:!0,append:o.append,unlock:o.unlock},i),await this.write(s,0,n,0,n.byteLength)}catch(a){throw await this.toFileSystemProviderWriteError(e,a)}finally{typeof s=="number"&&await this.close(s)}}static{this.canFlush=!0}static configureFlushOnWrite(e){r.canFlush=e}async open(e,n,o){let i=this.toFilePath(e),s;mc(n)&&!o&&(s=await this.createResourceLock(e));let a;try{if(mc(n)&&n.unlock)try{let{stat:l}=await Mo.stat(i);l.mode&128||await $u.chmod(i,l.mode|128)}catch(l){l.code!=="ENOENT"&&this.logService.trace(l)}if(Ie&&mc(n)&&!n.append)try{a=await st.open(i,"r+"),await st.ftruncate(a,0)}catch(l){if(l.code!=="ENOENT"&&this.logService.trace(l),typeof a=="number"){try{await st.close(a)}catch(d){this.logService.trace(d)}a=void 0}}typeof a!="number"&&(a=await st.open(i,mc(n)?n.append?"a":"w":"r"))}catch(l){throw s?.dispose(),mc(n)?await this.toFileSystemProviderWriteError(e,l):this.toFileSystemProviderError(l)}if(this.mapHandleToPos.set(a,0),mc(n)&&this.writeHandles.set(a,e),s){let l=this.mapHandleToLock.get(a);this.traceLock(`[Disk FileSystemProvider]: open() - storing lock for handle ${a} (${i})`),this.mapHandleToLock.set(a,s),l&&(this.traceLock(`[Disk FileSystemProvider]: open() - disposing a previous lock that was still stored on same handle ${a} (${i})`),l.dispose())}return a}async close(e){let n=this.mapHandleToLock.get(e);try{if(this.mapHandleToPos.delete(e),this.writeHandles.delete(e)&&r.canFlush)try{await st.fdatasync(e)}catch(o){r.configureFlushOnWrite(!1),this.logService.error(o)}return await st.close(e)}catch(o){throw this.toFileSystemProviderError(o)}finally{n&&(this.mapHandleToLock.get(e)===n&&(this.traceLock(`[Disk FileSystemProvider]: close() - resource lock removed from handle-lock map ${e}`),this.mapHandleToLock.delete(e)),this.traceLock(`[Disk FileSystemProvider]: close() - disposing lock for handle ${e}`),n.dispose())}}async read(e,n,o,i,s){let a=this.normalizePos(e,n),l=null;try{l=(await st.read(e,o,i,s,a)).bytesRead}catch(d){throw this.toFileSystemProviderError(d)}finally{this.updatePos(e,a,l)}return l}normalizePos(e,n){return n===this.mapHandleToPos.get(e)?null:n}updatePos(e,n,o){let i=this.mapHandleToPos.get(e);typeof i=="number"&&(typeof n=="number"||(typeof o=="number"?this.mapHandleToPos.set(e,i+o):this.mapHandleToPos.delete(e)))}async write(e,n,o,i,s){return eF(()=>this.doWrite(e,n,o,i,s),100,3)}async doWrite(e,n,o,i,s){let a=this.normalizePos(e,n),l=null;try{l=(await st.write(e,o,i,s,a)).bytesWritten}catch(d){throw await this.toFileSystemProviderWriteError(this.writeHandles.get(e),d)}finally{this.updatePos(e,a,l)}return l}async mkdir(e){try{await $u.mkdir(this.toFilePath(e))}catch(n){throw this.toFileSystemProviderError(n)}}async delete(e,n){try{let o=this.toFilePath(e);if(n.recursive){let i;n?.atomic!==!1&&n.atomic.postfix&&(i=Ne(cn(o),`${nt(o)}${n.atomic.postfix}`)),await st.rm(o,1,i)}else try{await $u.unlink(o)}catch(i){if(i.code==="EPERM"||i.code==="EISDIR"){let s=!1;try{let{stat:a,symbolicLink:l}=await Mo.stat(o);s=a.isDirectory()&&!l}catch{}if(s)await $u.rmdir(o);else throw i}else throw i}}catch(o){throw this.toFileSystemProviderError(o)}}async rename(e,n,o){let i=this.toFilePath(e),s=this.toFilePath(n);if(i!==s)try{await this.validateMoveCopy(e,n,"move",o.overwrite),await st.rename(i,s)}catch(a){throw(a.code==="EINVAL"||a.code==="EBUSY"||a.code==="ENAMETOOLONG")&&(a=new Error(p(2167,null,nt(i),nt(cn(s)),a.toString()))),this.toFileSystemProviderError(a)}}async copy(e,n,o){let i=this.toFilePath(e),s=this.toFilePath(n);if(i!==s)try{await this.validateMoveCopy(e,n,"copy",o.overwrite),await st.copy(i,s,{preserveSymlinks:!0})}catch(a){throw(a.code==="EINVAL"||a.code==="EBUSY"||a.code==="ENAMETOOLONG")&&(a=new Error(p(2161,null,nt(i),nt(cn(s)),a.toString()))),this.toFileSystemProviderError(a)}}async validateMoveCopy(e,n,o,i){let s=this.toFilePath(e),a=this.toFilePath(n),l=!1;if(this.capabilities&1024||(l=ap(s,a,!0)),l){if(o==="copy")throw Si(p(2162,null),"EntryExists");if(o==="move")return}let c=await this.statIgnoreError(e);if(!c)throw Si(p(2165,null),"EntryNotFound");let u=await this.statIgnoreError(n);if(u){if(!i)throw Si(p(2164,null),"EntryExists");(c.type&1)!==0&&(u.type&1)!==0||await this.delete(n,{recursive:!0,useTrash:!1,atomic:!1})}}async cloneFile(e,n){return this.doCloneFile(e,n,!1)}async doCloneFile(e,n,o){let i=this.toFilePath(e),s=this.toFilePath(n),a=!!(this.capabilities&1024);if(ap(i,s,!a))return;let l=new $;try{l.add(await this.createResourceLock(e)),l.add(await this.createResourceLock(n)),o&&await $u.mkdir(cn(s),{recursive:!0}),await $u.copyFile(i,s)}catch(d){if(d.code==="ENOENT"&&!o)return this.doCloneFile(e,n,!0);throw this.toFileSystemProviderError(d)}finally{l.dispose()}}createUniversalWatcher(e,n,o){return new nP(i=>e(i),i=>n(i),o)}createNonRecursiveWatcher(e,n,o){return new sP(i=>e(i),i=>n(i),o)}toFileSystemProviderError(e){if(e instanceof Sl)return e;let n=e,o;switch(e.code){case"ENOENT":o="EntryNotFound";break;case"EISDIR":o="EntryIsADirectory";break;case"ENOTDIR":o="EntryNotADirectory";break;case"EEXIST":o="EntryExists";break;case"EPERM":case"EACCES":o="NoPermissions";break;case"ERR_UNC_HOST_NOT_ALLOWED":n=`${e.message}. Please update the 'security.allowedUNCHosts' setting if you want to allow this host.`,o="Unknown";break;default:o="Unknown"}return Si(n,o)}async toFileSystemProviderWriteError(e,n){let o=this.toFileSystemProviderError(n);if(e&&o.code==="NoPermissions")try{let{stat:i}=await Mo.stat(this.toFilePath(e));i.mode&128||(o=Si(n,"EntryWriteLocked"))}catch(i){this.logService.trace(i)}return o}};var Xf=class{constructor(t,e){t.addFileSystemProvider(V.file,new iN(e),{isCaseSensitive:Qe})}};Xf=_([C(0,Hs),C(1,oe)],Xf);var iN=class{constructor(t){this.impl=new aP(t)}async stat(t){let e=await this.impl.stat(t);return{type:e.type,ctime:e.ctime,mtime:e.mtime,size:e.size,permissions:e.permissions===1?1:void 0}}readDirectory(t){return this.impl.readdir(t)}createDirectory(t){return this.impl.mkdir(t)}readFile(t){return this.impl.readFile(t)}writeFile(t,e,n){return this.impl.writeFile(t,e,{...n,unlock:!1,atomic:!1})}delete(t,e){return this.impl.delete(t,{...e,useTrash:!1,atomic:!1})}rename(t,e,n){return this.impl.rename(t,e,n)}copy(t,e,n){return this.impl.copy(t,e,n)}get onDidChangeFile(){throw new Error("Method not implemented.")}watch(t,e){throw new Error("Method not implemented.")}};import o$ from"node:module";var r$=o$.createRequire(import.meta.url),sN=class extends Wu{_installInterceptor(){let t=this,e=r$("module"),n=e._load;e._load=function(l,d,c){return l=s(l),t._factories.has(l)?t._factories.get(l).load(l,b.file(N_(d.filename)),u=>n.apply(this,[u,d,c])):n.apply(this,arguments)};let o=e._resolveLookupPaths;e._resolveLookupPaths=(a,l)=>o.call(this,s(a),l);let i=e._resolveFilename;e._resolveFilename=function(l,d,c,u){return l==="vsda"&&Array.isArray(u?.paths)&&u.paths.length===0&&(u.paths=e._nodeModulePaths(import.meta.dirname)),i.call(this,l,d,c,u)};let s=a=>{for(let l of t._alternatives){let d=l(a);if(d){a=d;break}}return a}}},aN=class r extends Wu{constructor(){super(...arguments);this._store=new $}static _createDataUri(e){return`data:text/javascript;base64,${Buffer.from(e).toString("base64")}`}static{this._loaderScript=`
	let lookup;
	export const initialize = async (context) => {
		let requestIds = 0;
		const { port } = context;
		const pendingRequests = new Map();
		port.onmessage = (event) => {
			const { id, url } = event.data;
			pendingRequests.get(id)?.(url);
		};
		lookup = url => {
			// debugger;
			const myId = requestIds++;
			return new Promise((resolve) => {
				pendingRequests.set(myId, resolve);
				port.postMessage({ id: myId, url, });
			});
		};
	};
	export const resolve = async (specifier, context, nextResolve) => {
		if (specifier !== 'vscode' || !context.parentURL) {
			return nextResolve(specifier, context);
		}
		const otherUrl = await lookup(context.parentURL);
		return {
			url: otherUrl,
			shortCircuit: true,
		};
	};`}static{this._vscodeImportFnName="_VSCODE_IMPORT_VSCODE_API"}dispose(){this._store.dispose()}_installInterceptor(){let e=new Vy,n=new Map;Object.defineProperty(globalThis,r._vscodeImportFnName,{enumerable:!1,configurable:!1,writable:!1,value:l=>e.getKey(l)});let{port1:o,port2:i}=new MessageChannel,s,a=o;a.onmessage=l=>{s||(s=this._factories.get("vscode"),ep(s));let{id:d,url:c}=l.data,u=b.parse(c),m=s.load("_not_used",u,()=>{throw new Error("CANNOT LOAD MODULE from here.")}),g=e.get(m);g||(g=Ae(),e.set(m,g));let h=n.get(g);if(!h){let f=`const _vscodeInstance = globalThis.${r._vscodeImportFnName}('${g}');

${Object.keys(m).map((I=>`export const ${I} = _vscodeInstance['${I}'];`)).join(`
`)}`;h=r._createDataUri(f),n.set(g,h)}o.postMessage({id:d,url:h})},o$.register(r._createDataUri(r._loaderScript),{parentURL:import.meta.url,data:{port:i},transferList:[i]}),this._store.add(K(()=>{o.close(),i.close()}))}},lP=class extends Td{constructor(){super(...arguments);this.extensionRuntime=1}async _beforeAlmostReadyToRunExtensions(){this._instaService.createInstance(Jf);let e=this._instaService.invokeFunction(M5);if(this._instaService.createInstance(jf),this._initData.remote.isRemote&&this._initData.remote.authority){let o=this._instaService.createInstance(Gf);process.env.VSCODE_IPC_HOOK_CLI=o.ipcHandlePath}this._instaService.createInstance(Xf),await this._instaService.createInstance(sN,e,{mine:this._myRegistry,all:this._globalRegistry}).install(),await this._store.add(this._instaService.createInstance(aN,e,{mine:this._myRegistry,all:this._globalRegistry})).install(),Ft("code/extHost/didInitAPI");let n=await this._extHostConfiguration.getConfigProvider();await Z5(this._extHostWorkspace,n,this,this._logService,this._mainThreadTelemetryProxy,this._initData,this._store),Ft("code/extHost/didInitProxyResolver")}_getEntryPoint(e){return e.main}async _doLoadModule(e,n,o,i){if(n.scheme!==V.file)throw new Error(`Cannot load URI: '${n}', must be of file-scheme`);let s=null;o.codeLoadingStart(),this._logService.trace(`ExtensionService#loadModule [${i}] -> ${n.toString(!0)}`),this._logService.flush();let a=e?.identifier.value;e&&await this._extHostLocalizationService.initializeLocalizedMessages(e);try{a&&Ft(`code/extHost/willLoadExtensionCode/${a}`),i==="esm"?s=await import(n.toString(!0)):s=r$(n.fsPath)}finally{a&&Ft(`code/extHost/didLoadExtensionCode/${a}`),o.codeLoadingStop()}return s}async _loadCommonJSModule(e,n,o){return this._doLoadModule(e,n,o,"cjs")}async _loadESMModule(e,n,o){return this._doLoadModule(e,n,o,"esm")}async $setRemoteEnvironment(e){if(this._initData.remote.isRemote)for(let n in e){let o=e[n];o===null?delete process.env[n]:process.env[n]=o}}};import*as Zf from"fs";import{exec as b$}from"child_process";var IJ=(r,t,e)=>{let n=new Uint8Array(16);for(let s=0;s<16;s++)n[s]=Math.round(Math.random()*256);let o=Ao(H.wrap(n));return[`GET ws://localhost${r}?${t}&skipWebSocketFrames=true HTTP/1.1`,"Connection: Upgrade","Upgrade: websocket",`Sec-WebSocket-Key: ${o}`].join(`\r
`)+`\r
\r
`},i$=H.fromString(`\r
\r
`);async function s$(r,t,e,n,o){r.write(H.fromString(IJ(t,e,n)));let i=new $;try{return await new Promise((s,a)=>{let l;i.add(r.onData(d=>{l?l=H.concat([l,d],l.byteLength+d.byteLength):l=d;let c=l.indexOf(i$);if(c===-1)return;s(r),r.pauseData();let u=l.slice(c+i$.byteLength);u.byteLength&&o.onData.fire(u)})),i.add(r.onClose(d=>a(d??new Error("socket closed")))),i.add(r.onEnd(()=>a(new Error("socket ended"))))})}catch(s){throw r.dispose(),s}finally{i.dispose()}}var dP=class extends O{constructor(e,n){super();this.debugLabel=e;this.pausableDataEmitter=this._register(new os);this.onData=(...e)=>(this.pausableDataEmitter.isPaused&&queueMicrotask(()=>this.pausableDataEmitter.resume()),this.pausableDataEmitter.event(...e));this.didDisposeEmitter=this._register(new E);this.onDidDispose=this.didDisposeEmitter.event;this.ended=!1;this._register(n.onData),this._register(n.onData.event(o=>this.pausableDataEmitter.fire(o))),this.onClose=this._register(n.onClose).event,this.onEnd=this._register(n.onEnd).event}pauseData(){this.pausableDataEmitter.pause()}drain(){return Promise.resolve()}end(){this.ended=!0,this.closeRemote()}traceSocketEvent(e,n){Rh.traceSocketEvent(this,this.debugLabel,e,n)}dispose(){this.ended||this.closeRemote(),this.didDisposeEmitter.fire(),super.dispose()}};var xJ="signService",Ud=R(xJ);import*as g$ from"net";import*as f$ from"os";import*as lN from"net";var dN={1:!0,7:!0,9:!0,11:!0,13:!0,15:!0,17:!0,19:!0,20:!0,21:!0,22:!0,23:!0,25:!0,37:!0,42:!0,43:!0,53:!0,69:!0,77:!0,79:!0,87:!0,95:!0,101:!0,102:!0,103:!0,104:!0,109:!0,110:!0,111:!0,113:!0,115:!0,117:!0,119:!0,123:!0,135:!0,137:!0,139:!0,143:!0,161:!0,179:!0,389:!0,427:!0,465:!0,512:!0,513:!0,514:!0,515:!0,526:!0,530:!0,531:!0,532:!0,540:!0,548:!0,554:!0,556:!0,563:!0,587:!0,601:!0,636:!0,989:!0,990:!0,993:!0,995:!0,1719:!0,1720:!0,1723:!0,2049:!0,3659:!0,4045:!0,5060:!0,5061:!0,6e3:!0,6566:!0,6665:!0,6666:!0,6667:!0,6668:!0,6669:!0,6697:!0,10080:!0};function a$(r,t,e,n="127.0.0.1"){let o=!1,i,s=1,a=lN.createServer({pauseOnConnect:!0});function l(d,c){o||(o=!0,a.removeAllListeners(),a.close(),i&&clearTimeout(i),c(d))}return new Promise(d=>{i=setTimeout(()=>{l(0,d)},e),a.on("listening",()=>{l(r,d)}),a.on("error",c=>{c&&(c.code==="EADDRINUSE"||c.code==="EACCES")&&s<t?(r++,s++,a.listen(r,n)):l(0,d)}),a.on("close",()=>{l(0,d)}),a.listen(r,n)})}var CJ=30*1e3;function uN(r){switch(r){case 1:return"Management";case 2:return"ExtensionHost";case 3:return"Tunnel"}}function d$(r){let t=new Ce;return setTimeout(()=>t.cancel(),r),t.token}function TJ(r,t){if(r.isCancellationRequested||t.isCancellationRequested)return ve.Cancelled;let e=new Ce;return r.onCancellationRequested(()=>e.cancel()),t.onCancellationRequested(()=>e.cancel()),e.token}var _y=class{get didTimeout(){return this._state==="timedout"}constructor(t){this._state="pending",this._disposables=new $,{promise:this.promise,resolve:this._resolvePromise,reject:this._rejectPromise}=Sh(),t.isCancellationRequested?this._timeout():this._disposables.add(t.onCancellationRequested(()=>this._timeout()))}registerDisposable(t){this._state==="pending"?this._disposables.add(t):t.dispose()}_timeout(){this._state==="pending"&&(this._disposables.dispose(),this._state="timedout",this._rejectPromise(this._createTimeoutError()))}_createTimeoutError(){let t=new Error("Time limit reached");return t.code="ETIMEDOUT",t.syscall="connect",t}resolve(t){this._state==="pending"&&(this._disposables.dispose(),this._state="resolved",this._resolvePromise(t))}reject(t){this._state==="pending"&&(this._disposables.dispose(),this._state="rejected",this._rejectPromise(t))}};function EJ(r,t){let e=new _y(t);return e.registerDisposable(r.onControlMessage(n=>{let o=JSON.parse(n.toString()),i=DJ(o);i?e.reject(i):e.resolve(o)})),e.promise}function wJ(r,t,e,n,o,i,s,a){let l=new _y(a),d=an.create(!1);return r.info(`Creating a socket (${s})...`),Ft(`code/willCreateSocket/${i}`),t.connect(e,n,o,s).then(c=>{l.didTimeout?(Ft(`code/didCreateSocketError/${i}`),r.info(`Creating a socket (${s}) finished after ${d.elapsed()} ms, but this is too late and has timed out already.`),c?.dispose()):(Ft(`code/didCreateSocketOK/${i}`),r.info(`Creating a socket (${s}) was successful after ${d.elapsed()} ms.`),l.resolve(c))},c=>{Ft(`code/didCreateSocketError/${i}`),r.info(`Creating a socket (${s}) returned an error after ${d.elapsed()} ms.`),r.error(c),l.reject(c)}),l.promise}function cN(r,t){let e=new _y(t);return r.then(n=>{e.didTimeout||e.resolve(n)},n=>{e.didTimeout||e.reject(n)}),e.promise}async function kJ(r,t,e,n){let o=m$(r,t);r.logService.trace(`${o} 1/6. invoking socketFactory.connect().`);let i;try{i=await wJ(r.logService,r.remoteSocketFactoryService,r.connectTo,f_.getServerRootPath(),`reconnectionToken=${r.reconnectionToken}&reconnection=${r.reconnectionProtocol?"true":"false"}`,uN(t),`renderer-${uN(t)}-${r.reconnectionToken}`,n)}catch(c){throw r.logService.error(`${o} socketFactory.connect() failed or timed out. Error:`),r.logService.error(c),c}r.logService.trace(`${o} 2/6. socketFactory.connect() was successful.`);let s,a;r.reconnectionProtocol?(r.reconnectionProtocol.beginAcceptReconnection(i,null),s=r.reconnectionProtocol,a=!1):(s=new sc({socket:i}),a=!0),r.logService.trace(`${o} 3/6. sending AuthRequest control message.`);let l=await cN(r.signService.createNewMessage(Ae()),n),d={type:"auth",auth:r.connectionToken||"00000000000000000000",data:l.data};s.sendControl(H.fromString(JSON.stringify(d)));try{let c=await EJ(s,TJ(n,d$(1e4)));if(c.type!=="sign"||typeof c.data!="string"){let h=new Error("Unexpected handshake message");throw h.code="VSCODE_CONNECTION_ERROR",h}if(r.logService.trace(`${o} 4/6. received SignRequest control message.`),!await cN(r.signService.validate(l,c.signedData),n)){let h=new Error("Refused to connect to unsupported server");throw h.code="VSCODE_CONNECTION_ERROR",h}let m=await cN(r.signService.sign(c.data),n),g={type:"connectionType",commit:r.commit,signedData:m,desiredConnectionType:t};return e&&(g.args=e),r.logService.trace(`${o} 5/6. sending ConnectionTypeRequest control message.`),s.sendControl(H.fromString(JSON.stringify(g))),{protocol:s,ownsProtocol:a}}catch(c){throw c&&c.code==="ETIMEDOUT"&&(r.logService.error(`${o} the handshake timed out. Error:`),r.logService.error(c)),c&&c.code==="VSCODE_CONNECTION_ERROR"&&(r.logService.error(`${o} received error control message when negotiating connection. Error:`),r.logService.error(c)),a&&p$(s),c}}async function PJ(r,t,e){let n=Date.now(),o=m$(r,3),{protocol:i}=await kJ(r,3,t,e);return r.logService.trace(`${o} 6/6. handshake finished, connection is up and running after ${LJ(n)}!`),i}async function c$(r,t,e){let{connectTo:n,connectionToken:o}=await r.addressProvider.getAddress();return{commit:r.commit,quality:r.quality,connectTo:n,connectionToken:o,reconnectionToken:t,reconnectionProtocol:e,remoteSocketFactoryService:r.remoteSocketFactoryService,signService:r.signService,logService:r.logService}}async function u$(r,t,e){let n=await c$(r,Ae(),null);return await PJ(n,{host:t,port:e},ve.None)}function _J(r){return fr(t=>new Promise((e,n)=>{let o=setTimeout(e,r*1e3);t.onCancellationRequested(()=>{clearTimeout(o),e()})}))}var pN=class{constructor(t,e){this.reconnectionToken=t;this.millisSinceLastIncomingData=e;this.type=0}},mN=class{constructor(t,e,n,o){this.reconnectionToken=t;this.millisSinceLastIncomingData=e;this.durationSeconds=n;this.cancellableTimer=o;this.type=1}skipWait(){this.cancellableTimer.cancel()}},gN=class{constructor(t,e,n){this.reconnectionToken=t;this.millisSinceLastIncomingData=e;this.attempt=n;this.type=2}},cP=class{constructor(t,e,n){this.reconnectionToken=t;this.millisSinceLastIncomingData=e;this.attempt=n;this.type=4}},fN=class{constructor(t,e,n,o){this.reconnectionToken=t;this.millisSinceLastIncomingData=e;this.attempt=n;this.handled=o;this.type=3}},l$=class r extends O{constructor(e,n,o,i,s){super();this._connectionType=e;this._options=n;this.reconnectionToken=o;this.protocol=i;this._reconnectionFailureIsFatal=s;this._onDidStateChange=this._register(new E);this.onDidStateChange=this._onDidStateChange.event;this._permanentFailure=!1;this._isReconnecting=!1;this._isDisposed=!1;this._reconnectionGraceTime=108e5;this._onDidStateChange.fire(new cP(this.reconnectionToken,0,0)),this._register(i.onSocketClose(a=>{let l=Py(this._connectionType,this.reconnectionToken,!0);a?a.type===0?(this._options.logService.info(`${l} received socket close event (hadError: ${a.hadError}).`),a.error&&this._options.logService.error(a.error)):(this._options.logService.info(`${l} received socket close event (wasClean: ${a.wasClean}, code: ${a.code}, reason: ${a.reason}).`),a.event&&this._options.logService.error(a.event)):this._options.logService.info(`${l} received socket close event.`),this._beginReconnecting()})),this._register(i.onSocketTimeout(a=>{let l=Py(this._connectionType,this.reconnectionToken,!0);this._options.logService.info(`${l} received socket timeout event (unacknowledgedMsgCount: ${a.unacknowledgedMsgCount}, timeSinceOldestUnacknowledgedMsg: ${a.timeSinceOldestUnacknowledgedMsg}, timeSinceLastReceivedSomeData: ${a.timeSinceLastReceivedSomeData}).`),this._beginReconnecting()})),r._instances.push(this),this._register(K(()=>{let a=r._instances.indexOf(this);a>=0&&r._instances.splice(a,1)})),this._isPermanentFailure&&this._gotoPermanentFailure(r._permanentFailureMillisSinceLastIncomingData,r._permanentFailureAttempt,r._permanentFailureHandled)}static triggerPermanentFailure(e,n,o){this._permanentFailure=!0,this._permanentFailureMillisSinceLastIncomingData=e,this._permanentFailureAttempt=n,this._permanentFailureHandled=o,this._instances.forEach(i=>i._gotoPermanentFailure(this._permanentFailureMillisSinceLastIncomingData,this._permanentFailureAttempt,this._permanentFailureHandled))}static debugTriggerReconnection(){this._instances.forEach(e=>e._beginReconnecting())}static debugPauseSocketWriting(){this._instances.forEach(e=>e._pauseSocketWriting())}static{this._permanentFailure=!1}static{this._permanentFailureMillisSinceLastIncomingData=0}static{this._permanentFailureAttempt=0}static{this._permanentFailureHandled=!1}static{this._instances=[]}get _isPermanentFailure(){return this._permanentFailure||r._permanentFailure}updateGraceTime(e){let n=RJ(e,108e5),o=Py(this._connectionType,this.reconnectionToken,!1);this._options.logService.trace(`${o} Applying reconnection grace time: ${n}ms (${Math.floor(n/1e3)}s)`),this._reconnectionGraceTime=n}dispose(){super.dispose(),this._isDisposed=!0}async _beginReconnecting(){if(!this._isReconnecting)try{this._isReconnecting=!0,await this._runReconnectingLoop()}finally{this._isReconnecting=!1}}async _runReconnectingLoop(){if(this._isPermanentFailure||this._isDisposed)return;let e=Py(this._connectionType,this.reconnectionToken,!0);this._options.logService.info(`${e} starting reconnecting loop. You can get more information with the trace log level.`),this._onDidStateChange.fire(new pN(this.reconnectionToken,this.protocol.getMillisSinceLastIncomingData()));let n=[0,5,5,10,10,10,10,10,30],o=this._reconnectionGraceTime;if(this._options.logService.info(`${e} starting reconnection with grace time: ${o}ms (${Math.floor(o/1e3)}s)`),o<=0){this._options.logService.error(`${e} reconnection grace time is set to 0ms, will not attempt to reconnect.`),this._onReconnectionPermanentFailure(this.protocol.getMillisSinceLastIncomingData(),0,!1);return}let i=Date.now(),s=-1;do{s++;let a=s<n.length?n[s]:n[n.length-1];try{if(a>0){let d=_J(a);this._onDidStateChange.fire(new mN(this.reconnectionToken,this.protocol.getMillisSinceLastIncomingData(),a,d)),this._options.logService.info(`${e} waiting for ${a} seconds before reconnecting...`);try{await d}catch{}}if(this._isPermanentFailure){this._options.logService.error(`${e} permanent failure occurred while running the reconnecting loop.`);break}this._onDidStateChange.fire(new gN(this.reconnectionToken,this.protocol.getMillisSinceLastIncomingData(),s+1)),this._options.logService.info(`${e} resolving connection...`);let l=await c$(this._options,this.reconnectionToken,this.protocol);this._options.logService.info(`${e} connecting to ${l.connectTo}...`),await this._reconnect(l,d$(CJ)),this._options.logService.info(`${e} reconnected!`),this._onDidStateChange.fire(new cP(this.reconnectionToken,this.protocol.getMillisSinceLastIncomingData(),s+1));break}catch(l){if(l.code==="VSCODE_CONNECTION_ERROR"){this._options.logService.error(`${e} A permanent error occurred in the reconnecting loop! Will give up now! Error:`),this._options.logService.error(l),this._onReconnectionPermanentFailure(this.protocol.getMillisSinceLastIncomingData(),s+1,!1);break}if(Date.now()-i>=o){let d=Math.round(o/1e3);this._options.logService.error(`${e} An error occurred while reconnecting, but it will be treated as a permanent error because the reconnection grace time (${d}s) has expired! Will give up now! Error:`),this._options.logService.error(l),this._onReconnectionPermanentFailure(this.protocol.getMillisSinceLastIncomingData(),s+1,!1);break}if(Yp.isTemporarilyNotAvailable(l)){this._options.logService.info(`${e} A temporarily not available error occurred while trying to reconnect, will try again...`),this._options.logService.trace(l);continue}if((l.code==="ETIMEDOUT"||l.code==="ENETUNREACH"||l.code==="ECONNREFUSED"||l.code==="ECONNRESET")&&l.syscall==="connect"){this._options.logService.info(`${e} A network error occurred while trying to reconnect, will try again...`),this._options.logService.trace(l);continue}if(Qt(l)){this._options.logService.info(`${e} A promise cancelation error occurred while trying to reconnect, will try again...`),this._options.logService.trace(l);continue}if(l instanceof Yp){this._options.logService.error(`${e} A RemoteAuthorityResolverError occurred while trying to reconnect. Will give up now! Error:`),this._options.logService.error(l),this._onReconnectionPermanentFailure(this.protocol.getMillisSinceLastIncomingData(),s+1,Yp.isHandled(l));break}this._options.logService.error(`${e} An unknown error occurred while trying to reconnect, since this is an unknown case, it will be treated as a permanent error! Will give up now! Error:`),this._options.logService.error(l),this._onReconnectionPermanentFailure(this.protocol.getMillisSinceLastIncomingData(),s+1,!1);break}}while(!this._isPermanentFailure&&!this._isDisposed)}_onReconnectionPermanentFailure(e,n,o){this._reconnectionFailureIsFatal?r.triggerPermanentFailure(e,n,o):this._gotoPermanentFailure(e,n,o)}_gotoPermanentFailure(e,n,o){this._onDidStateChange.fire(new fN(this.reconnectionToken,e,n,o)),p$(this.protocol)}_pauseSocketWriting(){this.protocol.pauseSocketWriting()}};function p$(r){try{r.acceptDisconnect();let t=r.getSocket();r.dispose(),t.dispose()}catch(t){ze(t)}}function DJ(r){if(r&&r.type==="error"){let t=new Error(`Connection error: ${r.reason}`);return t.code="VSCODE_CONNECTION_ERROR",t}return null}function RJ(r,t){return typeof r!="number"||!isFinite(r)||r<0?t:r>Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:Math.floor(r)}function AJ(r,t){for(;r.length<t;)r+=" ";return r}function MJ(r,t){return`[remote-connection][${AJ(uN(r),13)}][${t.substr(0,5)}\u2026]`}function Py(r,t,e){return`${MJ(r,t)}[${e?"reconnect":"initial"}]`}function m$(r,t){return`${Py(t,r.reconnectionToken,!!r.reconnectionProtocol)}[${r.connectTo}]`}function LJ(r){return`${Date.now()-r} ms`}var uP=R("remoteSocketFactoryService");async function OJ(r,t,e,n,o){let i;for(let s=3;s&&(i?.dispose(),i=await new Ay(r,t,e,n,o).waitForReady(),!(o&&dN[o]||!dN[i.tunnelLocalPort]));s--);return i}var Ay=class extends O{constructor(e,n,o,i,s){super();this.defaultTunnelHost=n;this.suggestedLocalPort=s;this.privacy="private";this._socketsDispose=new Map;this._options=e,this._server=g$.createServer(),this._barrier=new In,this._listeningListener=()=>this._barrier.open(),this._server.on("listening",this._listeningListener),this._connectionListener=a=>this._onConnection(a),this._server.on("connection",this._connectionListener),this._errorListener=()=>{},this._server.on("error",this._errorListener),this.tunnelRemotePort=i,this.tunnelRemoteHost=o}async dispose(){super.dispose(),this._server.removeListener("listening",this._listeningListener),this._server.removeListener("connection",this._connectionListener),this._server.removeListener("error",this._errorListener),this._server.close(),Array.from(this._socketsDispose.values()).forEach(n=>{n()})}async waitForReady(){let e=this.suggestedLocalPort??this.tunnelRemotePort,n=si(this.defaultTunnelHost)?"0.0.0.0":"127.0.0.1",o=await a$(e,2,1e3,n),i=null;return this._server.listen(o,this.defaultTunnelHost),await this._barrier.wait(),i=this._server.address(),i||(o=0,this._server.listen(o,this.defaultTunnelHost),await this._barrier.wait(),i=this._server.address()),this.tunnelLocalPort=i.port,this.localAddress=`${this.tunnelRemoteHost==="127.0.0.1"?"127.0.0.1":"localhost"}:${i.port}`,this}async _onConnection(e){e.pause();let n=Ws(this.tunnelRemoteHost)||si(this.tunnelRemoteHost)?"localhost":this.tunnelRemoteHost,o=await u$(this._options,n,this.tunnelRemotePort),i=o.getSocket(),s=o.readEntireBuffer();o.dispose(),s.byteLength>0&&e.write(s.buffer),e.on("end",()=>{e.localAddress&&this._socketsDispose.delete(e.localAddress),i.end()}),e.on("close",()=>i.end()),e.on("error",()=>{e.localAddress&&this._socketsDispose.delete(e.localAddress),i instanceof oa?i.socket.destroy():i.end()}),i instanceof oa?this._mirrorNodeSocket(e,i):this._mirrorGenericSocket(e,i),e.localAddress&&this._socketsDispose.set(e.localAddress,()=>{e.end(),i.end()})}_mirrorGenericSocket(e,n){n.onClose(()=>e.destroy()),n.onEnd(()=>e.end()),n.onData(o=>e.write(o.buffer)),e.on("data",o=>n.write(H.wrap(o))),e.resume()}_mirrorNodeSocket(e,n){let o=n.socket;o.on("end",()=>e.end()),o.on("close",()=>e.end()),o.on("error",()=>{e.destroy()}),o.pipe(e),e.pipe(o)}},Dy=class extends mg{constructor(e,n,o,i,s){super(n,s);this.remoteSocketFactoryService=e;this.signService=o;this.productService=i}isPortPrivileged(e){return z4(e,this.defaultTunnelHost,lr,f$.release())}retainOrCreateTunnel(e,n,o,i,s,a,l,d){let c=this.getTunnelFromMap(n,o);if(c)return++c.refcount,c.value;if($4(e))return this.createWithProvider(e,n,o,s,a,l,d);{this.logService.trace(`ForwardedPorts: (TunnelService) Creating tunnel without provider ${n}:${o} on local port ${s}.`);let u={commit:this.productService.commit,quality:this.productService.quality,addressProvider:e,remoteSocketFactoryService:this.remoteSocketFactoryService,signService:this.signService,logService:this.logService,ipcLogger:null},m=OJ(u,i,n,o,s);return this.logService.trace("ForwardedPorts: (TunnelService) Tunnel created without provider."),this.addTunnelToMap(n,o,m),m}}};Dy=_([C(0,uP),C(1,oe),C(2,Ud),C(3,ms),C(4,Kt)],Dy);var Ry=class extends Dy{constructor(t,e,n,o,i){super(t,e,n,o,i)}};Ry=_([C(0,uP),C(1,oe),C(2,Ud),C(3,ms),C(4,Kt)],Ry);var pP=class extends O{constructor(e,n,o,i,s){super();this.remoteSocketFactoryService=e;this.logService=n;this.productService=o;this.signService=i;this.configurationService=s;this._tunnelServices=new Map}async openTunnel(e,n,o,i,s,a,l,d,c){if(this.logService.trace(`ForwardedPorts: (SharedTunnelService) openTunnel request for ${o}:${i} on local port ${a}.`),!this._tunnelServices.has(e)){let u=new Ry(this.remoteSocketFactoryService,this.logService,this.signService,this.productService,this.configurationService);this._register(u),this._tunnelServices.set(e,u),u.onTunnelClosed(async()=>{(await u.tunnels).length===0&&(u.dispose(),this._tunnelServices.delete(e))})}return this._tunnelServices.get(e).openTunnel(n,o,i,s,a,l,d,c)}};pP=_([C(0,uP),C(1,oe),C(2,ms),C(3,Ud),C(4,Kt)],pP);var NJ=10*1e3,mP="remote.tunnels.toRestore",hN="remote.tunnels.toRestoreExpiration",UJ=1e3*60*60*24*14,h$="onTunnel",zkt=new w("forwardedPortsViewEnabled",!1,p(17938,null)),FJ=new w("forwardedPortsViewOnlyEnabled",!1,p(17938,null));function bN(r){let t=r.match(/^([a-zA-Z0-9_-]+(?:\.[a-zA-Z0-9_-]+)*:)?([0-9]+)$/);if(t)return{host:t[1]?.substring(0,t[1].length-1)||"localhost",port:Number(t[2])}}var vN={source:0,description:p(17940,null)},qkt={source:1,description:p(17939,null)};function v$(r,t,e){let n=r.get(Er(t,e));if(n)return n;if(Ws(t))for(let o of gg){let i=Er(o,e);if(r.has(i))return r.get(i)}else if(si(t))for(let o of Cb){let i=Er(o,e);if(r.has(i))return r.get(i)}}function rr(r,t,e){let n=v$(r,t,e);if(n)return n;let o=si(t)?"localhost":Ws(t)?"0.0.0.0":void 0;if(o)return v$(r,o,e)}function Er(r,t){return r+":"+t}function HJ(r){return r&&"host"in r&&typeof r.host=="string"&&"port"in r&&typeof r.port=="number"&&(!("detail"in r)||typeof r.detail=="string")&&(!("pid"in r)||typeof r.pid=="string")}var gP=class r extends O{constructor(e){super();this.configurationService=e;this.portsAttributes=[];this._onDidChangeAttributes=this._register(new E);this.onDidChangeAttributes=this._onDidChangeAttributes.event;this._register(e.onDidChangeConfiguration(n=>{(n.affectsConfiguration(r.SETTING)||n.affectsConfiguration(r.DEFAULTS))&&this.updateAttributes()})),this.updateAttributes()}static{this.SETTING="remote.portsAttributes"}static{this.DEFAULTS="remote.otherPortsAttributes"}static{this.RANGE=/^(\d+)\-(\d+)$/}static{this.HOST_AND_PORT=/^([a-z0-9\-]+):(\d{1,5})$/}updateAttributes(){this.portsAttributes=this.readSetting(),this._onDidChangeAttributes.fire()}getAttributes(e,n,o){let i=this.findNextIndex(e,n,o,this.portsAttributes,0),s={label:void 0,onAutoForward:void 0,elevateIfNeeded:void 0,requireLocalPort:void 0,protocol:void 0};for(;i>=0;){let a=this.portsAttributes[i];a.key===e?(s.onAutoForward=a.onAutoForward??s.onAutoForward,s.elevateIfNeeded=a.elevateIfNeeded!==void 0?a.elevateIfNeeded:s.elevateIfNeeded,s.label=a.label??s.label,s.requireLocalPort=a.requireLocalPort,s.protocol=a.protocol):(s.onAutoForward=s.onAutoForward??a.onAutoForward,s.elevateIfNeeded=s.elevateIfNeeded!==void 0?s.elevateIfNeeded:a.elevateIfNeeded,s.label=s.label??a.label,s.requireLocalPort=s.requireLocalPort!==void 0?s.requireLocalPort:void 0,s.protocol=s.protocol??a.protocol),i=this.findNextIndex(e,n,o,this.portsAttributes,i+1)}return s.onAutoForward!==void 0||s.elevateIfNeeded!==void 0||s.label!==void 0||s.requireLocalPort!==void 0||s.protocol!==void 0?s:this.getOtherAttributes()}hasStartEnd(e){return e.start!==void 0&&e.end!==void 0}hasHostAndPort(e){return e.host!==void 0&&e.port!==void 0&&De(e.host)&&Un(e.port)}findNextIndex(e,n,o,i,s){if(s>=i.length)return-1;let a=!Ws(n)&&!si(n),d=i.slice(s).findIndex(c=>Un(c.key)?a?!1:c.key===e:this.hasStartEnd(c.key)?a?!1:e>=c.key.start&&e<=c.key.end:this.hasHostAndPort(c.key)?e===c.key.port&&n===c.key.host:o?c.key.test(o):!1);return d>=0?d+s:-1}readSetting(){let e=this.configurationService.getValue(r.SETTING);if(!e||!it(e))return[];let n=[];for(let i in e){if(i===void 0)continue;let s=e[i],a;if(Number(i))a=Number(i);else if(De(i))if(r.RANGE.test(i)){let l=i.match(r.RANGE);a={start:Number(l[1]),end:Number(l[2])}}else if(r.HOST_AND_PORT.test(i)){let l=i.match(r.HOST_AND_PORT);a={host:l[1],port:Number(l[2])}}else{let l;try{l=RegExp(i)}catch{}l&&(a=l)}a&&n.push({key:a,elevateIfNeeded:s.elevateIfNeeded,onAutoForward:s.onAutoForward,label:s.label,requireLocalPort:s.requireLocalPort,protocol:s.protocol})}let o=this.configurationService.getValue(r.DEFAULTS);return o&&(this.defaultPortAttributes={elevateIfNeeded:o.elevateIfNeeded,label:o.label,onAutoForward:o.onAutoForward,requireLocalPort:o.requireLocalPort,protocol:o.protocol}),this.sortAttributes(n)}sortAttributes(e){function n(o,i){return Un(o.key)?o.key:i.hasStartEnd(o.key)?o.key.start:i.hasHostAndPort(o.key)?o.key.port:Number.MAX_VALUE}return e.sort((o,i)=>n(o,this)-n(i,this))}getOtherAttributes(){return this.defaultPortAttributes}static providedActionToAction(e){switch(e){case 1:return"notify";case 2:return"openBrowser";case 6:return"openBrowserOnce";case 3:return"openPreview";case 4:return"silent";case 5:return"ignore";default:return}}async addAttributes(e,n,o){let s=this.configurationService.inspect(r.SETTING).userRemoteValue,a;!s||!it(s)?a={}:a=at(s),a[`${e}`]||(a[`${e}`]={});for(let l in n)a[`${e}`][l]=n[l];return this.configurationService.updateValue(r.SETTING,a,o)}},My=class extends O{constructor(e,n,o,i,s,a,l,d,c,u){super();this.tunnelService=e;this.storageService=n;this.configurationService=o;this.environmentService=i;this.remoteAuthorityResolverService=s;this.workspaceContextService=a;this.logService=l;this.dialogService=d;this.extensionService=c;this.contextKeyService=u;this.inProgress=new Map;this._onForwardPort=this._register(new E);this.onForwardPort=this._onForwardPort.event;this._onClosePort=this._register(new E);this.onClosePort=this._onClosePort.event;this._onPortName=this._register(new E);this.onPortName=this._onPortName.event;this._onCandidatesChanged=this._register(new E);this.onCandidatesChanged=this._onCandidatesChanged.event;this._onEnvironmentTunnelsSet=this._register(new E);this.onEnvironmentTunnelsSet=this._onEnvironmentTunnelsSet.event;this._environmentTunnelsSet=!1;this.restoreListener=void 0;this.restoreComplete=!1;this.onRestoreComplete=this._register(new E);this.unrestoredExtensionTunnels=new Map;this.sessionCachedProperties=new Map;this.portAttributesProviders=[];this.hasCheckedExtensionsOnTunnelOpened=!1;this.mismatchCooldown=new Date;this.configPortsAttributes=new gP(o),this.tunnelRestoreValue=this.getTunnelRestoreValue(),this._register(this.configPortsAttributes.onDidChangeAttributes(this.updateAttributes,this)),this.forwarded=new Map,this.remoteTunnels=new Map,this.tunnelService.tunnels.then(async m=>{let g=await this.getAttributes(m.map(h=>({port:h.tunnelRemotePort,host:h.tunnelRemoteHost})));for(let h of m)if(h.localAddress){let f=Er(h.tunnelRemoteHost,h.tunnelRemotePort),I=rr(this._candidates??new Map,h.tunnelRemoteHost,h.tunnelRemotePort);this.forwarded.set(f,{remotePort:h.tunnelRemotePort,remoteHost:h.tunnelRemoteHost,localAddress:h.localAddress,protocol:g?.get(h.tunnelRemotePort)?.protocol??"http",localUri:await this.makeLocalUri(h.localAddress,g?.get(h.tunnelRemotePort)),localPort:h.tunnelLocalPort,name:g?.get(h.tunnelRemotePort)?.label,runningProcess:I?.detail,hasRunningProcess:!!I,pid:I?.pid,privacy:h.privacy,source:vN}),this.remoteTunnels.set(f,h)}}),this.detected=new Map,this._register(this.tunnelService.onTunnelOpened(async m=>{let g=Er(m.tunnelRemoteHost,m.tunnelRemotePort);if(!rr(this.forwarded,m.tunnelRemoteHost,m.tunnelRemotePort)&&!rr(this.detected,m.tunnelRemoteHost,m.tunnelRemotePort)&&!rr(this.inProgress,m.tunnelRemoteHost,m.tunnelRemotePort)&&m.localAddress){let h=rr(this._candidates??new Map,m.tunnelRemoteHost,m.tunnelRemotePort),f=(await this.getAttributes([{port:m.tunnelRemotePort,host:m.tunnelRemoteHost}]))?.get(m.tunnelRemotePort);this.forwarded.set(g,{remoteHost:m.tunnelRemoteHost,remotePort:m.tunnelRemotePort,localAddress:m.localAddress,protocol:f?.protocol??"http",localUri:await this.makeLocalUri(m.localAddress,f),localPort:m.tunnelLocalPort,name:f?.label,closeable:!0,runningProcess:h?.detail,hasRunningProcess:!!h,pid:h?.pid,privacy:m.privacy,source:vN})}await this.storeForwarded(),this.checkExtensionActivationEvents(!0),this.remoteTunnels.set(g,m),this._onForwardPort.fire(this.forwarded.get(g))})),this._register(this.tunnelService.onTunnelClosed(m=>this.onTunnelClosed(m,"Other"))),this.checkExtensionActivationEvents(!1)}extensionHasActivationEvent(){return this.extensionService.extensions.find(e=>e.activationEvents?.includes(h$))?(this.contextKeyService.createKey(FJ.key,!0),!0):!1}checkExtensionActivationEvents(e){if(this.hasCheckedExtensionsOnTunnelOpened||(e&&(this.hasCheckedExtensionsOnTunnelOpened=!0),this.environmentService.remoteAuthority!==void 0&&!e)||this.extensionHasActivationEvent())return;let o=this._register(this.extensionService.onDidRegisterExtensions(()=>{this.extensionHasActivationEvent()&&o.dispose()}))}async onTunnelClosed(e,n){let o=Er(e.host,e.port);this.forwarded.delete(o)&&(await this.storeForwarded(),this._onClosePort.fire(e))}makeLocalUri(e,n){if(e.startsWith("http"))return b.parse(e);let o=n?.protocol??"http";return b.parse(`${o}://${e}`)}async addStorageKeyPostfix(e){let n=this.workspaceContextService.getWorkspace(),o=n.configuration?Gn(n.configuration.path):n.folders.length>0?Gn(n.folders[0].uri.path):void 0;if(o===void 0){this.logService.debug("Could not get workspace hash for forwarded ports storage key.");return}return`${e}.${this.environmentService.remoteAuthority}.${o}`}async getTunnelRestoreStorageKey(){return this.addStorageKeyPostfix(mP)}async getRestoreExpirationStorageKey(){return this.addStorageKeyPostfix(hN)}async getTunnelRestoreValue(){let e=this.storageService.get(mP,1);if(e)return this.storageService.remove(mP,1),await this.storeForwarded(),e;let n=await this.getTunnelRestoreStorageKey();if(n)return this.storageService.get(n,0)}async restoreForwarded(){if(this.cleanupExpiredTunnelsForRestore(),this.configurationService.getValue("remote.restoreForwardedPorts")){let e=await this.tunnelRestoreValue;if(e&&e!==this.knownPortsRestoreValue){let n=JSON.parse(e)??[];this.logService.trace(`ForwardedPorts: (TunnelModel) restoring ports ${n.map(o=>o.remotePort).join(", ")}`);for(let o of n){let i=rr(this.detected,o.remoteHost,o.remotePort);o.source.source!==2&&!i||o.source.source===2&&i?await this.doForward({remote:{host:o.remoteHost,port:o.remotePort},local:o.localPort,name:o.name,elevateIfNeeded:!0,source:o.source}):o.source.source===2&&!i&&this.unrestoredExtensionTunnels.set(Er(o.remoteHost,o.remotePort),o)}}}if(this.restoreComplete=!0,this.onRestoreComplete.fire(),!this.restoreListener){let e=await this.getTunnelRestoreStorageKey();this.restoreListener=this._register(new $),this.restoreListener.add(this.storageService.onDidChangeValue(0,void 0,this.restoreListener)(async n=>{n.key===e&&(this.tunnelRestoreValue=Promise.resolve(this.storageService.get(e,0)),await this.restoreForwarded())}))}}cleanupExpiredTunnelsForRestore(){let e=this.storageService.keys(0,0).filter(n=>n.startsWith(hN));for(let n of e){let o=this.storageService.getNumber(n,0);if(o&&o<Date.now()){this.tunnelRestoreValue=Promise.resolve(void 0);let i=n.replace(hN,mP);this.storageService.remove(n,0),this.storageService.remove(i,0)}}}async storeForwarded(){if(this.configurationService.getValue("remote.restoreForwardedPorts")){let e=Array.from(this.forwarded.values()),n=e.map(a=>({remoteHost:a.remoteHost,remotePort:a.remotePort,localPort:a.localPort,name:a.name,localAddress:a.localAddress,localUri:a.localUri,protocol:a.protocol,source:a.source})),o;e.length>0&&(o=JSON.stringify(n));let i=await this.getTunnelRestoreStorageKey(),s=await this.getRestoreExpirationStorageKey();!o&&i&&s?(this.storageService.remove(i,0),this.storageService.remove(s,0)):o!==this.knownPortsRestoreValue&&i&&s&&(this.storageService.store(i,o,0,0),this.storageService.store(s,Date.now()+UJ,0,0)),this.knownPortsRestoreValue=o}}async showPortMismatchModalIfNeeded(e,n,o){if(!e.tunnelLocalPort||!o?.requireLocalPort||e.tunnelLocalPort===n)return;let i=new Date;if(this.mismatchCooldown.getTime()+NJ>i.getTime())return;this.mismatchCooldown=i;let s=p(17937,null,n,e.tunnelRemotePort,e.tunnelLocalPort);return this.dialogService.info(s)}async forward(e,n){return!this.restoreComplete&&this.environmentService.remoteAuthority&&await he.toPromise(this.onRestoreComplete.event),this.doForward(e,n)}async doForward(e,n){await this.extensionService.activateByEvent(h$);let o=rr(this.forwarded,e.remote.host,e.remote.port);n=n??(n!==null?(await this.getAttributes([e.remote]))?.get(e.remote.port):void 0);let i=e.local!==void 0?e.local:e.remote.port,s;if(o)return this.mergeAttributesIntoExistingTunnel(o,e,n);{let a=this.environmentService.remoteAuthority,l=a?{getAddress:async()=>(await this.remoteAuthorityResolverService.resolveAuthority(a)).authority}:void 0,d=Er(e.remote.host,e.remote.port);this.inProgress.set(d,!0),e=this.mergeCachedAndUnrestoredProperties(d,e);let c=await this.tunnelService.openTunnel(l,e.remote.host,e.remote.port,void 0,i,e.elevateIfNeeded?e.elevateIfNeeded:n?.elevateIfNeeded,e.privacy,n?.protocol);if(typeof c=="string")s=c;else if(c&&c.localAddress){let u=rr(this._candidates??new Map,e.remote.host,e.remote.port),m=c.protocol?c.protocol==="https"?"https":"http":n?.protocol??"http",g={remoteHost:c.tunnelRemoteHost,remotePort:c.tunnelRemotePort,localPort:c.tunnelLocalPort,name:n?.label??e.name,closeable:!0,localAddress:c.localAddress,protocol:m,localUri:await this.makeLocalUri(c.localAddress,n),runningProcess:u?.detail,hasRunningProcess:!!u,pid:u?.pid,source:e.source??vN,privacy:c.privacy};return this.forwarded.set(d,g),this.remoteTunnels.set(d,c),this.inProgress.delete(d),await this.storeForwarded(),await this.showPortMismatchModalIfNeeded(c,i,n),this._onForwardPort.fire(g),c}this.inProgress.delete(d)}return s}mergeCachedAndUnrestoredProperties(e,n){let o=this.unrestoredExtensionTunnels.has(e)?this.unrestoredExtensionTunnels:this.sessionCachedProperties.has(e)?this.sessionCachedProperties:void 0;if(o){let i=o.get(e);o.delete(e),i&&(n.name=i.name??n.name,n.local=("local"in i?i.local:"localPort"in i?i.localPort:void 0)??n.local,n.privacy=n.privacy)}return n}async mergeAttributesIntoExistingTunnel(e,n,o){let i=o?.label??n.name,s;(u=>(u[u.None=0]="None",u[u.Fire=1]="Fire",u[u.Reopen=2]="Reopen"))(s||={});let a=0;switch(i!==e.name&&(e.name=i,a=1),(o?.protocol||e.protocol!=="http")&&o?.protocol!==e.protocol&&(n.source=e.source,a=2),n.privacy&&e.privacy!==n.privacy&&(a=2),a){case 1:{this._onForwardPort.fire();break}case 2:await this.close(e.remoteHost,e.remotePort,"User"),await this.doForward(n,o)}return rr(this.remoteTunnels,n.remote.host,n.remote.port)}async name(e,n,o){let i=rr(this.forwarded,e,n),s=Er(e,n);if(i){i.name=o,await this.storeForwarded(),this._onPortName.fire({host:e,port:n});return}else this.detected.has(s)&&(this.detected.get(s).name=o,this._onPortName.fire({host:e,port:n}))}async close(e,n,o){let i=Er(e,n),s=this.forwarded.get(i);return o==="AutoForwardEnd"&&s&&s.source.source===1&&this.sessionCachedProperties.set(i,{local:s.localPort,name:s.name,privacy:s.privacy}),await this.tunnelService.closeTunnel(e,n),this.onTunnelClosed({host:e,port:n},o)}address(e,n){let o=Er(e,n);return(this.forwarded.get(o)||this.detected.get(o))?.localAddress}get environmentTunnelsSet(){return this._environmentTunnelsSet}addEnvironmentTunnels(e){if(e)for(let n of e){let o=rr(this._candidates??new Map,n.remoteAddress.host,n.remoteAddress.port),i=typeof n.localAddress=="string"?n.localAddress:Er(n.localAddress.host,n.localAddress.port);this.detected.set(Er(n.remoteAddress.host,n.remoteAddress.port),{remoteHost:n.remoteAddress.host,remotePort:n.remoteAddress.port,localAddress:i,protocol:"http",localUri:this.makeLocalUri(i),closeable:!1,runningProcess:o?.detail,hasRunningProcess:!!o,pid:o?.pid,privacy:"constantPrivate",source:{source:2,description:p(17941,null)}}),this.tunnelService.setEnvironmentTunnel(n.remoteAddress.host,n.remoteAddress.port,i,"constantPrivate","http")}this._environmentTunnelsSet=!0,this._onEnvironmentTunnelsSet.fire(),this._onForwardPort.fire()}setCandidateFilter(e){this._candidateFilter=e}async setCandidates(e){let n=e;this._candidateFilter&&(n=await this._candidateFilter(e));let o=this.updateInResponseToCandidates(n);this.logService.trace(`ForwardedPorts: (TunnelModel) removed candidates ${Array.from(o.values()).map(i=>i.port).join(", ")}`),this._onCandidatesChanged.fire(o)}updateInResponseToCandidates(e){let n=this._candidates??new Map,o=new Map;return this._candidates=o,e.forEach(i=>{let s=Er(i.host,i.port);o.set(s,{host:i.host,port:i.port,detail:i.detail,pid:i.pid}),n.delete(s);let a=rr(this.forwarded,i.host,i.port);a&&(a.runningProcess=i.detail,a.hasRunningProcess=!0,a.pid=i.pid)}),n.forEach((i,s)=>{let a=bN(s);if(!a)return;let l=rr(this.forwarded,a.host,a.port);l&&(l.runningProcess=void 0,l.hasRunningProcess=!1,l.pid=void 0);let d=rr(this.detected,a.host,a.port);d&&(d.runningProcess=void 0,d.hasRunningProcess=!1,d.pid=void 0)}),n}get candidates(){return this._candidates?Array.from(this._candidates.values()):[]}get candidatesOrUndefined(){return this._candidates?this.candidates:void 0}async updateAttributes(){let e=Array.from(this.forwarded.values()),n=await this.getAttributes(e.map(o=>({port:o.remotePort,host:o.remoteHost})),!1);if(n)for(let o of e){let i=n.get(o.remotePort);(i?.protocol||o.protocol!=="http")&&i?.protocol!==o.protocol&&await this.doForward({remote:{host:o.remoteHost,port:o.remotePort},local:o.localPort,name:o.name,source:o.source},i),i&&i.label&&i.label!==o.name&&await this.name(o.remoteHost,o.remotePort,i.label)}}async getAttributes(e,n=!0){let o=new Map,i=new Map;e.forEach(c=>{let u=rr(this._candidates??new Map,gg[0],c.port)??c;if(u){o.set(c.port,u);let m=HJ(u)?u.pid:void 0;i.has(m)||i.set(m,[]),i.get(m)?.push(c.port)}});let s=new Map;if(e.forEach(c=>{let u=this.configPortsAttributes.getAttributes(c.port,c.host,o.get(c.port)?.detail);u&&s.set(c.port,u)}),this.portAttributesProviders.length===0||!n)return s.size>0?s:void 0;let a=await Promise.all(this.portAttributesProviders.flatMap(c=>Array.from(i.entries()).map(u=>{let m=u[1],g=o.get(m[0]);return c.providePortAttributes(m,g?.pid,g?.detail,ve.None)}))),l=new Map;if(a.forEach(c=>c.forEach(u=>{u&&l.set(u.port,u)})),!s&&!l)return;let d=new Map;return e.forEach(c=>{let u=s.get(c.port),m=l.get(c.port);d.set(c.port,{elevateIfNeeded:u?.elevateIfNeeded,label:u?.label,onAutoForward:u?.onAutoForward??gP.providedActionToAction(m?.autoForwardAction),requireLocalPort:u?.requireLocalPort,protocol:u?.protocol})}),d}addAttributesProvider(e){this.portAttributesProviders.push(e)}};_([rc(1e3)],My.prototype,"storeForwarded",1),My=_([C(0,B4),C(1,Sr),C(2,Kt),C(3,Kp),C(4,t4),C(5,cs),C(6,oe),C(7,eS),C(8,Qx),C(9,Oo)],My);function WJ(r){let t=r.trim().split(`
`),e=[];return t.forEach(o=>{let i=/\/proc\/(\d+)\/fd\/\d+ -> socket:\[(\d+)\]/.exec(o);i&&i.length>=3&&e.push({pid:parseInt(i[1],10),socket:parseInt(i[2],10)})}),e.reduce((o,i)=>(o[i.socket]=i,o),{})}function VJ(...r){let t=[].concat(...r.map($J));return[...new Map(t.filter(e=>e.st==="0A").map(e=>{let n=e.local_address.split(":");return{socket:parseInt(e.inode,10),ip:BJ(n[0]),port:parseInt(n[1],16)}}).map(e=>[e.ip+":"+e.port,e])).values()]}function BJ(r){let t="";if(r.length===8)for(let e=r.length-2;e>=0;e-=2)t+=parseInt(r.substr(e,2),16),e!==0&&(t+=".");else for(let e=0;e<r.length;e+=8){let n=r.substring(e,e+8),o="";for(let i=8;i>=2;i-=2)o+=n.substring(i-2,i),(i===6||i===2)&&(o=parseInt(o,16).toString(16),t+=`${o}`,o="",e+i!==r.length-6&&(t+=":"))}return t}function $J(r){let t=r.trim().split(`
`),e=t.shift().trim().split(/\s+/).filter(o=>o!=="rx_queue"&&o!=="tm->when");return t.map(o=>o.trim().split(/\s+/).reduce((i,s,a)=>(i[e[a]||a]=s,i),{}))}function zJ(r){return r.length>500?!1:!!r.match(/.*\.vscode-server-[a-zA-Z]+\/bin.*/)||r.indexOf("out/server-main.js")!==-1||r.indexOf("_productName=VSCode")!==-1}function qJ(r){let t=r.trim().split(`
`),e=[];return t.forEach(n=>{let o=/^\d+\s+\D+\s+root\s+(\d+)\s+(\d+).+\d+\:\d+\:\d+\s+(.+)$/.exec(n);o&&o.length>=4&&e.push({pid:parseInt(o[1],10),ppid:parseInt(o[2]),cmd:o[3]})}),e}async function KJ(r,t,e){let n=e.reduce((i,s)=>(i[s.pid]=s,i),{}),o=[];return r.forEach(({socket:i,ip:s,port:a})=>{let l=t[i]?t[i].pid:void 0,d=l?n[l]?.cmd:void 0;l&&d&&!zJ(d)&&o.push({host:s,port:a,detail:d,pid:l})}),o}function jJ(r,t,e){let n=new Map,o=qJ(t);for(let i of r){let s=e.get(i.port);if(s){n.set(i.port,s);continue}let a=o.find(l=>l.cmd.includes(`${i.port}`));if(a){let l=a,d;do d=o.find(c=>c.ppid===l.pid),d&&(l=d);while(d);n.set(i.port,{host:i.ip,port:i.port,pid:l.pid,detail:l.cmd,ppid:l.ppid})}else n.set(i.port,{host:i.ip,port:i.port,ppid:Number.MAX_VALUE})}return n}var eh=class extends vd{constructor(e,n,o,i,s){super(e,n,o);this.initData=n;this.signService=i;this.configurationService=s;this._initialCandidates=void 0;this._foundRootPorts=new Map;this._candidateFindingEnabled=!1;Qe&&n.remote.isRemote&&n.remote.authority&&(this._proxy.$setRemoteTunnelService(process.pid),this.setInitialCandidates())}async $registerCandidateFinder(e){if(e&&this._candidateFindingEnabled)return;this._candidateFindingEnabled=e;let n;this._initialCandidates&&(n=this._initialCandidates,await this._proxy.$onFoundNewCandidates(this._initialCandidates));let o=new rx,i=0;for(;this._candidateFindingEnabled;){let s=new Date().getTime(),a=(await this.findCandidatePorts()).filter(c=>Ws(c.host)||si(c.host));this.logService.trace(`ForwardedPorts: (ExtHostTunnelService) found candidate ports ${a.map(c=>c.port).join(", ")}`);let l=new Date().getTime()-s;this.logService.trace(`ForwardedPorts: (ExtHostTunnelService) candidate port scan took ${l} ms.`),i++>3&&o.update(l),(!n||JSON.stringify(n)!==JSON.stringify(a))&&(n=a,await this._proxy.$onFoundNewCandidates(n));let d=this.calculateDelay(o.value);this.logService.trace(`ForwardedPorts: (ExtHostTunnelService) next candidate port scan in ${d} ms.`),await new Promise(c=>setTimeout(()=>c(),d))}}calculateDelay(e){return Math.max(e*20,2e3)}async setInitialCandidates(){this._initialCandidates=await this.findCandidatePorts(),this.logService.trace(`ForwardedPorts: (ExtHostTunnelService) Initial candidates found: ${this._initialCandidates.map(e=>e.port).join(", ")}`)}async findCandidatePorts(){let e="",n="";try{e=await Zf.promises.readFile("/proc/net/tcp","utf8"),n=await Zf.promises.readFile("/proc/net/tcp6","utf8")}catch{}let o=VJ(e,n),i=await new Promise(g=>{b$("ls -l /proc/[0-9]*/fd/[0-9]* | grep socket:",(h,f,I)=>{g(f)})}),s=WJ(i),a=await st.readdir("/proc"),l=[];for(let g of a)try{let h=Number(g),f=Et(b.file("/proc"),g);if((await Zf.promises.stat(f.fsPath)).isDirectory()&&!isNaN(h)){let S=await Zf.promises.readlink(Et(f,"cwd").fsPath),T=await Zf.promises.readFile(Et(f,"cmdline").fsPath,"utf8");l.push({pid:h,cwd:S,cmd:T})}}catch{}let d=[],c=o.filter((g=>{let h=s[g.socket];return h||d.push(g),h})),u=KJ(c,s,l),m;if(this.logService.trace(`ForwardedPorts: (ExtHostTunnelService) number of possible root ports ${d.length}`),d.length>0){let g=await new Promise(h=>{b$("ps -F -A -l | grep root",(f,I,S)=>{h(I)})});this._foundRootPorts=jJ(d,g,this._foundRootPorts),m=Array.from(this._foundRootPorts.values()),this.logService.trace(`ForwardedPorts: (ExtHostTunnelService) heuristic ports ${m.map(h=>h.port).join(", ")}`)}return u.then(g=>m?g.concat(m):g)}async defaultTunnelHost(){let e=(await this.configurationService.getConfigProvider()).getConfiguration("remote").get("localPortHost");return!e||e==="localhost"?"127.0.0.1":"0.0.0.0"}makeManagedTunnelFactory(e){return async n=>{let o=new Ay({commit:this.initData.commit,quality:this.initData.quality,logService:this.logService,ipcLogger:null,remoteSocketFactoryService:{_serviceBrand:void 0,async connect(s,a,l,d){let c=await e.makeConnection();return yN.connect(c,a,l,d)},register(){throw new Error("not implemented")}},addressProvider:{getAddress(){return Promise.resolve({connectTo:new Jp(0),connectionToken:e.connectionToken})}},signService:this.signService},await this.defaultTunnelHost(),n.remoteAddress.host||"localhost",n.remoteAddress.port,n.localAddressPort);await o.waitForReady();let i=new E;return{localAddress:bN(o.localAddress)??o.localAddress,remoteAddress:{port:o.tunnelRemotePort,host:o.tunnelRemoteHost},onDidDispose:i.event,dispose:()=>{o.dispose(),i.fire(),i.dispose()}}}}};eh=_([C(0,se),C(1,Ye),C(2,oe),C(3,Ud),C(4,Sn)],eh);var yN=class r extends dP{constructor(e,n,o){super(n,o);this.passing=e}static connect(e,n,o,i){let s=new $,a={onClose:s.add(new E),onData:s.add(new E),onEnd:s.add(new E)};s.add(e.onDidReceiveMessage(d=>a.onData.fire(H.wrap(d)))),s.add(e.onDidEnd(()=>a.onEnd.fire())),s.add(e.onDidClose(d=>a.onClose.fire({type:0,error:d,hadError:!!d})));let l=new r(e,i,a);return l._register(s),s$(l,n,o,i,a)}write(e){this.passing.send(e.buffer)}closeRemote(){this.passing.end()}async drain(){await this.passing.drain?.()}};import*as Ga from"fs";var fP=class extends ug{constructor(){super(...arguments);this._workspaceStorageLock=null}async _getWorkspaceStorageURI(e){let n=await super._getWorkspaceStorageURI(e);if(n.scheme!==V.file)return n;if(this._environment.skipWorkspaceStorageLock)return this._logService.info(`Skipping acquiring lock for ${n.fsPath}.`),n;let o=n.fsPath,i=0;do{let s;i===0?s=o:s=/[/\\]$/.test(o)?`${o.substr(0,o.length-1)}-${i}`:`${o}-${i}`,await GJ(s);let a=Ne(s,"vscode.lock"),l=await I$(this._logService,a,!1);if(l)return this._workspaceStorageLock=l,process.on("exit",()=>{l.dispose()}),b.file(s);i++}while(i<10);return n}onWillDeactivateAll(){this._workspaceStorageLock?.setWillRelease(6e3)}};async function GJ(r){try{await Ga.promises.stat(r);return}catch{}try{await Ga.promises.mkdir(r,{recursive:!0})}catch{}}var QJ=1e3,y$=600*1e3,xN=class extends O{constructor(e,n){super();this.logService=e;this.filename=n;this._timer=this._register(new cp),this._timer.cancelAndSet(async()=>{let o=await SN(e,n);(!o||o.pid!==process.pid)&&(e.info(`Lock '${n}': The lock was lost unexpectedly.`),this._timer.cancel());try{await Ga.promises.utimes(n,new Date,new Date)}catch(i){e.error(i),e.info(`Lock '${n}': Could not update mtime.`)}},QJ)}dispose(){super.dispose();try{Ga.unlinkSync(this.filename)}catch{}}async setWillRelease(e){this.logService.info(`Lock '${this.filename}': Marking the lockfile as scheduled to be released in ${e} ms.`);try{let n={pid:process.pid,willReleaseAt:Date.now()+e};await st.writeFile(this.filename,JSON.stringify(n),{flag:"w"})}catch(n){this.logService.error(n)}}};async function I$(r,t,e){try{let o={pid:process.pid,willReleaseAt:0};await st.writeFile(t,JSON.stringify(o),{flag:"wx"})}catch(o){r.error(o)}let n=await SN(r,t);return!n||n.pid!==process.pid?e?(r.info(`Lock '${t}': Could not acquire lock, giving up.`),null):(r.info(`Lock '${t}': Could not acquire lock, checking if the file is stale.`),YJ(r,t)):(r.info(`Lock '${t}': Lock acquired.`),new xN(r,t))}async function SN(r,t){let e;try{e=await Ga.promises.readFile(t)}catch(n){return r.error(n),null}try{return JSON.parse(String(e))}catch(n){return r.error(n),null}}async function IN(r,t){let e;try{e=await Ga.promises.stat(t)}catch(n){return r.error(n),0}return e.mtime.getTime()}function JJ(r){try{return process.kill(r,0),!0}catch{return!1}}async function YJ(r,t){let e=await SN(r,t);if(!e)return r.info(`Lock '${t}': Could not read pid of lock holder.`),Ly(r,t);if(e.willReleaseAt){let a=e.willReleaseAt-Date.now();if(a<5e3){for(a>0?r.info(`Lock '${t}': The lockfile is scheduled to be released in ${a} ms.`):r.info(`Lock '${t}': The lockfile is scheduled to have been released.`);a>0;){if(await Ut(Math.min(100,a)),await IN(r,t)===0)return Ly(r,t);a=e.willReleaseAt-Date.now()}return Ly(r,t)}}if(!JJ(e.pid))return r.info(`Lock '${t}': The pid ${e.pid} appears to be gone.`),Ly(r,t);let n=await IN(r,t),o=Date.now()-n;if(o<=y$)return r.info(`Lock '${t}': The lock does not look stale, elapsed: ${o} ms, giving up.`),null;r.info(`Lock '${t}': The lock looks stale, waiting for 2s.`),await Ut(2e3);let i=await IN(r,t),s=Date.now()-i;return s<=y$?(r.info(`Lock '${t}': The lock does not look stale, elapsed: ${s} ms, giving up.`),null):(r.info(`Lock '${t}': The lock looks stale even after waiting for 2s.`),Ly(r,t))}async function Ly(r,t){r.info(`Lock '${t}': Deleting a stale lock.`);try{await Ga.promises.unlink(t)}catch{}return I$(r,t,!0)}async function XJ(r,t,e,n,o){try{let i=await import("@vscode/spdlog");i.setFlushOn(0);let s=await i.createAsyncRotatingLogger(r,t,e,n);return o?s.clearFormatters():s.setPattern("%Y-%m-%d %H:%M:%S.%e [%l] %v"),s}catch(i){console.error(i)}return null}function x$(r,t,e){switch(t){case 1:r.trace(e);break;case 2:r.debug(e);break;case 3:r.info(e);break;case 4:r.warn(e);break;case 5:r.error(e);break;case 0:break;default:throw new Error(`Invalid log level ${t}`)}}function S$(r,t){switch(t){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 ${t}`)}}var hP=class extends Il{constructor(e,n,o,i,s){super();this.buffer=[];this.setLevel(s),this._loggerCreationPromise=this._createSpdLogLogger(e,n,o,i),this._register(this.onDidChangeLogLevel(a=>{this._logger&&S$(this._logger,a)}))}async _createSpdLogLogger(e,n,o,i){let s=o?6:1,a=30/s*pc.MB,l=await XJ(e,n,a,s,i);if(l){this._logger=l,S$(this._logger,this.getLevel());for(let{level:d,message:c}of this.buffer)x$(this._logger,d,c);this.buffer=[]}}log(e,n){this._logger?x$(this._logger,e,n):this.getLevel()<=e&&this.buffer.push({level:e,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 vP=class extends _d{doCreateLogger(t,e,n){return t.scheme===V.file?new hP(n?.name||Ae(),t.fsPath,!n?.donotRotate,!!n?.donotUseFormatters,e):super.doCreateLogger(t,e,n)}registerLogger(t){super.registerLogger(t),this._proxy.$registerLogger(t)}deregisterLogger(t){super.deregisterLogger(t),this._proxy.$deregisterLogger(t)}};import{homedir as ZJ}from"os";var bP=class extends kd{homeDir(){return ZJ()}};var yP=class extends O{constructor(t,e=[]){super(),this.logger=new QI([t,...e]),this._register(t.onDidChangeLogLevel(n=>this.setLevel(n)))}get onDidChangeLogLevel(){return this.logger.onDidChangeLogLevel}setLevel(t){this.logger.setLevel(t)}getLevel(){return this.logger.getLevel()}trace(t,...e){this.logger.trace(t,...e)}debug(t,...e){this.logger.debug(t,...e)}info(t,...e){this.logger.info(t,...e)}warn(t,...e){this.logger.warn(t,...e)}error(t,...e){this.logger.error(t,...e)}flush(){this.logger.flush()}};var th=class extends yP{constructor(t,e,n){let o=n.remote.isRemote?"remoteexthost":t?"workerexthost":"exthost",i=n.remote.isRemote?p(3494,null):t?p(3495,null):p(3493,null);super(e.createLogger(o,{name:i}))}};th=_([C(1,Xo),C(2,Ye)],th);import{spawn as tY}from"child_process";import{readFile as nY}from"fs/promises";import{homedir as oY}from"os";function C$(r){let t=new Map,n=r.replace(/\r\n?/g,`
`).split(`
`);for(let s of n){if(s=s.trim(),!s||s.startsWith("#"))continue;let[a,l]=o(s);a&&t.set(a,l)}return t;function o(s){s.startsWith("export ")&&(s=s.substring(7).trim());let a=i(s,u=>u==="="||u===":");if(a===-1)return[null,null];let l=s.substring(0,a).trim(),d=s.substring(a+1).trim(),c=i(d,u=>u==="#");if(c!==-1&&(d=d.substring(0,c).trim()),d.length>=2){let u=d[0],m=d[d.length-1];(u==='"'&&m==='"'||u==="'"&&m==="'"||u==="`"&&m==="`")&&(d=d.substring(1,d.length-1),u==='"'&&(d=d.replace(/\\n/g,`
`).replace(/\\r/g,"\r")))}return[l,d]}function i(s,a){let l=!1,d="";for(let c=0;c<s.length;c++){let u=s[c];if(l)u===d&&s[c-1]!=="\\"&&(l=!1);else if(u==='"'||u==="'"||u==="`")l=!0,d=u;else if(a(u))return c}return-1}}import{Transform as eY}from"stream";var Oy=class extends eY{constructor(t){if(super(),typeof t=="number")this.splitter=t,this.spitterLen=1;else{let e=Buffer.isBuffer(t)?t:Buffer.from(t);this.splitter=e.length===1?e[0]:e,this.spitterLen=e.length}}_transform(t,e,n){this.buffer?this.buffer=Buffer.concat([this.buffer,t]):this.buffer=t;let o=0;for(;o<this.buffer.length;){let i=typeof this.splitter=="number"?this.buffer.indexOf(this.splitter,o):k_(this.buffer,this.splitter,o);if(i===-1)break;this.push(this.buffer.slice(o,i+this.spitterLen)),o=i+this.spitterLen}this.buffer=o===this.buffer.length?void 0:this.buffer.slice(o),n()}_flush(t){this.buffer&&this.push(this.buffer),t()}};var IP=class r{constructor(t,e=r.GRACE_TIME_MS){this._child=t;this._graceTimeMs=e;this._procState=0}static{this.GRACE_TIME_MS=1e4}get stopped(){return this._procState!==0}stop(){if(this._procState===0){let t=this._graceTimeMs;try{this._child.stdin.end()}catch{t=1}this._procState=1,this._nextTimeout=new Ih(()=>this.killPolite(),t)}else this._nextTimeout?.dispose(),this.killForceful()}async killPolite(){this._procState=2,this._nextTimeout=new Ih(()=>this.killForceful(),this._graceTimeMs),this._child.pid?Ie||await Wb(this._child.pid,!1).catch(()=>{this._child.kill("SIGTERM")}):this._child.kill("SIGTERM")}async killForceful(){this._procState=3,this._child.pid?await Wb(this._child.pid,!0).catch(()=>{this._child.kill("SIGKILL")}):this._child.kill()}write(t){this.stopped||this._child.stdin.write(t+`
`)}dispose(){this._nextTimeout?.dispose()}};var xP=class extends Dd{constructor(){super(...arguments);this.nodeServers=this._register(new Fn)}_startMcp(e,n,o,i){n.type===1?this.startNodeMpc(e,n,o):n.type===2?this._sseEventSources.set(e,new CN(e,n,this._proxy,this._logService,i)):super._startMcp(e,n,o,i)}$stopMcp(e){let n=this.nodeServers.get(e);n?n.stop():super.$stopMcp(e)}$sendMessage(e,n){let o=this.nodeServers.get(e);o?o.write(n):super.$sendMessage(e,n)}async startNodeMpc(e,n,o){let i=d=>this._proxy.$onDidChangeState(e,{state:So.Kind.Error,code:d.hasOwnProperty("code")?String(d.code):void 0,message:typeof d=="string"?d:d.message}),s={...process.env};if(n.envFile)try{for(let[d,c]of C$(await nY(n.envFile,"utf-8")))s[d]=c}catch(d){i(`Failed to read envFile '${n.envFile}': ${d.message}`);return}for(let[d,c]of Object.entries(n.env)){if(d.toUpperCase()==="PATH"&&c!==null){s[d]=s[d]?`${s[d]}${sp}${String(c)}`:String(c);continue}s[d]=c===null?void 0:String(c)}let a;try{let d=oY(),c=n.cwd?xc(n.cwd,d):o?.fsPath||d;En(c)||(c=o?Ne(o.fsPath,c):Ne(d,c));let{executable:u,args:m,shell:g}=await iY(xc(n.command,d),n.args.map(h=>xc(h,d)),c,s);this._proxy.$onDidPublishLog(e,2,`Server command line: ${u} ${m.join(" ")}`),a=tY(u,m,{stdio:"pipe",cwd:c,env:s,shell:g})}catch(d){i(d);return}let l=new IP(a);this._proxy.$onDidChangeState(e,{state:So.Kind.Starting}),a.stdout.pipe(new Oy(`
`)).on("data",d=>this._proxy.$onDidReceiveMessage(e,d.toString())),a.stdin.on("error",i),a.stdout.on("error",i),a.stderr.pipe(new Oy(`
`)).on("data",d=>this._proxy.$onDidPublishLog(e,4,`[server stderr] ${d.toString().trimEnd()}`)),a.on("spawn",()=>this._proxy.$onDidChangeState(e,{state:So.Kind.Running})),a.on("error",d=>{i(d)}),a.on("exit",d=>{this.nodeServers.deleteAndDispose(e),d===0||l.stopped?this._proxy.$onDidChangeState(e,{state:So.Kind.Stopped}):this._proxy.$onDidChangeState(e,{state:So.Kind.Error,message:`Process exited with code ${d}`})}),this.nodeServers.set(e,l)}},CN=class extends Hb{constructor(){super(...arguments);this._undici=new mt(()=>import("undici"))}async _fetchInternal(e,n){let{fetch:o,Agent:i}=await this._undici.value,s={...n},a=e,l=b.parse(e);if(l.scheme==="unix"||l.scheme==="pipe")s.dispatcher=new i({socketPath:l.path}),a=l.with({scheme:"http",authority:"localhost",path:l.fragment}).toString(!0);else return super._fetchInternal(e,n);let d=await o(a,s);return{status:d.status,statusText:d.statusText,headers:d.headers,body:d.body,url:d.url,json:()=>d.json(),text:()=>d.text()}}},rY=/\.(bat|cmd)$/i,iY=async(r,t,e,n)=>{if(process.platform!=="win32")return{executable:r,args:t,shell:!1};let o=await Pu(r,e,void 0,n);if(o&&rY.test(o)){let i=s=>s.includes(" ")?`"${s}"`:s;return{executable:i(o),args:t.map(i),shell:!0}}return{executable:r,args:t,shell:!1}};import{URL as lY}from"url";import{randomBytes as sY}from"crypto";import{URL as aY}from"url";var SP=class{constructor(t,e,n){this._logger=t;this._appUri=e;this._appName=n;this._state=sY(16).toString("base64");let o=new Jt;this._resultPromise=o.p,this._server=(async()=>(await import("http")).createServer((s,a)=>{let l=new aY(s.url,`http://${s.headers.host}`);switch(l.pathname){case"/":{let d=l.searchParams.get("code")??void 0,c=l.searchParams.get("state")??void 0,u=l.searchParams.get("error")??void 0;if(u){a.writeHead(302,{location:`/done?error=${l.searchParams.get("error_description")||u}`}),a.end(),o.error(new Error(u));break}if(!d||!c){a.writeHead(400),a.end();break}if(this.state!==c){a.writeHead(302,{location:`/done?error=${encodeURIComponent("State does not match.")}`}),a.end(),o.error(new Error("State does not match."));break}o.complete({code:d,state:c}),a.writeHead(302,{location:"/done"}),a.end();break}case"/done":this._sendPage(a);break;default:a.writeHead(404),a.end();break}}))()}get state(){return this._state}get redirectUri(){if(this._port===void 0)throw new Error("Server is not started yet");return`http://127.0.0.1:${this._port}/`}_sendPage(t){let e=this.getHtml();t.writeHead(200,{"Content-Type":"text/html","Content-Length":Buffer.byteLength(e,"utf8")}),t.end(e)}async start(){let t=await this._server,e=new Jt;if(t.listening)throw new Error("Server is already started");let n=setTimeout(()=>{e.error(new Error("Timeout waiting for port"))},5e3);return t.on("listening",()=>{let o=t.address();if(typeof o=="string")this._port=parseInt(o);else if(o instanceof Object)this._port=o.port;else throw new Error("Unable to determine port");clearTimeout(n),e.complete()}),t.on("error",o=>{if("code"in o&&o.code==="EADDRINUSE"){this._logger.error("Address in use, retrying with a different port..."),t.listen(0,"127.0.0.1");return}clearTimeout(n),e.error(new Error(`Error listening to server: ${o}`))}),t.on("close",()=>{e.error(new Error("Closed"))}),t.listen(e0,"127.0.0.1"),e.p}async stop(){let t=new Jt,e=await this._server;return e.listening?(e.close(n=>{n?t.error(n):t.complete()}),setTimeout(()=>{t.isResolved||t.error(new Error("Timeout waiting for server to close"))},5e3),t.p):(t.complete(),t.p)}waitForOAuthResponse(){return this._resultPromise}getHtml(){let t="url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABAAAAAQABAMAAACNMzawAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAJ1BMVEUAAAD///9Qm8+ozed8tNsWer+Lvd9trNfF3u9Ck8slgsMzi8eZxeM/Qa6mAAAAAXRSTlMAQObYZgAAAAFiS0dEAf8CLd4AAAAHdElNRQfiCwYULRt0g+ZLAAAJRUlEQVR42u3SUY0CQRREUSy0hSZtBA+wfOwv4wAPYwAJSMAfAthkB6YD79HnKqikzmYjSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIk6cmKhg4AAASAABAAAkAACAABIAAEgAAQAAJAAAgAAaBvBVAjtV2wfFe1ogcA+0gdFgBoe60IAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAnAjAP/1MkWoAvBvAsUTqBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJAAgAASAABIAAEAACQAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAKA7gDlbFwC6AijZagAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQDM2boA0BXAqAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIATARAAAkAAvF7N1hWArgBKthoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAfBrAlK0bAF0BjBoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4EQABIAAEwOtN2boB0BVAyVYDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgE8DqNm6AtAVwKgBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAEwEQAAJAAPzd7xypMwDvBnAskToBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAIAAkAACAABIAAEgAAQAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAkAACAABIAAEgAAQAAJAAAgAASAABIAAEAACQAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIBKBGarsAwK5qRQ8ANGYAACAABIAAEAACQAAIAAEgAASAABAAAkDfCUCSJEmSJEmSJEmSJEmSJEmSJEmSJEmSJEmSJEmSJEmSJEmSJEmSJEmSJEmSJEmSJEmSJEmSJC3uDtO80OSql+i8AAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDE4LTExLTA2VDIwOjQ1OjI3KzAwOjAwEjLurQAAACV0RVh0ZGF0ZTptb2RpZnkAMjAxOC0xMS0wNlQyMDo0NToyNyswMDowMGNvVhEAAAAZdEVYdFNvZnR3YXJlAEFkb2JlIEltYWdlUmVhZHlxyWU8AAAAAElFTkSuQmCC')";return this._appName==="Visual Studio Code"?t="url('data:image/svg+xml;base64, ')":this._appName==="Visual Studio Code - Insiders"&&(t="url('data:image/svg+xml;base64, ')"),`<!DOCTYPE html>
<html lang="en">

<head>
	<meta charset="utf-8" />
	<title>GitHub Authentication - Sign In</title>
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<style>
		html {
			height: 100%;
		}

		body {
			box-sizing: border-box;
			min-height: 100%;
			margin: 0;
			padding: 15px 30px;
			display: flex;
			flex-direction: column;
			color: white;
			font-family: "Segoe UI","Helvetica Neue","Helvetica",Arial,sans-serif;
			background-color: #2C2C32;
		}

		.branding {
			background-image: ${t};
			background-size: 24px;
			background-repeat: no-repeat;
			background-position: left center;
			padding-left: 36px;
			font-size: 20px;
			letter-spacing: -0.04rem;
			font-weight: 400;
			color: white;
			text-decoration: none;
		}

		.message-container {
			flex-grow: 1;
			display: flex;
			align-items: center;
			justify-content: center;
			margin: 0 30px;
		}

		.message {
			font-weight: 300;
			font-size: 1.4rem;
		}

		body.error .message {
			display: none;
		}

		body.error .error-message {
			display: block;
		}

		.error-message {
			display: none;
			font-weight: 300;
			font-size: 1.3rem;
		}

		.error-text {
			color: red;
			font-size: 1rem;
		}

		@font-face {
			font-family: 'Segoe UI';
			src: url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/light/latest.eot"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/light/latest.eot?#iefix") format("embedded-opentype");
			src: local("Segoe UI Light"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/light/latest.woff2") format("woff2"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/light/latest.woff") format("woff"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/light/latest.ttf") format("truetype"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/light/latest.svg#web") format("svg");
			font-weight: 200
		}

		@font-face {
			font-family: 'Segoe UI';
			src: url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/semilight/latest.eot"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/semilight/latest.eot?#iefix") format("embedded-opentype");
			src: local("Segoe UI Semilight"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/semilight/latest.woff2") format("woff2"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/semilight/latest.woff") format("woff"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/semilight/latest.ttf") format("truetype"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/semilight/latest.svg#web") format("svg");
			font-weight: 300
		}

		@font-face {
			font-family: 'Segoe UI';
			src: url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/normal/latest.eot"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/normal/latest.eot?#iefix") format("embedded-opentype");
			src: local("Segoe UI"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/normal/latest.woff2") format("woff"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/normal/latest.woff") format("woff"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/normal/latest.ttf") format("truetype"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/normal/latest.svg#web") format("svg");
			font-weight: 400
		}

		@font-face {
			font-family: 'Segoe UI';
			src: url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/semibold/latest.eot"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/semibold/latest.eot?#iefix") format("embedded-opentype");
			src: local("Segoe UI Semibold"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/semibold/latest.woff2") format("woff"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/semibold/latest.woff") format("woff"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/semibold/latest.ttf") format("truetype"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/semibold/latest.svg#web") format("svg");
			font-weight: 600
		}

		@font-face {
			font-family: 'Segoe UI';
			src: url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/bold/latest.eot"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/bold/latest.eot?#iefix") format("embedded-opentype");
			src: local("Segoe UI Bold"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/bold/latest.woff2") format("woff"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/bold/latest.woff") format("woff"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/bold/latest.ttf") format("truetype"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/bold/latest.svg#web") format("svg");
			font-weight: 700
		}
	</style>
</head>

<body>
	<a class="branding" href="https://code.visualstudio.com/">
		${this._appName}
	</a>
	<div class="message-container">
		<div class="message">
			Sign-in successful! Returning to ${this._appName}...
			<br><br>
			If you're not redirected automatically, <a href="${this._appUri.toString(!0)}" style="color: #85CEFF;">click here</a> or close this page.
		</div>
		<div class="error-message">
			An error occurred while signing in:
			<div class="error-text"></div>
		</div>
	</div>
	<script>
		const search = window.location.search;
		const error = (/[?&^]error=([^&]+)/.exec(search) || [])[1];
		if (error) {
			document.querySelector('.error-text')
				.textContent = decodeURIComponent(error);
			document.querySelector('body')
				.classList.add('error');
		} else {
			// Redirect to the app URI after a 1-second delay to allow page to load
			setTimeout(function() {
				window.location.href = '${this._appUri.toString(!0)}';
			}, 1000);
		}
	</script>
</body>
</html>`}};var TN=class extends xu{constructor(t,e,n,o,i,s,a,l,d,c,u,m,g){super(t,e,n,o,i,s,a,l,d,c,u,m,g),!n.remote.isRemote&&l.authorization_endpoint&&this._createFlows.unshift({label:p(3519,null),handler:(h,f,I)=>this._createWithLoopbackServer(h,f,I)}),l.device_authorization_endpoint&&this._createFlows.push({label:p(3518,null),handler:(h,f,I)=>this._createWithDeviceCode(h,f,I)})}async _createWithLoopbackServer(t,e,n){if(!this._serverMetadata.authorization_endpoint)throw new Error("Authorization Endpoint required");if(!this._serverMetadata.token_endpoint)throw new Error("Token endpoint not available in server metadata");let o=this.generateRandomString(64),i=await this.generateCodeChallenge(o),s=this.generateRandomString(32),a=b.parse(`${this._initData.environment.appUriScheme}://dynamicauthprovider/${this.authorizationServer.authority}/redirect?nonce=${s}`),l;try{l=await this._extHostUrls.createAppUri(a)}catch(g){throw new Error(`Failed to create external URI: ${g}`)}let d=new lY(this._serverMetadata.authorization_endpoint);d.searchParams.append("client_id",this._clientId),d.searchParams.append("response_type","code"),d.searchParams.append("code_challenge",i),d.searchParams.append("code_challenge_method","S256");let c=t.join(" ");c&&d.searchParams.append("scope",c),this._resourceMetadata?.resource&&d.searchParams.append("resource",this._resourceMetadata.resource);let u=new SP(this._logger,l,this._initData.environment.appName);try{await u.start()}catch(g){throw new Error(`Failed to start loopback server: ${g}`)}d.searchParams.set("redirect_uri",u.redirectUri),d.searchParams.set("state",u.state);let m=u.waitForOAuthResponse();this._proxy.$waitForUriHandler(l);try{if(this._logger.info(`Opening authorization URL for scopes: ${c}`),this._logger.trace(`Authorization URL: ${d.toString()}`),!await this._extHostWindow.openUri(d.toString(),{}))throw new Be;e.report({message:p(3517,null)});let h;try{h=(await ml(m,n)).code}catch(I){throw Qt(I)?(this._logger.info("Authorization code request was cancelled by the user."),I):(this._logger.error(`Failed to receive authorization code: ${I}`),new Error(`Failed to receive authorization code: ${I}`))}return this._logger.info(`Authorization code received for scopes: ${c}`),await this.exchangeCodeForToken(h,o,u.redirectUri)}finally{setTimeout(()=>{u.stop()},5e3)}}async _createWithDeviceCode(t,e,n){if(!this._serverMetadata.token_endpoint)throw new Error("Token endpoint not available in server metadata");if(!this._serverMetadata.device_authorization_endpoint)throw new Error("Device authorization endpoint not available in server metadata");let o=this._serverMetadata.device_authorization_endpoint,i=t.join(" ");this._logger.info(`Starting device code flow for scopes: ${i}`);let s=new URLSearchParams;s.append("client_id",this._clientId),i&&s.append("scope",i),this._resourceMetadata?.resource&&s.append("resource",this._resourceMetadata.resource);let a;try{a=await fetch(o,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:s.toString()})}catch(m){throw this._logger.error(`Failed to request device code: ${m}`),new Error(`Failed to request device code: ${m}`)}if(!a.ok){let m=await a.text();throw new Error(`Device code request failed: ${a.status} ${a.statusText} - ${m}`)}let l=await a.json();if(!eV(l))throw this._logger.error("Invalid device code response received from server"),new Error("Invalid device code response received from server");if(this._logger.info(`Device code received: ${l.user_code}`),!await this._proxy.$showDeviceCodeModal(l.user_code,l.verification_uri))throw new Be;e.report({message:p(3520,null,l.verification_uri,l.user_code)});let c=(l.interval||5)*1e3,u=Date.now()+l.expires_in*1e3;for(;Date.now()<u;){if(n.isCancellationRequested)throw new Be;if(await new Promise(g=>setTimeout(g,c)),n.isCancellationRequested)throw new Be;let m=new URLSearchParams;m.append("grant_type","urn:ietf:params:oauth:grant-type:device_code"),m.append("device_code",l.device_code),m.append("client_id",this._clientId),this._resourceMetadata?.resource&&m.append("resource",this._resourceMetadata.resource);try{let g=await fetch(this._serverMetadata.token_endpoint,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:m.toString()});if(g.ok){let h=await g.json();if(!wb(h))throw this._logger.error("Invalid token response received from server"),new Error("Invalid token response received from server");return this._logger.info(`Device code flow completed successfully for scopes: ${i}`),h}else{let h;try{h=await g.json()}catch(f){throw this._logger.error(`Failed to parse error response: ${f}`),new Error(`Token request failed with status ${g.status}: ${g.statusText}`)}if(h.error==="authorization_pending")continue;if(h.error==="slow_down"){await new Promise(f=>setTimeout(f,c));continue}else throw h.error==="expired_token"?new Error("Device code expired. Please try again."):h.error==="access_denied"?new Be:h.error==="invalid_client"?(this._logger.warn(`Client ID (${this._clientId}) was invalid, generated a new one.`),await this._generateNewClientId(),new Error("Client ID was invalid, generated a new one. Please try again.")):new Error(`Token request failed: ${h.error_description||h.error||"Unknown error"}`)}}catch(g){throw Qt(g)?g:new Error(`Error polling for token: ${g}`)}}throw new Error("Device code flow timed out. Please try again.")}},CP=class extends Sg{constructor(e,n,o,i,s,a,l){super(e,n,o,i,s,a,l);this._dynamicAuthProviderCtor=TN}};qe(go,lP,0);qe(Xo,vP,1);qe(oe,new Zo(th,[!1],!0));qe(Ud,af,1);qe(pg,fP,0);qe(Id,new Zo(bg,[!1],!0));qe(Cg,CP,0);qe(jg,lf,0);qe(Jg,mf,0);qe(Bg,rf,0);qe(wo,of,0);qe(bd,eh,0);qe(Wr,bP,0);qe(ku,xP,0);import{createRequire as cY}from"node:module";var E$=cY(import.meta.url);if(process.env.VSCODE_DEV){let r=process.listeners("warning");process.removeAllListeners("warning"),process.on("warning",t=>{if(t.code==="ExperimentalWarning"||t.name==="ExperimentalWarning"||t.name==="DeprecationWarning"){console.debug(t);return}r[0](t)})}(function(){for(let t=0;t<process.execArgv.length;t++)process.execArgv[t]==="--inspect-port=0"&&(process.execArgv.splice(t,1),t--)})();var Ny=dY(process.argv.slice(2),{boolean:["transformURIs","skipWorkspaceStorageLock","supportGlobalNavigator"],string:["useHostProxy"]});(function(){let r=E$("module"),t=r._load;r._load=function(e){if(e==="natives")throw new Error('Either the extension or an NPM dependency is using the [unsupported "natives" node module](https://go.microsoft.com/fwlink/?linkid=871887).');return t.apply(this,arguments)}})();var TP=process.exit.bind(process),uY=process.on.bind(process);function pY(r){process.exit=function(t){if(r)TP(t);else{let e=new Error("An extension called process.exit() and this was prevented.");console.warn(e.stack)}},process.crash=function(){let t=new Error("An extension called process.crash() and this was prevented.");console.warn(t.stack)},process.env.ELECTRON_RUN_AS_NODE="1",process.on=function(t,e){if(t==="uncaughtException"){let n=e;e=function(...o){try{return n.apply(void 0,o)}catch{}}}uY(t,e)}}Ny.supportGlobalNavigator||Object.defineProperty(globalThis,"navigator",{get:()=>{qd(new $d("navigator is now a global in nodejs, please see https://aka.ms/vscode-extensions/navigator for additional info on this error."))}});var Gs=function(r){TP()};function mY(r,t){let e=process.env[r];if(typeof e!="string"||e.trim().length===0)return console.log(`[reconnection-grace-time] Extension host: env var ${r} not set, using default: ${t}ms (${Math.floor(t/1e3)}s)`),t;let n=Number(e);if(!isFinite(n)||n<0)return console.log(`[reconnection-grace-time] Extension host: env var ${r} invalid value '${e}', using default: ${t}ms (${Math.floor(t/1e3)}s)`),t;let o=Math.floor(n),i=o>Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:o;return console.log(`[reconnection-grace-time] Extension host: read ${r}=${e}ms (${Math.floor(i/1e3)}s)`),i}function gY(){let r=bV(process.env);if(r.type===3)return new Promise((t,e)=>{let n=o=>{let i=o[0],s=new as;i.on("message",a=>s.fire(H.wrap(a.data))),i.on("close",()=>{Gs("renderer closed the MessagePort")}),i.start(),t({onMessage:s.event,send:a=>i.postMessage(a.buffer)})};process.parentPort.on("message",o=>n(o.ports))});if(r.type===2)return new Promise((t,e)=>{let n=null,o=setTimeout(()=>{Gs("VSCODE_EXTHOST_IPC_SOCKET timeout")},6e4),i=mY("VSCODE_RECONNECTION_GRACE_TIME",108e5),s=i>0?Math.min(3e5,i):0,a=new xh(()=>Gs("renderer disconnected for too long (1)"),i),l=new xh(()=>Gs("renderer disconnected for too long (2)"),s);process.on("message",(c,u)=>{if(c&&c.type==="VSCODE_EXTHOST_IPC_SOCKET"){u.setNoDelay(!0);let m=H.wrap(Buffer.from(c.initialDataChunk,"base64")),g;if(c.skipWebSocketFrames)g=new oa(u,"extHost-socket");else{let h=H.wrap(Buffer.from(c.inflateBytes,"base64"));g=new OI(new oa(u,"extHost-socket"),c.permessageDeflate,h,!1)}n?(a.cancel(),l.cancel(),n.beginAcceptReconnection(g,m),n.endAcceptReconnection(),n.sendResume()):(clearTimeout(o),n=new sc({socket:g,initialChunk:m}),n.sendResume(),he.once(n.onDidDispose)(()=>Gs("renderer disconnected")),t(n),n.onSocketClose(()=>{a.schedule()}))}if(c&&c.type==="VSCODE_EXTHOST_IPC_REDUCE_GRACE_TIME"){if(l.isScheduled())return;a.isScheduled()&&l.schedule()}});let d={type:"VSCODE_EXTHOST_IPC_READY"};process.send?.(d)});{let t=r.pipeName;return new Promise((e,n)=>{let o=T$.createConnection(t,()=>{o.removeListener("error",n);let i=new sc({socket:new oa(o,"extHost-renderer")});i.sendResume(),e(i)});o.once("error",n),o.on("close",()=>{Gs("renderer closed the socket")})})}}async function fY(){let r=await gY();return new class{constructor(){this._onMessage=new as;this.onMessage=this._onMessage.event;this._terminating=!1,this._protocolListener=r.onMessage(t=>{Q4(t,2)?(this._terminating=!0,this._protocolListener.dispose(),Gs("received terminate message from renderer")):this._onMessage.fire(t)})}send(t){this._terminating||r.send(t)}async drain(){if(r.drain)return r.drain()}}}function hY(r){return new Promise(t=>{let e=r.onMessage(n=>{e.dispose();let o=JSON.parse(n.toString()),i=o.commit,s=Yo.commit;if(i&&s&&i!==s&&TP(55),o.parentPid){let a=0;setInterval(function(){try{process.kill(o.parentPid,0),a=0}catch(d){d&&d.code==="EPERM"?(a++,a>=3&&Gs(`parent process ${o.parentPid} does not exist anymore (3 x EPERM): ${d.message} (code: ${d.code}) (errno: ${d.errno})`)):Gs(`parent process ${o.parentPid} does not exist anymore: ${d.message} (code: ${d.code}) (errno: ${d.errno})`)}},1e3);let l;try{l=E$("@vscode/native-watchdog"),l.start(o.parentPid)}catch(d){ze(d)}}r.send(jM(0)),t({protocol:r,initData:o})});r.send(jM(1))})}async function vY(){let r=[];process.on("unhandledRejection",(a,l)=>{r.push(l),setTimeout(()=>{let d=r.indexOf(l);d>=0&&l.catch(c=>{r.splice(d,1),Qt(c)||(console.warn(`rejected promise not handled within 1 second: ${c}`),c&&c.stack&&console.warn(`stack trace: ${c.stack}`),a&&ze(a))})},1e3)}),process.on("rejectionHandled",a=>{let l=r.indexOf(a);l>=0&&r.splice(l,1)}),process.on("uncaughtException",function(a){AN(a)||ze(a)}),Ft("code/extHost/willConnectToRenderer");let t=await fY();Ft("code/extHost/didConnectToRenderer");let e=await hY(t);Ft("code/extHost/didWaitForInitData");let{initData:n}=e;pY(!!n.environment.extensionTestsLocationURI),n.environment.useHostProxy=Ny.useHostProxy!==void 0?Ny.useHostProxy!=="false":void 0,n.environment.skipWorkspaceStorageLock=le(Ny.skipWorkspaceStorageLock,!1);let o=new class{constructor(){this.pid=process.pid}exit(l){TP(l)}fsExists(l){return st.exists(l)}fsRealpath(l){return st.realpath(l)}},i=null;n.remote.authority&&Ny.transformURIs&&(i=vV(n.remote.authority));let s=new JT(e.protocol,n,o,i);Gs=a=>s.terminate(a)}vY().catch(r=>console.log(r));
